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.

How To Change A User's Member Level With PHP

Home Forums Community Forum How To Change A User's Member Level With PHP

This topic contains 1 reply, has 2 voices. Last updated by  Raam Dev 4 years, 8 months ago.

Topic Author Topic
Posted: Tuesday May 1st, 2012 at 9:17 am #12273
Paul Foster
Username: PAFoster

Visitors to my site can register for 7 days free access to my online ecover creation software.

They give their name & email and AWeber returns them to a ‘Pro API For Remote Operations’ php script on my server that creates the user account in S2Member with Level 1 access.

When the user logs in again, if the free 7 days are up, they are presented with a JVZoo buy button and can’t access the software until they pay:

The pay button html JVZoo supply is:

<a href="https://www.jvzoo.com/b/p/xxxx/2">
<img src="http://i.jvzoo.com/p/xxxx/2" alt="EZeCovers Membership" border="0" />

Obviously no user data is sent, and none can come back via JVZoo from PayPal either, since JVZoo can’t (yet) do IPN for recurring payment memberships.

I can change the html thus:

<a href="http//ezecovers.com/myscript.php?userid=[s2Get constant="S2MEMBER_CURRENT_USER_ID" /]>
<img src="http://i.jvzoo.com/p/xxxx/2" alt="EZeCovers Membership" border="0" />

and then myscript.php can upgrade the user in S2Member and use a header redirect to the supplied JVZoo URL.

Is there any S2Member code that can remotely change the user member level?

Or do I need to script a change of the users record in the MySQL database instead?

Do you have any code to help me, (I have basic php skills) or indeed specific info to help a php coder if I need them to understand what needs to be done for me?

Any help very much appreciated, many thanks. :)

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Tuesday May 1st, 2012 at 2:26 pm #12302
Raam Dev
Username: Raam
Staff Member

Hi Paul,

Changing the role of a user from s2member_level1 to s2member_level2 can be done using the WordPress remove_role() and add_role() methods. Please see this thread for an example.

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