Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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();
 }
share|improve this answer
    
You are awesome mate. Thanks :) –  Giri Apr 4 '12 at 21:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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