0

I'm using wordpress multisite. I installed s2member plugin.

s2member plugin creates 4 extra level. I mean like level1,level2,....

I'm displaying content using this code

if (current_user_can("access_s2member_level1")){ 
     the_content();
 }

Here level1 member is premium member. If the user is not a premium member then the content will be hidden.

My problem

I created separate site for each niche. I'm the only admin for all sites.

My goal is user buys the premium account in my main site and access all my site network without paying extra money.

But s2member work for only for that individual site. Its not working globally.

So i was thinking like activate s2member only in main site and check the user level from subsite. If the user level is 1 then display the content

So can anyone help me how to check main site user level from sub site?

I mean like this

if (current_user_can("access_mainsite_s2member_level1")){ 
         the_content();
     }

Thanks

1 Answer 1

1

The function current_user_can_for_blog() seems to be what you are looking for. With your example above, this solution should work:

 $blog_id = 1; //set the blog id to the main site id    
 if (current_user_can_for_blog($blog_id, "access_mainsite_s2member_level1")){ 
     the_content();
 }
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.