latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

IP Logs?

Home Forums Community Forum IP Logs?

Tagged: ,

This topic contains 17 replies, has 4 voices. Last updated by  Cristián Lávaque 4 years, 1 month ago.

Topic Author Topic
Posted: Tuesday Nov 20th, 2012 at 5:36 am #32064

s2member will ban people based on ip but, is there a way to see a members different login ips? Lets say Joe has 100 log ins this week, it would be nice to see if those logins were coming from the same city, or all across the country. Is this possible? If the plugin can ban by ip, they must be stored somewhere, right?

List Of Topic Replies

Viewing 17 replies - 1 through 17 (of 17 total)
Author Replies
Author Replies
Posted: Tuesday Nov 20th, 2012 at 4:03 pm #32136
Raam Dev
Username: Raam
Staff Member

Hi Charles,

While the data is stored somewhere in the database, it’s not displayed anywhere or available in a report. We recognize that this would be a nice feature to have and we’re looking at including such a reporting feature in the next major release of the plugin.

Posted: Tuesday Nov 20th, 2012 at 4:15 pm #32140

Seems like all of my ideas are potential enhancements being considered… are you guys doing the pacification thing (highly effective/I’m not complaining) or is this something you can really see happening sooner than latter? I will probably just write my own script but, not if something integrated is coming. Heading over to phpmyadmin to poke around now…

Posted: Tuesday Nov 20th, 2012 at 4:43 pm #32143

OK, you got me, were are the ips stored in the database?

Posted: Tuesday Nov 20th, 2012 at 5:27 pm #32159
Raam Dev
Username: Raam
Staff Member

If you search the user_meta table for entries that have ‘s2′, you should find the ones related to IPs.

I don’t have an official list of new features / enhancements that Jason (the lead developer) is working on for the next major release of the software, but we have had several requests for the ability to see IP access logs in a report form, or at the very least improve how they’re stored in the database so that extensions/hacks can be written to show that data, so I know it’s being considered.

Posted: Tuesday Nov 20th, 2012 at 5:43 pm #32164

I got that far. Do you know the specific key? I can’t find any large blocks of ip’s anywhere.

Posted: Wednesday Nov 21st, 2012 at 9:38 pm #32302
Posted: Thursday Dec 6th, 2012 at 1:01 am #33664

Where exactly do I need to plug that code in? Im comfortable playing with code, just not sure exactly where to plug that function and code in. Thanks in advance.

Posted: Thursday Dec 6th, 2012 at 1:24 pm #33718
Bruce
Username: Bruce
Staff Member

Hi Charles,

We recommend putting this code into a Must-Use Plugin, by putting it into your /wp-content/mu-plugins/ directory (create one if you don’t have one).

This Must-Use plugin should only house the function that Jason wrote, and not actually display any information.

For getting the user’s info I would suggest creating a Post/Page to display this data for users (a private post/page or draft), and then finding the user’s ID or username to use the code.

OR

If you’re comfortable with it, you can create a custom admin submenu page within your Must Use plugin to house this functionality. Find info on this at WordPress.org >> API >> add_submenu_page()

Posted: Thursday Dec 6th, 2012 at 1:51 pm #33721

When I created a mu-plugins folder, a php file with the function, and dropped it into the folder my site went blank. Both the frontend and the admin user interface were blank pages. Any ideas? Is there a bug in that snippet?

Posted: Thursday Dec 6th, 2012 at 2:04 pm #33725
Bruce
Username: Bruce
Staff Member

Hi Charles,

What exactly did you put into the must use plugin?

Posted: Thursday Dec 6th, 2012 at 3:08 pm #33738

In the newly create mu-plugins folder. No subfolder as per the mu-plugin instructions.

Posted: Thursday Dec 6th, 2012 at 3:14 pm #33739
Bruce
Username: Bruce
Staff Member

Charles,

To clarify, you’re putting this code into a mu-plugin, within /wp-content/mu-plugins/a-plugin-file.php, correct?:

<?php
function s2_login_ips_for($username)
{
	$ips = get_transient('s2m_ipr_'.md5('s2member_ip_restrictions_'.strtolower($username).'_entries'));
	
	// This returns an associative array containing all IPs the user has logged in with, over the last 30 days.
	// Array keys are IP addresses, and array values are timestamps.
	return (is_array($ips)) ? $ips : array();
}
?>

I just tested this and it seems to be working correctly.

Posted: Thursday Dec 6th, 2012 at 3:17 pm #33740

When I created a mu-plugins folder, a php file with the function, and dropped it into the folder my site went blank. Both the frontend and the admin user interface were blank pages. Any ideas? Is there a bug in that snippet?

The code seems fine and Bruce just confirmed that it doesn’t cause an error…

Make sure there’s nothing outside the PHP block: no spaces or line breaks.

Posted: Thursday Dec 6th, 2012 at 3:52 pm #33757

“To clarify, you’re putting this code into a mu-plugin, within /wp-content/mu-plugins/a-plugin-file.php, correct?”

Correct.

“Make sure there’s nothing outside the PHP block: no spaces or line breaks.”

No spaces, no breaks. I just tried it all over a gain from scratch with the same results. As soon as that file is uploaded to the mu-plugins directory, the site goes blank.

I assumed it was a space at first as well as I’ve seen that kind of thing happen with functions.php files but, I have copied and pasted the code straight from the page and there are no extra spaces or breaks before or after it. My website probably has 10 other plugins running but they are all popular, well known, and supported — nothing weird/wacky.

Posted: Thursday Dec 6th, 2012 at 4:07 pm #33763
Bruce
Username: Bruce
Staff Member

Charles,

That’s interesting. Can you try running this Server Check Tool? Perhaps this is a memory issue?

Posted: Thursday Dec 6th, 2012 at 7:11 pm #33816

No memory issues, its set to 64.

The only error was “Mcrypt/Encryption Extension”

Posted: Friday Dec 7th, 2012 at 5:36 am #33849

It’d be good to fix that error then.

If that doesn’t solve the problem with the hack, though, could you try the suggestions in this article to troubleshoot it, please? Knowledge Base » Common Troubleshooting Tips

Viewing 17 replies - 1 through 17 (of 17 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.