PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

[Solved] A few questions about S2member

s2Member Plugin. A Membership plugin for WordPress®.

[Solved] A few questions about S2member

Postby angelazou » January 6th, 2012, 9:38 am

Hi,

I'll probably spend quite some time configuring S2member recently, and as I configure the plugin, I have some questions about the logic here (sorry, I didn't watch the tutorials, so if I missed anything that's already covered, please let me know).
1- I'm creating a multi-page form for the membership sign up/payment process (these two are on the same WP page) because there are other things involved and there is absolutely no way I can do them in a single page. I wonder how can I integrate this into S2member.
One of the possible things I can do is to have the form submitted to an external script in S2member that will redirect the user to the correct gateway (with the correct product) based on the gateway the user selected in the form.
That same script would also be used to provide information for user creation process in both S2member and another process (this is so complicated).
Now, other than the external script I mentioned above, I have absolutely no idea what to do. I understand the user creation process should happen AFTER the purchase is being made. But in this case (following my assumption, it seems like it should be done at the same time the payment is being processed. I know that normally, S2member send out a user invitation form AFTER the purchase is being made. But what can I do to make this seemingly exceptional process work with S2member?
2- If I have set up my products in Paypal/Alipay/Whatever gateway in use, where is the option to add this product into the button?
3- Just to verify, (I'm probably going to implement this a long time after) custom capability feature allow me to grant different WP roles and capabilities to the users, right?

Angela
Last edited by angelazou on January 17th, 2012, 4:16 am, edited 1 time in total.
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby angelazou » January 7th, 2012, 1:32 am

a quick reply?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby angelazou » January 8th, 2012, 4:48 am

My previous posts are quite unclear, I finally got into configuring the component today, and I think I have a much clearer perspective now. So let me walk myself through this one more time (I'm confused too :roll: )

I'm setting up a website to sell web hosting services. When the payment process start with the client choosing a domain name, then fill out some information (such as user's name, email, what product to purchase, and what gateway will be used, and so on). When user finished the form, they will be redirected to a page where the gateway button will be held. And they will visit the gateway and make a purchase.
If they return, I would like to have them returned to the cPanel page (Where to I configure that?). In the meanwhile, I want S2member to set up a username in Wordpress using the information the user had previously entered (stored in the database), perhaps using an external script, skipping the registration step completely.
And finally, have S2member send the user an email containing all the information they need (some of which should come from the table I previously mentioned.

So, here are my questions:
- How do I configure S2member to skip the user registration step?
- How do I add information (from a foreign table) into the S2member confirmation email?
- How should the external script look like? Documentation or examples?

Angela
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby angelazou » January 9th, 2012, 9:33 am

Anyone? I really need some inputs. I reviewed all the information again, and since S2member only need the username, user's name, and user's email (all obtainable from the form script I mentioned), I can really pull this off as long as I figure out how to "skip" the user registration process.

I found user-new-in.inc.php and user-new.inc.php, but my PHP is not enough for me to totally understand them. I know Wordpress has a wp_create_user function, but I still will be relying on S2member to generate that password for me the first time (as well as setting the user level of course). What should I do?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby angelazou » January 10th, 2012, 4:55 am

I have finished the script that generates information from the form. However, I have no idea where can I send it to in S2member to temporarily store it and user it later for user creation?

Angela
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby webass » January 10th, 2012, 6:41 am

This is quite a lot individual.
I would hire a coder for this, because nearly everything cant be covered out of the box with s2member.
User avatar
webass
Registered User
Registered User
 
Posts: 7
Joined: January 9, 2012

Re: A few questions about S2member

Postby angelazou » January 10th, 2012, 8:33 am

Hi webass, I'm on a relatively tight budget, plus I know a bit PHP, so I guess with some help, I can limp along.

But you are right, it is a lot of content, and I've made some modifications and got to know S2member a little better. I'd like to quickly summarize what I need:
1- I will be using a form plugin to collect input, and in general, they will create an order with an order ID. I'd like to have S2member take that ID as a note (include it in the URL) for later processings/references.
2- Also, when a form entry is generated, there will be user's name and email included, and I'd like to use those information to create users instead of using S2member's default method to create a user. (However, I'd still rely on S2member to generate the user's password and send these info to the user)
3- When the user returns from the gateway, I'd like to set a page to notify user of further instructions (I do remember a way to do this previously, but I can't find it now in General Options).


Most of the preparations are ready, I just need to know the following (I can't view the youTube videos unfortunately) information:
- For item No.1, how do I add a note to the processing gateway besides using the description field?
- For item No.2, I understand that I can bypass the default registration requirement in S2member by not sending the link to user for user signup. But how do I generate a random password in S2member? and how do I create a user account through a script?
- For item No.3, where is the configuration for that landing page when user returns?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 11th, 2012, 11:49 am

Hi Angela,

For what you're doing, it sounds like s2Member may not be what you need. s2Member is designed as a membership plugin for WordPress. If you want to integrate an ordering process with setting up accounts on cPanel/WHM, something like WHMCS would be a better choice (as that software is designed for that purpose).

However, if you want to use s2Member it can be done. It will just require a lot of customization on your end. You'll want to be using s2Member Pro so that you can utilize the Pro API for Remote Operations (WP Admin -> s2Member -> API/Scripting -> Pro API for Remote Operations). The Pro API allows you to create s2Member accounts from an external script.

For item No. 1: Could you just create a Custom Field (WP Admin -> s2Member -> General Options -> Registration/Profile Fields & Options) and use that?

For item No 2: See the above note on using the Pro API. If the user is filling out fields as part of the checkout process with a Pro-Form, that process will create their account. If you're not using a Pro-Form and you're creating your own custom form outside of s2Member, then you could use s2Member to process the payment and then send the user to an external script after checkout that utilizes the Pro API to create the s2Member account.

For item No. 3: If you're using s2Member Pro, you can use the success= shortcode attribute to cause s2Member to send the user to a specific page after the checkout process (see WP Admin -> PayPal Buttons -> Shortcode Attributes ( Explained )) This shortcode attribute is not available with the free version of s2Member.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 11th, 2012, 11:37 pm

Well, I did set up clientEXEC, but it was too complex and offered too little features (only allowed me to sell domains and hosting, and only paypal and credit cards). Now, I'm pretty clear on both item No.1 and 3, but must the user fill out the registration form? I understand that there is a wp_create_user() function, can I create a user and associate this identity with the purchase just being made? Can you be more specific about how the Pro API creates the user?

If, for some reason, that there is absolutely no way I can interfere with the user creation process in Wordpress, can you tell where can I add a function to be executed along with the default functions WHEN a new user is created.

Angela

Edit: Is the 'success=' shortcode available for Alipay and Google Checkout as well?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby angelazou » January 12th, 2012, 10:19 am

Anyone?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 12th, 2012, 6:03 pm

AliPay does support the success= attribute while Google Checkout does not.

Here are a few more details on the Pro API:

Pro API For Remote Operations ( some scripting required )

With s2Member Pro installed, you have access to the s2Member Pro API For Remote Operations. This is made available for developers that wish to create User/Member accounts dynamically through custom scripts of their own. s2Member's Remote Operations API requires a secret API Key in order to POST authenticated requests to your installation of s2Member. Here is the API Key for this installation domain:

...

Experimental: The Remote Operations API is currently in an experimental state. The only Operation that is currently possible, is the create_user Operation, which is shown in the code sample below. In a future release of s2Member Pro, we will add further documentation and some additional Remote Operations to this API. Thanks for your patience.


The Pro API basically gives you a way to create a user and set other s2Member-related fields like Automatic EOT, Level, Custom Field values, Custom Capabilities, Subscriber Gateway, Subscriber ID, etc.

You could use the wp_create_user() function to create new users, but those users wouldn't have any of the s2Member fields filled in. Also, if you want s2Member's notification features, you'll need to use the Pro API.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 12th, 2012, 10:42 pm

I just wanna verify, can I trigger this script using the success="" shortcode attribute you mentioned? Or does it have to be placed and named in a specific way?
Plus, doesn't S2member automatically populate fields such as registration IP and subscription ID when the user try to register? How would I know those fields if the user haven't finished their payment yet? If I have to complete these numbers, is there I way I can obtain them upon the return URL from Paypal/Alipay?

Angela

PS: I'm thinking to point the "success=" shortcode attribute to this script below to create both the WP and cPanel accounts. If there isn't a specific requirement about where the script should be placed. I think I will place it in the s2member-files in case anyone find out and try to use this script to generate users without me know (I would still know with the notification email though :D ). I'm not a very good PHP programmer, can someone help me to verify the script? Thanks.

Code: Select all
<?php

$nextYear = time() + (60 * 60 * 24 * 365);
$whm_user   = "don'tpeekhere";
$whm_pass   = "don'tpeekhere";
$whm_host   = $_SERVER['HTTP_HOST'];
global $wpdb;
$table = $wpdb->prefix . "Orders";
$cid = $_REQUEST["cid"];
$result = $wpdb->get_results( "SELECT user_name, user_email, user_domain, user_plan, gateway FROM {$table} WHERE cust_id = {$cid} LIMIT 1;" );

$op["op"] = "create_user";
$op["api_key"] = "55676d6e246a4ae18037c40087d67e86";
$op["data"] = array (
"user_login" => "{$result->user_email}",
"user_email" => "{$result->user_email}",
"user_pass" => "{$result->user_pass}",
"s2member_level" => "1",
"s2member_ccaps" => "",
"s2member_registration_ip" => "",
"s2member_subscr_gateway" => "{$result->gateway}",
"s2member_subscr_id" => "",
"s2member_custom" => "93hosting.com",
"s2member_auto_eot_time" => "$nextYear", /* 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 ("cust_id" => $cid), /* Optional. An array of Custom Registration Field ID's, with associative values. */
"s2member_notes" => "Administrative notation. Created this User via API call.",
"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. */
);

if (!empty($user_name)) {
  $script = "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/wwwacct";
  $params = "?plan={$result->user_plan}&domain={$result->user_domain}&username={$result->user_email}&password={$result->user_email}&contactemail={$result->user_email}";
  $result1 = file_get_contents($script.$params);
}

  $result2 = trim (file_get_contents ("http://93hosting.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 ($result2) && !preg_match ("/^Error\:/i", $result2) && is_array ($user = @unserialize ($result2)) && $result1 == !preg_match ("/^Error\:/i", $result1))
    { header("Location: http://93hosting.com/welcome/"); }
else
    echo "API error: " . $result1 . "\n\n" . $result2;
?>
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 13th, 2012, 7:27 pm

Yes, the success= attribute can be pointed at any page or script accessible to the web.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 13th, 2012, 10:38 pm

But how can I dynamically populate the S2member fields? Should I do it from the database (seems like S2member spread its data all over) or can I obtain it from the success URL from the gateway?

Angela
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 14th, 2012, 10:24 pm

I'm not sure how you have things set up, or even how your customized registration/payment process looks, so it's hard to make a suggestion.

Are you using an s2Member Pro Form? Are your customers paying via s2Member? Can you explain the whole path a customer would take during signup, explaining which parts you've modified and which parts are s2Member?
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 14th, 2012, 11:15 pm

Well, it's pretty simple and will be relying on S2member for the most parts. There is just one little addition, a form plugin.

The purchase process start with the client filling out some information about the account they need to open. I will collect their email address (and generate a password) and the item to purchase during this phase. I will also store these information for later processing.
Once they have finished the form, they will be redirected to the page where the payment buttons are located, and they will visit the gateway and make the purchase. When they finish that process, the I will use the success= shortcode to direct the page to a script where I will create the user using the previously collected information (I only have information like first name, last name, email, and password, but not the transaction id, and other S2member stuff). When this is successful, I will use 'Header' to redirect them to another page where there are instructions for what do to next.
In the meanwhile, the user will receive 3 emails, 2 from S2member, and 1 for the form confirmation. User will use these information to login and begin using the service.
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby angelazou » January 16th, 2012, 9:28 pm

Thoughts, perhaps?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 16th, 2012, 10:42 pm

Are you using a Pro-Form to collect the information before the checkout process?

What type of s2Member payment button are you using? (Pro-Form? Buy Now? Level Access?)

If you're not collecting the pre-payment information using a Pro-Form, is there a reason why? (From what I can tell, that would be the easiest way to automate the whole process and ensure the user's account includes all the gateway information.)
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 16th, 2012, 10:50 pm

That's because I need another (form) plugin to do this. Perhaps I can pass on the data to the Pro Form when user submits an entry at that form?

Angela

Edit: also, I probably won't be using Paypal, so Pro-Forms may not be the best solution.
Last edited by angelazou on January 17th, 2012, 12:00 am, edited 1 time in total.
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 16th, 2012, 11:11 pm

What type of s2Member payment button are you using? (Pro-Form? Buy Now? Level Access?)
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 16th, 2012, 11:26 pm

Sorry, that would be level access (I believe).

Edit: I also take a look at the return page. I believe I can stuff the functions in a custom return page template. But the question is, does the return page include necessary S2member information like transaction ID, level access, gateway, and the custom field that I've included in the button?
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 17th, 2012, 12:14 am

No, I do not believe the custom return page includes any of that information. To send that information to a custom script, you'll want to use the API Notifications (WP Admin -> s2Member -> API / Notifications.
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: A few questions about S2member

Postby angelazou » January 17th, 2012, 12:20 am

I think I got it, thanks a lot (and thanks for being so patient :)).

Edit: one last thing, I have this order ID generated by the form plugin. How can I push it to store it as a variable in S2member (for custom field use)?
Last edited by angelazou on January 17th, 2012, 12:24 am, edited 1 time in total.
User avatar
angelazou
Registered User
Registered User
 
Posts: 72
Joined: July 14, 2011

Re: A few questions about S2member

Postby Raam Dev » January 17th, 2012, 12:22 am

You're welcome! :)
Raam Dev || Wherever you are, be there. || Please rate s2Member!
User avatar
Raam Dev
Developer
Developer
 
Posts: 810
Joined: October 26, 2011

Re: [Solved] A few questions about S2member

Postby webass » January 17th, 2012, 4:51 am

Angela, I have had great times with formidablepro.
For the price a superb product. Can compete with gravity.
User avatar
webass
Registered User
Registered User
 
Posts: 7
Joined: January 9, 2012


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron