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.

About: Glyn Davidson

Sorry, I've not written a description yet. I'll get to it soon!


My Favorite Topics

Viewing topic 1 (of 1 total)
Topic Count Last Reply
Viewing topic 1 (of 1 total)

Topics I've Started

Viewing 4 topics - 1 through 4 (of 4 total)
Topic Count Last Reply
MOP Vars shortcodes. Y/N?

By:  Glyn Davidson in: Community Forum

voices: 1
replies: 4

3 years ago  Glyn Davidson

Custom capabilities and End of Term (EOT)

By:  Glyn Davidson in: Community Forum

voices: 2
replies: 8

3 years ago  Glyn Davidson

Change Selected item on Multiple Pro Forms

By:  Glyn Davidson in: Community Forum

voices: 3
replies: 3

3 years ago  Glyn Davidson

s2Pro – Change number of levels / multisite

By:  Glyn Davidson in: Community Forum

voices: 1
replies: 0

3 years ago  Glyn Davidson

Viewing 4 topics - 1 through 4 (of 4 total)

My Latest Replies (From Various Topics)

Viewing 20 replies - 1 through 20 (of 20 total)
Author Replies
Author Replies
Posted: Wednesday Jan 1st, 2014 at 6:20 pm #62359

Glad you got it working. Happy new year :)

Posted: Wednesday Jan 1st, 2014 at 4:26 pm #62349

Replace ‘OR’ with ‘AND’ :D

Posted: Wednesday Jan 1st, 2014 at 10:01 am #62341

Idea 1) use HTML code for Pound Sterling sign “£” or “£” in the S2Member code referenced above.
Idea 2) use GBP instead of the $ in the S2Member code referenced above.

Both of those will work, but Robin wants it to automatically change to USD, GBP or EUR based on the customer’s location.

I haven’t watched it but have you tried @Bruce’s video on Advanced Email Editing? That might have your answer?

Posted: Wednesday Jan 1st, 2014 at 6:39 am #62337

Here’s what I put at the top of each page, changing the first Level #. Thanks so much for your help!
[s2If current_user_is(s2member_level4) OR current_user_is(s2member_level1) OR current_user_is(s2member_level0) OR current_user_is(s2member_level10)]

Hello again Peggy. Just after posting I gave it some more thought and although the “correct” way to do it would be with:

[s2If current_user_can(access_s2member_level1)]
	Some protected content would go here
[/s2If]

You could also just extend the shortcode you already have with: “OR current_user_is(administrator)]”
So that you end up with a conditional that looks like this:

[s2If current_user_is(s2member_level4) OR current_user_is(s2member_level1) OR current_user_is(s2member_level0) OR current_user_is(s2member_level10) OR current_user_is(administrator)]
   All courses go here
[/s2If]
Posted: Wednesday Jan 1st, 2014 at 6:28 am #62335

Hi Peggy

Forgive me if I’m wrong, but as far as I can tell, you haven’t yet quite understood something that is fundamental to s2member.

Just like with WordPress default roles, roles in s2Member are incremental.

The default roles in WordPress are:

  • Subscriber
  • Contributor
  • Author
  • Editor
  • Administrator
  • Super Admin

A subscriber has read-only access to a wordpress site.
An author has read access to the site, and can create posts and pages.
An editor can read the site, create posts and pages, and make changes to other people peoples posts/pages.
An Admin, well you know…

Or to put it a better way:

  • A subscriber only has the subscribe capability.
  • A contributor can contribute and subscribe.
  • An author can author, contribute and subscribe.
  • An editor can edit, author, contribute and subscribe.
  • An admin can administrate, edit, author, contribute, and subscribe.
  • A super admin can rule the world.

s2Member is exactly the same:

  • A level 0 user can only do level 0 stuff.
  • A level 1 user can do level 1 stuff and level 0 stuff.
  • A level 2 user can do level 2, level 1 and level 0 stuff.
  • A level 3 user can do level 3, level 2, level 1, and level 0 stuff.
  • A level 4 user can do level 4, level 3, level 2, level 1, and level 0 stuff.

So just like in your scenario, the following shortcode would give level 1, 2, 3, and 4 users access to some content:

[s2If current_user_is(s2member_level1) OR current_user_is(s2member_level2) OR current_user_is(s2member_level3) OR current_user_is(s2member_level4)]
	Some protected content would go here
