Community Support Forums — WordPress® ( Users Helping Users ) — 2011-03-14T23:08:43-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=1379 2011-03-14T23:08:43-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=7833#p7833 <![CDATA[Re: How do I display required level to view a page?]]>
In the latest release of s2Member, we've updated the documentation on s2Member's MOP Vars ( Membership Options Page Variables ), which is what you'll probably want to use for this. Instead of redirecting a Visitor and/or existing Customer, you can dynamically modify the focal point of your s2Member installation, the Membership Options Page.


At the core of s2Member, is it's ability to protect content ( i.e. Posts, Pages, Tags, Categories, URI word fragments, etc ). Whenever a public User, or even an existing Member attempts to access an area of your site that is unavailable to them; either because they are not logged-in, not a paying Member at all; or maybe they are logged-in, but they don't have access to content you've protected at a higher Membership Level; — s2Member will always redirect these un-authenticated requests to your Membership Options Page. So your Membership Options Page is a key element of your site. It serves as the focal point of your s2Member installation.

Understanding this, it becomes important for s2Member to provide information about what the User/Member was attempting to access ( before they were redirected to the Membership Options Page ). This is where s2Member's MOP Vars come in ( i.e. Membership Options Page Variables ). Whenever s2Member redirects a User/Member to your Membership Options Page, it will include these important MOP Variables in the query string of the URL. These Variables can be used to provide more informative messages; or even to provide a different set of Membership Options ( i.e. Payment Buttons ), based on what a User/Member was attempting to access.


Please take a look in your WP Admin area, under: s2Member -> API Scripting -> Membership Options Page Variables.

Code sample ( you might do something like this in your Membership Options Page ).

First, you will need the PHP Execution plugin, or the Exec-PHP plugin also works fine:
http://wordpress.org/extend/plugins/php ... on-plugin/

Now, in your Membership Options Page, you might have something like this:

Code:
<?php if(current_user_can("access_s2member_level1") && $_GET["s2member_level_req"] === "2"){ ?>
  
     .... they have access to Level #1 already, but they need to upgrade to Level #2 in order to view this content.
     Display content here ( perhaps a Modification Button or a link to a Modification Form generated with s2Member Pro )

<?php } else { ?>

     Else, display something different here.

<?php } ?>


Hopefully this will help you. :)

Statistics: Posted by Cristián Lávaque — March 14th, 2011, 11:08 pm


]]>
2011-02-21T10:15:14-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6986#p6986 <![CDATA[Re: How do I display required level to view a page?]]>
I couldn't come any step further, I guess my "programming" knowledge is definitely not enough for that.

Code would be highly appreciated :-)

Thank you!

Statistics: Posted by candy — February 21st, 2011, 10:15 am


]]>
2011-02-20T23:40:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6961#p6961 <![CDATA[Re: How do I display required level to view a page?]]>
http://php.net/manual/en/reserved.variables.server.php

Statistics: Posted by Cristián Lávaque — February 20th, 2011, 11:40 pm


]]>
2011-02-20T20:46:00-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6954#p6954 <![CDATA[Re: How do I display required level to view a page?]]> I am not a programmer, so I am afraid I won't be able to do much with it ...
How would that one look like in a code !??!
I searched in those APIs, found nothing :-(

Thanks!

Statistics: Posted by candy — February 20th, 2011, 8:46 pm


]]>
2011-02-20T20:27:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6952#p6952 <![CDATA[Re: How do I display required level to view a page?]]>
Well, I guess you could work with the membership options page...

You'd need to use $_SERVER to find out the page they were redirected from first, and then find out what the level required for it is querying the database with custom PHP if there isn't already an s2Member function for it. The code could be swiped from existing s2Member code, but repurposed for this particular use.

Just thinking out loud here, haven't tried it, but would probably work.

Statistics: Posted by Cristián Lávaque — February 20th, 2011, 8:27 pm


]]>
2011-02-20T19:34:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6950#p6950 <![CDATA[Re: How do I display required level to view a page?]]> But it will not really work in may case :-(
I need a general rule to apply for everything, as I have at times pages that are protected, some times categories or URIs (coming from different plugins for ex), so it's not just about pages and posts :-(
And there will be user submitted content too ...

But I can't really imagine that there's no function for this, it just cannot be!

The only problem here is that we don't get any help from the developers here, and that's really frustrating :-(

If you have any further idea as to how to solve the puzzle, will be highly appreciated!

Thank you :-)

Statistics: Posted by candy — February 20th, 2011, 7:34 pm


]]>
2011-02-20T19:20:27-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6949#p6949 <![CDATA[Re: How do I display required level to view a page?]]>
Well, the only way I can think right now to solve it, is to add the protection to the content instead of the whole page. That way, instead of having the person sent to the membership options, he'd stay on the page where he is having the lack of level, where you can present him with options.

So, when you edit a post/page, you wouldn't use the box on the right to determine the level required, but the PHP conditionals in the actual content editor. See what I mean?

