WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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")){ 

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")){ 


share|improve this question
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")){ 
share|improve this answer
You are awesome mate. Thanks :) – Giri Apr 4 '12 at 21:01

Your Answer


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.