Page 1 of 1

If statement against viewed profile s2member level

PostPosted: April 13th, 2011, 10:08 pm
by y2gabs
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!

Re: If statement against viewed profile s2member level

PostPosted: April 13th, 2011, 11:07 pm
by y2gabs
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

Re: If statement against viewed profile s2member level

PostPosted: April 13th, 2011, 11:54 pm
by Cristián Lávaque
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.