Community Support Forums — WordPress® ( Users Helping Users ) — 2011-02-23T06:07:49-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=2410 2011-02-23T06:07:49-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=7065#p7065 <![CDATA[Re: what is this ["s2member_level_req"] ?!??!]]> I am still struggling, did not manage to get it work ...

Statistics: Posted by candy — February 23rd, 2011, 6:07 am


]]>
2011-02-21T11:19:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=6988#p6988 <![CDATA[Re: what is this ["s2member_level_req"] ?!??!]]> varies, and in PHP it's written starting with a $. An array is like a list of variables with each element in it being a variable, with the element name written between brackets right after the array's name.

Code:
$variable
$array
['element'] 


Yes, you could combine this with $_SERVER as I mentioned in the other thread, but you'll need the post/page's ID and the fastest way to get it will be to have it in the URLs, I'm afraid, using %post_id% here WP Admin -> Settings -> Permalinks.

To get that URL after being redirected, I am guessing you'll find it in $_SERVER['HTTP_REFERER'], or $_SERVER['REQUEST_URI'], I'm not sure how the redirection affects this array.

So based on the format of your URL, you'll figure out what the ID of the post/page is and use it with the s2Member function to get the level required.

If the URL were formated like this http://example.com/?p=123 the code in membership options would probably be something like

Code:
preg_match('~p=(\d+)~i', $_SERVER['HTTP_REFERER'], $matches);
$requirement = is_protected_by_s2member($matches[1]);

echo 'I\'m sorry, you need a level ', $requirement['s2member_level_req'], ' membership to access the content at ', $_SERVER['HTTP_REFERER'], '. Please click on this button to get it.';
// And you'd have the button here.    


It's a start, you'd need to tweak until you get it the way you want.

Hope it helps.

Statistics: Posted by Cristián Lávaque — February 21st, 2011, 11:19 am


]]>
2011-02-21T08:05:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=6982#p6982 <![CDATA[Re: what is this ["s2member_level_req"] ?!??!]]>
Thank you v.much!
Now if you could help me understand what exactly should I put on my page so that I get the text" you need at least membership level X to see that" as an output, would be sooo great!

Maybe also combine that $check with the $_SERVER that you hinted at in other post ?!?!

As I said, I am not a programmer (so I don't understand much of that array stuff), and although I tried to read also that php stuff, I just can't move not even one step from here :-(

Thanks a lot!

Statistics: Posted by candy — February 21st, 2011, 8:05 am


]]>
2011-02-20T23:14:06-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=6960#p6960 <![CDATA[Re: what is this ["s2member_level_req"] ?!??!]]>


$__id - optional argument. Defaults to current $post->ID in The Loop.
$__type - optional argument. One of: `category`, `tag`, `post`, `page`, `singular`, `uri`. Defaults to: `singular`.
$check_user - optional ( consider the current User? ) defaults to: false.


Without having tried it, I'm guessing you'd use it more or less like this

Code:
$check = is_protected_by_s2member(15); 


15 being the ID for the page you're checking, now $check['s2member_level_req'] would say the level required for access.

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


]]>
2011-02-20T21:29:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=6957#p6957 <![CDATA[Re: what is this ["s2member_level_req"] ?!??!]]> ...........................................
Additional examples: documentation on these function calls.

Is a specific [Category, Tag, Post, Page, or URI] protected by s2Member?
<?php is_protected_by_s2member ($__id, $__type, $check_user); ?>
( * This ignores the current User/Member status.
Just "is it protected" by s2Member at all? )

If true, returns a non-empty array containing one of these elements.
["s2member_level_req"] = Level required for access.
["s2member_ccap_req"] = Custom Capability required.
["s2member_sp_req"] = "Specific Post/Page ID" required.
Otherwise returns false.
..............................................

But do not understand how to use it :-(

Statistics: Posted by candy — February 20th, 2011, 9:29 pm


]]>
2011-02-20T20:30:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=6953#p6953 <![CDATA[Re: what is this ["s2member_level_req"] ?!??!]]> Statistics: Posted by Cristián Lávaque — February 20th, 2011, 8:30 pm


]]>
2011-02-20T11:32:07-05:00 http://www.primothemes.com/forums/viewtopic.php?t=2410&p=6938#p6938 <![CDATA[what is this ["s2member_level_req"] ?!??!]]>
["s2member_level_req"]

As shortcode it does not work, thats for sure, so how and where to use than ?!??!

What does it do and what else is needed in oder to be able to display the current membership level (as text on the page) requested for a certain page ?!?!

Smth. like "you need THIS kind of membership in order to see this page" ?!?!

Sounds basic, but I did not find even one reference to it, and all those functions no matter how I combine just do not seem to address the issue.

What am I missing ?!??!

Thanks!

Statistics: Posted by candy — February 20th, 2011, 11:32 am


]]>