I am busy developing a plugin for a WPMU site and I want to use the s2Member plugin to limit access to certain features, however I am having a few problems.
Basically the WPMU site will have two types of users, free users and paid users. Both of these user types will be able to publish blogs, but I want certain options for my new plugin to be disabled for free users.
The problem is, when I am logged in as a non-site-admin user onto the WPMU site, the s2Member API does not work.
I inserted the following code into the admin page for my plugin:
- Code: Select all
echo "user_login:"; print_r($user_login); echo "<br>";
echo "S2MEMBER_VERSION:".S2MEMBER_VERSION."<br>";
echo "S2MEMBER_CURRENT_USER_ACCESS_LEVEL:".S2MEMBER_CURRENT_USER_ACCESS_LEVEL."<br>";
echo "access_s2member_level3:".current_user_can ("access_s2member_level3")."<br>";
If I refresh the plugin's option page on a normal (non-MU) site I get the following:
- Code: Select all
user_login:admin
S2MEMBER_VERSION:3.0
S2MEMBER_CURRENT_USER_ACCESS_LEVEL:4
access_s2member_level3:1
Which is what I would expect.
If I refresh the plugin's option page on a WPMU site, while logged in as site-admin, I get the following:
- Code: Select all
user_login:admin
S2MEMBER_VERSION:S2MEMBER_VERSION
S2MEMBER_CURRENT_USER_ACCESS_LEVEL:4
access_s2member_level3:1
Notice that the S2MEMBER_CURRENT_USER_ACCESS_LEVEL is still 4 (all admin account are 4) and access_s2member_level3 is true, but S2MEMBER_VERSION is not defined anymore.
If I refresh the plugin's option page on a WPMU site, while logged in as a user, I get the following:
- Code: Select all
user_login:test
S2MEMBER_VERSION:S2MEMBER_VERSION
S2MEMBER_CURRENT_USER_ACCESS_LEVEL:S2MEMBER_CURRENT_USER_ACCESS_LEVEL
access_s2member_level3:
Now S2MEMBER_CURRENT_USER_ACCESS_LEVEL is also not defined and access_s2member_level3 is false. This is even the case if I change the role of the 'test' user to 's2Member Level 3'.
So, the question is: "Is it possible to get the s2Member level of a WPMU user on the user-blog level, and if so, how?"
I am using:
Wordpress 2.9.2
Wordpress MU 2.9.2
s2Member 2.9.3
Budypress 1.2.3
I am prepared to go dig about for code, so all help will be appreciated.
Thanks
JannesH