[/s2If]

However, a much better way, which would achieve exactly the same thing, is this:

[s2If current_user_can(access_s2member_level1)]
	Some protected content would go here
[/s2If]

In this statement, your checking if the current user can access level 1. Yes, level 1, 2, 3 and 4 users can access level 1, and so can admin :)

Recommend you get to grips with all of the following before you go any further.
http://codex.wordpress.org/Roles_and_Capabilities
http://www.s2member.com/kb/roles-caps/
Dashboard -> s2Member -> API / Scripting -> Membership Levels / Labels
Dashboard -> s2Member -> API / Scripting -> Simple / Shortcode Conditionals

P.S. I have a sneaky suspicion that actually, as far s2member is concerned, all of your users will be level 1 and you should be using custom capabilities instead. Suggest you do a batabase backup before going any further.

Posted: Tuesday Dec 31st, 2013 at 5:52 pm #62330

Glad you got it working Peggy.

Now add this to the bottom of your level 4 page:

[s2If current_user_is_not(s2member_level4)]
If you would like to purchase access to this content, please click here.
[/s2If]
Posted: Tuesday Dec 31st, 2013 at 2:46 pm #62307

[s2Get constant="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_TIME" /] would be my bet:

Dashboard -> s2Member -> API / Scripting -> s2Get w/ s2Member API Constants
Posted: Tuesday Dec 31st, 2013 at 2:42 pm #62306

