Page 1 of 1

Protect other members profiles from current user?

PostPosted: May 13th, 2011, 10:50 am
by candy
Hi,

Is there a way to protect not the whole members directory but only parts of the profiles?

Like for ex /members/%%user%%/profile/ ??!

That %%user%% does not seem to work, and I do not mean protectig the logged in user to see his onw profile, but I'd like to restrict his access to parts of the other user's profiles (like /userX/profile/, userX/activity) etc.?!?!

I'd like everyone to see the list of members but not have access to their complete profile
How is this done?!

Thank you!

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 12:05 pm
by Cristián Lávaque
I replied to this here viewtopic.php?f=4&t=6415

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 1:58 pm
by candy
hmm .... I thought this issue was different ...
So there is no parameter for the "username" that one can parse in the URL?

Like you have for %%current_user_login%% - only that not for "current" !?!

Thanks!

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 2:43 pm
by Cristián Lávaque
What URL? You have replacement codes for the redirection URL for the Login Welcome Page, but for any URL you can use the s2Member constant for the username.

WP Admin -> s2Member -> General Options -> Login Welcome Page -> Special Redirection URL
Wp Admin -> s2Member -> API / Scripting -> s2Member PHP/API Constants -> S2MEMBER_CURRENT_USER_LOGIN

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 3:48 pm
by candy
well, that's the point! (or not :-) )

s2 all revolves around "current_user_is" or "current_user_can" so far so good, but how do I integrate the "user" (not the current, just a user; let's say I am logged in as candy (current_user=candy") and you are also a member of the community, but you are not current_user (cause I am at that point).

So how do I call an URL to see your profile?

mysite.com/members/%%???christian???%%/profile

is there a short code for that %%???christian???%% just as I do for %%current_user_login%% to get your user name in the url?

know what I mean?

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 4:54 pm
by Cristián Lávaque
Ah ok, got it now. Sorry for not understanding earlier.

You could try

Code: Select all
get_user_field('username'$user_id); 

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 5:18 pm
by candy
:-) we are getting there :-)

Now if you can also help me figure out how do I write the URL to insert into the URI Restrictions (typical w/budyypress) section

/members/???username???/profile/

you are my hero for today :-)

Thanks!

Re: Protect other members profiles from current user?

PostPosted: May 13th, 2011, 5:52 pm
by Cristián Lávaque
The URI restriction will work on a whole level, not individual cases and other not of the same level... not yet, at least.

For now you'll have to protect the content in that page using the conditionals, checking the user and his level to do what you want.