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™

API Scripting Question

s2Member Plugin. A Membership plugin for WordPress®.

API Scripting Question

Postby KirkWard » October 24th, 2010, 11:49 pm

Is it possible to use a "mail" command in the s2Member API / Notifications for the Registration and/or Payment Notifications?

I want to do something like ...
Code: Select all
<?php
mail( "%%role%%@somewhere.com", "subject", "message", "From: %%user_email%%" )
?>

... as a way to do an email subscription to a list based on the s2 member level. Or, possibly, the item number.

Or, do I have to send the variables to a script containing that code?
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010

Re: API Scripting Question

Postby webboy » October 25th, 2010, 7:02 am

Would be better to writing a script to select the members you want to email from the wordpress database or use a 3 party emailing system like A webber
User avatar
webboy
Experienced User
Experienced User
 
Posts: 11
Joined: August 3, 2010

Re: API Scripting Question

Postby Jason Caldwell » October 26th, 2010, 2:51 am

I agree with "webboy". I would use one of the services that are pre-integrated with s2Member. Such as AWeber or MailChimp. See: s2Member -> API List Servers in your Dashboard.

However, here is a sample PHP routine that may give you some ideas.
Code: Select all
foreach (get_users_of_blog () as $user)
    {
        $user = new WP_User ($user->ID);
        #print_r($user); /* to get a full list of $user-> variables when debugging. */
        mail ($user->user_email, "Subject", "Body", "From: you@yoursite.com\r\nContent-Type: text/plain; charset=utf-8");
    } 
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: API Scripting Question

Postby KirkWard » October 26th, 2010, 11:16 am

Thanks,

I use a self hosted autoresponder called "AutoResponsePlus." It has worked well for many years and I have a bit more control over user registration than if I used a service. I want to simultaneously sign up my members as subscribers when they register, and terminate them when they reach EOT.

I can subscribe and unsubscribe them by email, using the ARP remote serive. I merely have to format the email correctly, including a username and password. ARP uses the "to" part of the address as the name of the autoresponder campaign, and the "from" part of the address as the name to add to the list.

In my other system (using a different membership script), I name my campaigns to match the item name as sent to PayPal. I would like to do the same here, which means I need to pass the item name and the users email address to the script.

That is why I structured the email including those two items. I can write the mail() function into a short script, if I can get the itemname and useremail variables there as parameters in the url. To wit ...

Code: Select all
http://mydomain.com?email=%%email%%&item=%%itemname%%


So, do I need to include the question mark and the ampersands when formatting the URL in the api scripting?
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010

Re: API Scripting Question

Postby Jason Caldwell » October 27th, 2010, 11:21 pm

H Kirk. I'm not sure I understand completely, but I think you're referring to API Notifications. So the URL you posted above, might be pasted into the API Notification field for Payment Notifications ( or possibly another event ), as found in your Dashboard under: s2Member -> API Notifications.

However, your URL should look something like this:
Code: Select all
http://www.example.com/some-script.php?email=%%payer_email%%&item=%%item_name%%&item_number=%%item_number%%
You will find a more complete documentation on these Replacement Codes in your Dashboard, under: s2Member -> API Notifications.

----------------- some-script.php --------------------
As referenced in the URL above, would be a script that you write, which responds in some way to the Notification event processed by s2Member.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: API Scripting Question

Postby KirkWard » October 28th, 2010, 10:46 am

Thanks Jason,

I think that is exactly what I was looking for!

Kirk
User avatar
KirkWard
Experienced User
Experienced User
 
Posts: 61
Joined: October 22, 2010

Re: API Scripting Question

Postby Jason Caldwell » October 29th, 2010, 2:43 am

You are VERY welcome Kirk.
Glad I could help.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 4 guests

cron