[s2If current_user_is(s2member_level4)] (am I putting this code at the top of the page that has the Level 4 content?
Level 4 course goes here
[/s2If] (then at the bottom of the page, I put this ending?

Yep :)

Then do the same again for each of your other levels/pages. Get that working first and then I’ll tell you how you can improve upon it.

Posted: Tuesday Dec 31st, 2013 at 7:10 am #62296

And a working example:

[s2If current_user_is(s2member_level0)]
    [_s2If was_previous_page(page_for_paying_members_only) ]
        <p class="notice">
            I'm sorry but that page is restricted to paying members only. As a free subscriber, you can use <a href="#">this page</a> instead.
        </p>
    [/_s2If]
    [_s2If !was_previous_page(page_for_paying_members_only) ]
        <p class="notice">
            You must be a paying member to view that page.
        </p>
        <ul>
            <li><a href="#">Upgrade to level 1</a></li>
            <li><a href="#">Membership Benefits</a></li>
            <li><a href="#">How to Join</a></li>
        </ul>
    [/_s2If]
[/s2If]
Posted: Tuesday Dec 31st, 2013 at 6:44 am #62295

Here’s my final (and much better) solution:

The shortcode:

[s2If was_previous_page(page_name_goes_here) ]
	Provide some useful information here
[/s2If]

To get this to work requires some hacks to s2Member php files:

I added this to /plugins/s2Member/includes/functions/api-functions.inc.php
Right after “exit(“Do not access this file directly.”);” on line 18:

if(realpath(__FILE__) === realpath($_SERVER["SCRIPT_FILENAME"]))
	exit("Do not access this file directly.");

/** Glyn's hack to test against the denied page uri. Only works on the membership options page */
if(!function_exists("was_previous_page"))
	{
		function was_previous_page($page = FALSE)
			{
				$_g = stripslashes_deep ($_GET);
				if (isset ($_g["_s2member_seeking"]["ruri"])){
					$seeking_uri = esc_html (base64_decode ($_g["_s2member_seeking"]["ruri"]));
					if (strpos($seeking_uri, $page) >0) return true;
				}		
				return false;
			}
	}

And modified line 63 in /plugins/s2Member/includes/classes/sc-if-conds-in.inc.php:

$blog_farm_safe = apply_filters ("ws_plugin__s2member_sc_if_conditionals_blog_farm_safe", array ("was_previous_page", "is_user_logged_in", ...rest of the line needs to go here
Posted: Tuesday Dec 31st, 2013 at 5:51 am #62293

Here’s what I wanted to achieve:

I have buddypress installed and URI restricted to level 1 users. However, I want level 0 users to be able to access a similar, non buddypress page.

When a level 0 tries to access the buddypress page, they get redirected to the membership options page.

What I was hoping to do was query the URI and if they had tried to access the buddypress page, then redirect them from the MOP to the non buddypress equivalent.

This works by putting this shortcode in the MOP.

[s2Redirect if_page_is="a_buddypress_page" redirect_to="the_none_buddypress_page" /]
function mop_uri_redirect_shortcode($atts) {
    $_g = stripslashes_deep ($_GET);
	if (isset ($_g["_s2member_seeking"]["ruri"])){
		$seeking_uri = esc_html (base64_decode ($_g["_s2member_seeking"]["ruri"]));
		if (strpos($seeking_uri, $atts['if_page_is']) >0) 
			echo '<script type="text/javascript">window.location = "' . $atts['redirect_to'] . '"</script>';
	}		
}
add_shortcode('s2Redirect', 'mop_uri_redirect_shortcode');

This works but it’s a really dirty hack because it means the Membership Options Page has to load before it redirects.

Posted: Tuesday Dec 31st, 2013 at 5:31 am #62292

The $ symbol is set in s2Member > PayPal Options > Signup Confirmation Email:

Subscr. ID: %%subscr_id%%
Charges today: $%%initial%%
Recurring charges: $%%recurring/regular_cycle%%

I haven’t yet found a way to change it on-the-fly so the easiest option would be to remove the currency symbol all together.

Posted: Tuesday Dec 31st, 2013 at 5:18 am #62291

Made my own:

function mop_var_shortcode($atts) {
	$_g = stripslashes_deep ($_GET);
	if (isset ($_g["_s2member_seeking"]["ruri"])){
		$seeking_uri = esc_html (base64_decode ($_g["_s2member_seeking"]["ruri"]));
		if (strpos($seeking_uri, $atts['page']) >0) 
  			 echo 'You were trying to access the ' . $atts['page'] . ' page!';    
	}		
}
add_shortcode('s2Show_mop_var_uri', 'mop_var_shortcode');
[s2Show_mop_var_uri page="page_name" /]
Posted: Tuesday Dec 31st, 2013 at 4:27 am #62287

Try this:

[s2If current_user_is(s2member_level4)]
   Level 4 course goes here
[/s2If]

[s2If current_user_is(s2member_level1) OR current_user_is(s2member_level0) OR current_user_is(s2member_level10)]
   All courses go here
[/s2If]
Posted: Monday Dec 30th, 2013 at 4:15 pm #62253

I’ve renamed the topic title so that it reflects the content

Posted: Monday Dec 30th, 2013 at 4:13 pm #62252

Duh!!!

Like you said Bruce, everything appears to be working fine. I just issued a refund via paypal and the account was demoted to free subscriber. I’d pulled everything apart for nothing!!! Oh well, at least I learnt a few things in the process.

The problem was caused by my understanding of what the phrase “End of term” meant. In my mind it meant when the next payment was due. Once I (eventually) realised that it doesn’t mean the end of this payment period, everything became clear.

An amazing plugin guys, congratulations to all who have been involved in its creation.

Posted: Sunday Dec 29th, 2013 at 6:47 pm #62246

So sorry, I linked to that from memory. That’s the old location of the documentation for Custom Capabilities. The real name of this section is Custom Capabilities (Packages).

Don’t apologies Bruce, I’d be in real bother if I wasn’t able to realise that Custom Capabilities were stored in Custom Capabilities (Packages)! As I said, I was looking at s2Member in a child blog which (in my installation) doesn’t have Custom Capabilities (Packages). Custom Capabilities are restricted to the parent blog only. Similarly, all ccap shortcodes in ProForms etc aren’t visible in child blogs. Getting ccaps working was straight forward enough though so not an issue and I completely understand why they should be hidden from child blogs, in fact I’m glad that they are.

s2Member won’t immediately demote a User when they stop paying usually.

If my understanding of what I read in

Dashboard -› s2Member® -› PayPal® Options -› Automatic EOT Behavior

is correct, that’s because you get better customer satisfaction by allowing a grace period right? I changed the grace period to 300. Once the site goes live I’ll up the grace period to 1 week, but during dev, I thought 5 mins would be sufficient for s2 and PayPal to talk to each other?

s2Member won’t immediately demote a User when they stop paying usually. Instead, it will set an Automatic End of Term time on their profile. If it is, then s2Member is working correctly, and that User will be demoted after the time that they have paid for is up (i.e. when they hit their EOT time).

WOAH!!!
That’ll be why I thought it was working this morning then… I just cancelled a (1 year recurring) subscription and their EOT was changed to January 12th 2015 :D . WooHoo, something’s working! :D

Ahah! Duh!
Of course, I understand now (I think). I remember reading somewhere, probably in the awesome dashboard documentation, that if a user cancels their subscription, they still get access for the remaining term. i.e. If a level-1-user has paid for a 1 year subscription but cancel their subscription after 5 days, they will remain a level-1-user for the remaining 360 days until their EOT is up. Is that right?

If that is right, that’s cool, I get that, but… forgive me if I’m being stupid here, after a level-1-user registers (with a 1 year recurring membership), do I have a mechanism to show them when their next (i.e. the first recurring payment) is due? Shouldn’t the EOT be populated as soon as the first payment is made?

s2Member should get notification of the recurring subscription being cancelled almost immediately.

What if I cancel (refund) a subscription via PayPal, should s2Member get notification almost immediately then? And if it does, I presume it will honor the grace period, but not the EOT right?

Posted: Sunday Dec 29th, 2013 at 4:08 pm #62233

Sigh…

I’ve been banging my head against this all day and not made any progress whatsoever :(

Further to my previous post, I found that the reason I wasn’t seeing anything related to custom capabilities is because I was working in a child blog. All the custom capability stuff is only available to the primary blog.

Anyway, that’s not my problem, the problem is that I can’t get the EOT to work. Or more specifically, the field is always empty.

I’ve tried deleting all my PayPal options and copying them from paypal again.
I tried deleting all sandbox account and completely starting from scratch (twice)
I’ve been through the videos on Youtube and followed them step by step
I now have all plugins disabled except for s2Member but still no joy
I need somebody to tell me it’s going to be alright before I curl up in a heap and spend the next few days feeling sorry for myself :(

P.S. It works fine for one off payments, but not for recurring payments. Although that’s most likely because s2Member calculates EOT for one-off payments itself and doesn’t rely on IPN.

I’m at a loss what else to try, any pointers very much appreciated.

Posted: Sunday Dec 29th, 2013 at 12:07 pm #62229

Wow, thanks Bruce. Really appreciate your taking the time to give me a full response.

Your solution seems to be working perfectly and I’m able to access all of the custom capabilities:

foreach (get_user_field ("s2member_access_ccaps") as $ccap) echo $ccap;

However…

Before diving right in I thought I’d follow your advice and read up about ccaps in the Dashboard but found that

Dashboard -› s2Member® -› API / Scripting -› Custom Capabilities

Doesn’t exist.

Most of the PayPal ProForm shortcodes are explained here, but not ccaps:

Dashboard -› s2Member® -›  PayPal Pro Forms  -› Shortcode Attributes Explained 

As I said, it seems to be working for me though. My only problem now is that I no longer seem to be receiving the EOT from PayPal. And, when a level-1-user cancels their subscription, their recurring payment is cancelled in PayPal, but nothing appears to happen on site.

Q1) Is this likely to be a configuration error, or should I allow more time for communication between s2member and PayPal?
Q2) What is the usual time-frame for s2Member to receive the EOT from PayPal?

P.S. For anybody else who arrives at this topic, you can also find out which Pro Form was used during checkout by looking at your PayPal account.

Posted: Saturday Dec 28th, 2013 at 6:08 pm #62217

In s2Member > PayPal Pro Forms > Wrapping Multiple Shortcodes, you’ll find this solution:

It is also possible to link to a Pro Form and pre-select a specific Checkout Option that appears in the list. Starting from the first Checkout Option in the list (we call this Checkout Option 1) you can choose which Checkout Option number you want to have selected by default. This is accomplished by linking to any Post/Page on your site which contains a Pro Form Shortcode; and then adding the ?s2p-option= variable onto the end of that URL (as seen below).

This example would pre-select option 2.

http://www.example.com/my-checkout-form/?s2p-option=2

The absolute default Checkout Option is always the first one (Checkout Option 1).
This would pre-select option 1 (but this is NOT necessary, because it’s the default already).

http://www.example.com/my-checkout-form/?s2p-option=1
Viewing 20 replies - 1 through 20 (of 20 total)

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.