S2Member new users signing up with a registration date in the future

Hey guys,

We’re using S2Member Pro on a site to allow users to sign up for an account, and then we manually approve them. However, I’ve seen multiple user accounts with signups in the future, somehow. We’re not sure how, and I can’t seem to find anything in these forums or online referencing similar problems – please let me know if this is known or not!

Not all of these signups seem spammy, and it’s only a few. For instance, we have one right now in there with a signup date of Fri Dec 1st, 2023 @ precisely 10:41 am - but a last login time of Thu Feb 16th, 2023 @ precisely 12:54 pm.

We did inherit this site, so I think it’s possible that these ten or so signups were legacy from way back when, but that doesn’t really feel like it explains how somebody has signed up with their registration date in the future.

We’re not seeing new signups having this issue as far as I’m aware. We’ve tested multiple times, and monitored the list, and they all seem to have accurate registration dates at the moment.

Any ideas at all about these future signups would be appreciated!

Hi Harry.

That’s an odd thing! See if you can find out from them what the lottery numbers will be in the coming months :grin:

What comes to mind is that they may have imported or modified the users with s2Member Pro’s import/export tool, and set an incorrect registration time… https://s2member.com/kb-article/advanced-importexport-tools/

I wrote a simple script you can use to check s2’s capability times from the database, and I suspect the very earliest one would match the time the user was created…

<?php
// Enable error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);

// Define the WordPress root directory
define('ABSPATH', dirname(__FILE__) . '/');

// Load the WordPress core files
require_once ABSPATH . 'wp-config.php';
require_once ABSPATH . 'wp-includes/wp-db.php';
require_once ABSPATH . 'wp-includes/user.php';

// Get user_id from the query string
$user_id = isset($_GET['user_id']) ? intval($_GET['user_id']) : 0;

if ($user_id > 0) {
    // Get user meta: wp_s2member_access_cap_times
    $access_cap_times_serialized = get_user_meta($user_id, 'wp_s2member_access_cap_times', true);

    if ($access_cap_times_serialized) {
        // Unserialize the serialized access cap times
        $access_cap_times = maybe_unserialize($access_cap_times_serialized);

        if (is_array($access_cap_times) && count($access_cap_times) > 0) {
            // Sort the access cap times array by key (timestamp)
            ksort($access_cap_times);

            // Get the earliest access cap timestamp (from the first array key)
            $earliest_timestamp = key($access_cap_times);

            // Convert Unix timestamp to a human-readable format
            $formatted_time = date('Y-m-d H:i:s', $earliest_timestamp);

            echo "User ID: {$user_id}<br>";
            echo "Earliest Access Cap Time: {$formatted_time}<br>";
        } else {
            echo "User has no access cap times or does not exist.";
        }
    } else {
        echo "No access cap times found for the user.";
    }
} else {
    echo "Invalid user ID.";
}

You can save it to a file, e.g. my-script.php, upload it to your wordpress directory, and load it from the browser with a user ID in the querystring: http://mysite.com/my-script.php?user_id=123

Try with one of those users from the future, and see if you get a more probable date.

:slight_smile:

Sorry - I had to put this on the backburner for a bit. Just got the script up and checked – you were right, thank you for the help! Really appreciate all the time and effort you’ve put into S2. Have a good day! :v:

1 Like

Great! Thank you for the update! I’m glad that solved it. :grinning:

I guess we won’t know those lottery numbers now, though… :sweat_smile: