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.

I have some questions

Home Forums Community Forum I have some questions

This topic contains 10 replies, has 2 voices. Last updated by  Riaan van der Westhuizen 4 years, 9 months ago.

Topic Author Topic
Posted: Friday Mar 9th, 2012 at 3:57 pm #7750

Can anyone tell me how to use it in template?

For example i’m using custom filter to hide the content in my single.php file

This is the filter i’m using

echo apply_filters('hide_content',$hidecontent);

I’m using two level membership.
1) Free (default) 2) Premium

I don’t want to hide content if the user is premium member.

I want something like this

If (user = premium ) {
echo $content;
} else {
echo apply_filters('hide_content',$content);
}

Can anyone give me the code or give me documentation url?

Thanks

PS: Can you guys add moneybookers(skrill) payment option in s2member pro?

List Of Topic Replies

Viewing 10 replies - 1 through 10 (of 10 total)
Author Replies
Author Replies
Posted: Friday Mar 9th, 2012 at 4:57 pm #7779

Ok i solved it by myself by using code like this

if (current_user_can("access_s2member_level1")){ 
           echo $content; 
            }
         else {
        echo apply_filters('hide_content',$content);
         }

Now can anyone tell me what is the function to check s2member installed?

I mean i don’t want my page throw errors

So i want code like this

if (s2member available) {
use this code
} else {
use this code
}

Thanks

Posted: Wednesday Mar 28th, 2012 at 3:18 pm #9358

Thanks for the initial if statement – it’ll help me a lot!

Did you figure out how to check if the s2member plugin is installed?

Posted: Wednesday Mar 28th, 2012 at 3:28 pm #9360
Did you figure out how to check if the s2member plugin is installed?

No I still didn’t

Posted: Wednesday Mar 28th, 2012 at 4:13 pm #9367

It looks like you wouldn’t have to check, as far as I can tell. The “current_user_can” method is a standard WordPress method.

Go have a look under “S2Member > API/Scripting” in the Dashboard – there is a lot of info!

Posted: Wednesday Mar 28th, 2012 at 4:26 pm #9371

Hello Riaan, By default i’m hiding all my post. S2member creates 5 levels. Level 0 will be free subscriber. Level 1 will be my paid subscriber. current_user_can checks the level. If it is level 1 it will display the page without hiding it.

And yes i tried Api/scripting page. But i couldn’t find any api to check whether s2member plugin enabled or not.
The problem is when i uninstall s2member plugin, my page will throw error. Thats why i wanted to check whether s2member plugin enabled or not before using that function

Posted: Wednesday Mar 28th, 2012 at 4:56 pm #9375

I did a quick test by disabling S2Member, and the code:

if (current_user_can("access_s2member_level1")){
	echo $content; 
} 

doesn’t throw any errors…

Posted: Wednesday Mar 28th, 2012 at 5:02 pm #9376

You might get errors when you completely uninstall s2member by erasing s2member database data

Posted: Wednesday Mar 28th, 2012 at 5:18 pm #9378

I actually think it will be fine, seeing that “current_user_can” is part of WordPress:

http://codex.wordpress.org/Function_Reference/current_user_can

So that code will still execute regardless, and will simply return “false”.

Posted: Wednesday Mar 28th, 2012 at 5:19 pm #9379

Ok then.. Thanks for confirming it

Posted: Wednesday Mar 28th, 2012 at 5:20 pm #9380

Anytime!

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