PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

If statement against viewed profile s2member level

s2Member Plugin. A Membership plugin for WordPress®.

If statement against viewed profile s2member level

Postby y2gabs » April 13th, 2011, 10:08 pm

Hey guys, didn't know how best to subject this one.. apologies on the vague subject above. Regardless, I'm using the plugin on my membership buddypress site.

I use the "if (current_user_can("access_s2member_level1"))" quite a bit throughout to restrict various functionality for users not at level1 (above zero). One of my core functions is the ability for a user to create a photo gallery if user level is 1. My problem is that if their subscription expires, their gallery is still visible and that's something I don't want.

This may be more of a buddypress question but is there a template tag for buddypress or s2member that I can use in an if statement similar to that above that will check the status of the profile being viewed rather than that of the user viewing that profile? Example, user X browses to user y's profile page. User y used to be level1 s2membership but has since expired. During their membership, user y created a photo gallery. I'd like it so that user X can no longer see user y's photo gallery because user y's membership has expired.

Anyway, apologies for the lengthy question, I just wanted to make sure I explained it properly :)

Any thoughts?

Thanks!
User avatar
y2gabs
Registered User
Registered User
 
Posts: 6
Joined: March 17, 2011

Re: If statement against viewed profile s2member level

Postby y2gabs » April 13th, 2011, 11:07 pm

Hey guys,

I dug a little deeper on the forum here and found the fix. I've implemented the recommended fix and it seems to work. See here for the answer:

viewtopic.php?f=4&t=1141&view=unread

J
User avatar
y2gabs
Registered User
Registered User
 
Posts: 6
Joined: March 17, 2011

Re: If statement against viewed profile s2member level

Postby Cristián Lávaque » April 13th, 2011, 11:54 pm

Hmm... Yeah, you'll need custom code for that.

I'm guessing you'll be using WordPress' WP_User function to find out what role ('s2member_level1') the owner of the gallery has.

https://core.trac.wordpress.org/browser ... s.php#L462
https://phpdoc.wordpress.org/trunk/Word ... _User.html

You can find help from WP developers over at http://jobs.wordpress.net and other freelance websites.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron