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.

Need to Pre-Qualify Members

Home Forums Community Forum Need to Pre-Qualify Members

This topic contains 7 replies, has 2 voices. Last updated by  Raam Dev 4 years, 5 months ago.

Topic Author Topic
Posted: Sunday Jul 29th, 2012 at 7:10 pm #20632
Ralph Cabage
Username: rcabage

Greetings s2Members

I have to use a registration form before s2member to prequalify Members so I have a mysql database on my server that is not in wordpress. I have an admin (not in WP) where an administartor can approve or dispprive an apllication when they complete the registration form. If approved, I want to create a record in wp_users to allow them level 0 access in the WP s2member.

My question is the fields in my WP wp_users is:

1 ID
2 user_login
3 user_pass
4 user_nicename
5 user_email
6 user_url
7 user_registered
8 user_activation_key
9 user_status
10 display_name

However the wp_users fiels in the wordpress.org codex is:

ID An integer that will be used for updating an existing user. (none)
user_pass A string that contains the plain text password for the user. pre_user_pass
user_login A string that contains the users username for logging in. pre_user_login
user_nicename A string that contains a nicer looking name for the user. The default is the users username. pre_user_nicename
user_url A string containing the users URL for the users web site. pre_user_url
user_email A string containing the users email address. pre_user_email
display_name A string that will be shown on the site. Defaults to users username. It is likely that you will want to change this, for both appearance and security through obscurity (that is if you dont use and delete the default admin user). pre_user_display_name
nickname The users nickname, defaults to the users username. pre_user_nickname
first_name The users first name. pre_user_first_name
last_name The users last name. pre_user_last_name
description A string containing content about the user. pre_user_description
rich_editing A string for whether to enable the rich editor or not. False if not empty. (none)
user_registered The date the user registered. Format is Y-m-d H:i:s. (none)
role A string used to set the users role. (none)
jabber Users Jabber account. (none)
aim Users AOL IM account. (none)
yim Users Yahoo IM account. (none)

so why is my s2member WP wp_users different??

Thank You

List Of Topic Replies

Viewing 7 replies - 1 through 7 (of 7 total)
Author Replies
Author Replies
Posted: Tuesday Jul 31st, 2012 at 2:56 am #20733
Raam Dev
Username: Raam
Staff Member

Hi Ralph,

It’s not different. If there are no users with those fields, you won’t see them in the database. The WordPress Codex describes what’s possible, not necessarily what you will see in your database.

For your scenario, I recommend looking into the s2Member Pro API. It allows you to create s2Member users from a external script, which you could attach to the approval process. See Dashboard -› s2Member® -› API / Scripting -› Remote Operations API.

Posted: Wednesday Aug 1st, 2012 at 6:57 pm #20948
Ralph Cabage
Username: rcabage

Thank You Raam:

Unfortunately, I I cannot find Dashboard -› s2Member® -› API / Scripting -› Remote Operations API.

Below are the options I have in Dashboard -› s2Member® -› API / Scripting

+The Extremely Easy WayThe Extremely Easy Way
+Simple/Shortcode ConditionalsSimple Conditionals
+Advanced/PHP ConditionalsThe Advanced Way
+Advanced/PHP Query ConditionalsAdvanced Query Conditionals
+Custom Capabilities ( Packages )
+Custom Capability & Member Level Files
+s2Member Content Dripping
+Member Profile Modifications
+s2Member PHP/API Constants
+s2Member JS/API Globals
+Membership Options Page / Variables
+Hooks/Filters ( For Developers )

Thank You

Posted: Thursday Aug 2nd, 2012 at 3:15 am #20974
Raam Dev
Username: Raam
Staff Member

Hi Ralph,

Are you running s2Member Pro? Could you tell me which version you’re running?

Posted: Sunday Aug 5th, 2012 at 6:35 pm #21190
Ralph Cabage
Username: rcabage

Raam:

My name is Jack and I work for Ralph who’s name is on the s2Member Pro account. No, he did not install the Pro version, so I did and read in the API Scripting Remote Operations on what to do to create a s2Member user.

I created a test script and was able to create a record in our MYSQL wp_users table. However, I have two problems:

(1) user_url and activation_key were not transferred.
(2) I have a php header statement that is supposed to redirect to a thank you web page, but the code did not redirect.

Below is my test script:

<?php
$op["op"] = "create_user"; /* The Remote Operation you're calling upon. */
$op["api_key"] = "869ef8342b0f806b0eafcb6309e0f40e"; /* Your Remote Ops API Key. */
$user_login="KTownJack";
$Email="jack.utano@comcast.net";
$Password="Password";
$first_name="Jack";
$last_name="Utano";
$URL="www.aqualifedealers.com";
$reg_date=date("Y-m-d");
$op["data"] = array (/**/
"user_login" => $user_login, /* Required. A unique Username. Lowercase alphanumerics/underscores. */
"user_email" => $Email, /* Required. A valid/unique Email Address for the new User. */
"user_pass" => $Password, /* Optional. Plain text Password. If empty, one will be generated. */
"first_name" => $first_name, /* Optional. First Name for the new User. */
"last_name" => $last_name, /* Optional. Last Name for the new User. */
"s2member_level" => "0", /* Optional. Defaults to Level #0 ( a Free Subscriber ). */
"user_url" => $URL, /* Optional. Member website URL */
"user_activation_key" => "869ef8342b0f806b0eafcb6309e0f40e", /* Aqualifedealers.com S2Member Activation Key */
"s2member_auto_eot_time" => $reg_date, /* Optional. Can be any value that PHP's ``strtotime()`` function will understand ( i.e. YYYY-MM-DD ). */
);
$result = trim (file_get_contents ("http://aqualifedealers.com/?s2member_pro_remote_op=1", false, stream_context_create (array ("http" => array ("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => "s2member_pro_remote_op=" . urlencode (serialize ($op)))))));
header("http://www.aqualifedealers.com/membership-request-thank-you/");
?>

Thank You for all your assistance.

Take Care
Jack

Posted: Tuesday Aug 7th, 2012 at 1:49 am #21315
Raam Dev
Username: Raam
Staff Member

Hi Jack,

(1) user_url and activation_key were not transferred.

Neither of those are part of the s2Member Pro API. If you want to update those, you’ll need to make a separate call using the WordPress update_user_meta() function.

(2) I have a php header statement that is supposed to redirect to a thank you web page, but the code did not redirect.

Your header line is incorrect. It needs to include “Location:”:

header("Location: http://www.aqualifedealers.com/membership-request-thank-you/");
Posted: Tuesday Aug 7th, 2012 at 7:13 pm #21430
Ralph Cabage
Username: rcabage

Thank you Raam!

OOPS! I aplogize for the php header statement where I forgot to add the “Location: “attribute to the php header command. Thank you for that!

However, the s2Member Remote operations API has in their example for me to add the activation key and it is shown in the example, so my question is (1) why does it not work and (2) do I need to have the activation key stored in a wp_uers record to be able to access my web site? Please see the s2Member code below:

<?php
$op["op"] = "create_user"; /* The Remote Operation you're calling upon. */
/**/
$op["api_key"] = "869ef8342b0f806b0eafcb6309e0f40e"; /* Your Remote Ops API Key. */
/* Check your Dashboard for this value, under: `s2Member -> API Scripting -> Remote Operations API`. */
/**/
$op["data"] = array (/**/
"user_login" => "johndoe22", /* Required. A unique Username. Lowercase alphanumerics/underscores. */
"user_email" => "johndoe22@example.com", /* Required. A valid/unique Email Address for the new User. */
"user_pass" => "456DkaIjsd!", /* Optional. Plain text Password. If empty, one will be generated. */
"first_name" => "John", /* Optional. First Name for the new User. */
"last_name" => "Doe", /* Optional. Last Name for the new User. */
"s2member_level" => "2", /* Optional. Defaults to Level #0 ( a Free Subscriber ). */
"s2member_ccaps" => "music,videos", /* Optional. Comma-delimited list of Custom Capabilities. */
"s2member_registration_ip" => "123.456.789.100", /* Optional. User's IP Address. If empty, s2Member will fill this upon first login. */
"s2member_subscr_gateway" => "paypal", /* Optional. User's Paid Subscr. Gateway Code. One of: (paypal|alipay|authnet|ccbill|clickbank|google). */
"s2member_subscr_id" => "I-DJASODJF8933J", /* Optional. User's Paid Subscr. ID. For PayPal®, use their Subscription ID, or Recurring Profile ID. */
"s2member_custom" => "aqualifedealers.com", /* Optional. If provided, should always start with your installation domain name ( i.e. $_SERVER["HTTP_HOST"] ). */
"s2member_auto_eot_time" => "2030-12-25", /* Optional. Can be any value that PHP's ``strtotime()`` function will understand ( i.e. YYYY-MM-DD ). */
"opt_in" => "1", /* Optional. A non-zero value tells s2Member to attempt to process List Servers that you've configured in the Dashboard area. */
"custom_fields" => array ("my_field_id" => "Some value."), /* Optional. An array of Custom Registration Field ID's, with associative values. */
"s2member_notes" => "Administrative notation. Created this User via API call.", /* Optional. Administrative notations. */
"notification" => "1", /* Optional. A non-zero value tells s2Member to email the new User/Member their Username/Password. */
/* The "notification" parameter also tells s2Member to notify the site Administrator about this new account. */
);
/**/
$result = trim (file_get_contents ("http://aqualifedealers.com/?s2member_pro_remote_op=1", false, stream_context_create (array ("http" => array ("method" => "POST", "header" => "Content-type: application/x-www-form-urlencoded", "content" => "s2member_pro_remote_op=" . urlencode (serialize ($op)))))));
/**/
if (!empty ($result) && !preg_match ("/^Error\:/i", $result) && is_array ($user = @unserialize ($result)))
    {
        echo "Success. New User created with ID: " . $user["ID"];
    }
else
    echo "API error reads: " . $result;
?> 
Posted: Wednesday Aug 8th, 2012 at 8:40 am #21495
Raam Dev
Username: Raam
Staff Member

Hi Ralph,

The example code you posted does not contain a line with user_activation_key. Where are you seeing that? You don’t need that to create a user with the Remote API; the example contains everything you need.

Viewing 7 replies - 1 through 7 (of 7 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.