Statistics: Posted by Cristián Lávaque — February 20th, 2011, 7:20 pm


]]>
2011-02-20T17:32:08-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6947#p6947 <![CDATA[Re: How do I display required level to view a page?]]>
Well 1st ... I am not quite a programmer, so I will not be able to write all those complicated "if" conditionals all by myself if no example is provided :-(

Now what I need is quite basic:
Every page/category/post/URI whatever has a minimum "requested member level" (so page 1 only requires level1, category 2 for ex, level2).

Problem is that when a user which is either not logged in or has an inferior kind of membership that the one required by that page, will be redirected to a single page, no matter his membership level !!! (yes, in the APIs you can only define it as that "membership" page, and there's no way to add dynamic parameters to the URL either)

So as the page is only one, I have to find a way to show him which level of membership he needs to buy in the 1st place in order to be able to view the previously clicked page (or cat/URI/post) etc.

Otherwise he'd stay there and wonder: huh, and which membership do I actually need now ?!?!?
(I have 3 levels users can choose from when seeing the membership page, 0,1 and 2)

So let's take userA (level 0) tried to see pageA(requested level 1) and he also tries to look at postB (requested level 2) - he will now be redirected to the SAME memberships page. How will he know that to see postB he needs a membership level 2 while to see pageA only membership level1 ?!?!

I've got to tell him somehow what he has to buy, even if just to display the text saying "hey, you need at least membership1 if you want to see pageA" or "you need at least memebrship2 if you wanna see postB "

So somehow I have to pull the information about which minimum level of membership the previous page requires .. and combine that with membership level of the visiting user

How did you solve that !?!? Just sending the user to your memberships page and let him choose whatever?

Imagine he needs level2 and only buys level 1 - I personally don't really want to hear about his complaints :-(

Statistics: Posted by candy — February 20th, 2011, 5:32 pm


]]>
2011-02-20T17:09:30-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6946#p6946 <![CDATA[Re: How do I display required level to view a page?]]>
candy wrote:
And what if you have 3 levels and do not know which user landed there from where?!?!


You can figure out the where from using $_SERVER and the extra levels would just use more conditionals, which you already need there to show the content, to say what level they need to view when they can't. The user ID you know, and what he can access too.

What exactly are you trying to achieve that you aren't being able to? Maybe if you're more specific, I may be able to help you solve it better.

Statistics: Posted by Cristián Lávaque — February 20th, 2011, 5:09 pm


]]>
2011-02-20T16:25:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6944#p6944 <![CDATA[Re: How do I display required level to view a page?]]>

I also read all those APIs and found nothing.

And I am really stuck with a very basic issue, makes me really wonder what did they think of when made the landing page "fix" no matter where the user comes from and which permission he has!

How will he know which membership he has to purchase to access that page, if there's NO WAY to show him that !??!

Developers please ??!>?
(I have no high hopes they will respond unfortunately, but I never give up hope!)

Statistics: Posted by candy — February 20th, 2011, 4:25 pm


]]>
2011-02-20T15:19:25-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6943#p6943 <![CDATA[Re: How do I display required level to view a page?]]>

Statistics: Posted by Cristián Lávaque — February 20th, 2011, 3:19 pm


]]>
2011-02-19T22:56:09-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=6925#p6925 <![CDATA[Re: How do I display required level to view a page?]]> <?php if (current_user_can("access_s2member_level1")){ ?> is not the right answer, as I do not know at that stage which user (with which permission level) happened to land on the page in question.
What would be needed (personally I was not able to find that anywhere, and I think it's very strange that such a basic shortcode is not provided) would be the shortcode (or function) to dynamically retrieve the current required level (smth. like [s2current_level_req] ( no this code does not work, I have tried!)
Should be smth. like that though)

Anyone?!?!

Thankx!

Statistics: Posted by candy — February 19th, 2011, 10:56 pm


]]>
2010-12-27T01:13:23-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=5193#p5193 <![CDATA[Re: How do I display required level to view a page?]]>
Code:

<?php if (current_user_can("access_s2member_level1")){ ?>
    Some content for Members who are logged in with an s2Member Level >= 1.
<?php } else { ?>
    Message telling the person that he needs Level 1 access to see the content in this page.
<?php } ?> 


Is that what you mean?

Statistics: Posted by Cristián Lávaque — December 27th, 2010, 1:13 am


]]>
2010-12-21T15:35:37-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1379&p=5163#p5163 <![CDATA[How do I display required level to view a page?]]>
Essentially, a member must register for free to view SOME content, but even more is unlocked with a paid upgrade.

If the member does not have the proper credentials to view that particular piece of content, the system takes them to the upgrade page, as intended.

I'd like to display on that page a notification of what membership level you would need to be able to read that particular bit of content.

Anyone know how I do this?

PS... Installation at http://www.moonviperweb.com for reference

Statistics: Posted by moonviper — December 21st, 2010, 3:35 pm


]]>