Hi Mike. Thanks for your inquiry. I'm not sure I completely understand your question,
but let's break this down a bit, and hopefully this will help you out.s2Member uses existing MySQL tables that are already a part of WordPress. So the user ID, is the same as any WordPress User would have. The ID is found in the `wp_users` table, in the `ID` column.
Now, additional information is also stored for each User/Member, and again, the storage of this information follows existing WordPress standards. User/Member details are stored in the `wp_usermeta` table, referenced by the `user_id` column, matching the `ID` column in the `wp_users` table.
Now, here is a list of meta keys found in the `wp_usermeta` table with respect to s2Member.
`wp_usermeta`.`meta_key` = `s2member_custom`This is the custom string that you passed through the PayPal Button/Form, inside your Shortcode. By default, this will just be the domain name of your site. Although sometimes additional data is pipe delimited by a site owner or developer that is integrating s2Member in more creative ways.`wp_usermeta`.`meta_key` = `s2member_subscr_id`This is a paid Subscription ID, referencing a recurring payment profile, or a PayPal subscription, or a PayPal transaction that is associated with a specific Member's account.`wp_usermeta`.`meta_key` = `s2member_subscr_gateway`This is a paid Subscription Gateway code. Normally one of these values:
paypal, alipay, authnet, clickbank, google, or ccbill.`wp_usermeta`.`meta_key` = `s2member_custom_fields`This is an array of Custom Fields, if there are any, as configured by the site owner. The array is associative, with each key being a match to the "ID" of the Custom Field, as configured under s2Member -> General Options -> Custom Fields.`wp_usermeta`.`meta_key` = `s2member_file_download_access_log`This is an associative array, containing a history of file downloads that have occurred for each Member. This will only hold x days worth of data, and then it is rotated automatically into `s2member_file_download_access_arc`.`wp_usermeta`.`meta_key` = `s2member_auto_eot_time`This is a timestamp, that is NOT always filled. It is only used under certain conditions that require it. That being said, when it is set, this is used by s2Member's Auto EOT System, which works to demote/delete accounts after they have expired. EOT = End Of Term.`wp_usermeta`.`meta_key` = `s2member_last_payment_time`This is a timestamp, that is NOT always filled.
It's only available once a payment has been received.`wp_usermeta`.`meta_key` = `s2member_paid_registration_times`This is an associative array of Paid Registration Timestamps.
Marking the first time a Member reached each paid Membership Level.Now. Let's say you wanted to find the Subscr. ID for an existing Member. First, you need their User ID. Let's say we are dealing with User ID# 123. Here is how you would do that if they are currently logged in.
- Code: Select all
echo get_user_option("s2member_subscr_id");
Or, if you're running routines silently in a cron job, or need to pull information for a User/Member that is not the User/Member currently logged into the site. Here is how you do that.
- Code: Select all
$user = new WP_User(123);
echo get_user_option("s2member_subscr_id", $user->ID);
If you need to pull information based on a Username, instead of the ID, you can do this:
- Code: Select all
$user = new WP_User("johndoe22");
echo get_user_option("s2member_subscr_id", $user->ID);