Page 1 of 1

Help! Show profile field groups according to s2 membership?

PostPosted: May 13th, 2011, 5:27 am
by candy
Hi,

Anyone please help!
I am using s2 with buddypress, and in the user profile (profile loop?) I need to show certain profile fields depending on membership level.

As you know buddypress offers those extended profile fields which we can organize in groups (those profile_group_id) - like basic user information goes to Group 1, Extended user information to Group 2, etc.

What I need to do is when a registered user browses the profiles of others users, in the other user's profile he should see the following:

if logged in user has s2_level0, when he looks at the profile of an other user he should only see that user's information contained in Group 1 (so only the basic information)

if the logged in user has s2_level1 than, when looking in other user's profiles he should see the profile information contained in Group1 & Group 2

and if for ex the logged in user has s2_level2 he should be able to see the full information in the profiles of the other users (so let's say all 5 definded field groups with their respective fields).

Could you guys please help me with this?

Thanks in advance

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 13th, 2011, 8:59 am
by Cristián Lávaque
Well, this is certainly custom...

You could try using s2Member's advanced conditionals to control what to show. WP Admin -> s2Member -> API / Scripting -> Advanced Conditionals and Advanced Query Conditionals

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 13th, 2011, 9:47 am
by candy
Hi Christian,

hmm ... I don't think I'll manage that :-(

Can you help me write the conditional please? I do not know the functions, and can't really write code either :-(

smth like

if s2member=level0 show buddypress profile_group_id = 1,2,3
else if s2member=level1 show buddypres profile_group_id=1,2,3,6,7
else profile_group_id =1,2,3,4,5,6,7

??!?

(not even sure how to write that profile_group_id = 1,2,3 to make it get all the groups that I need together)

The trick is also that it must only apply to "others'" profiles, not on his own ...

Help highly appreciated!

Thank you!

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 13th, 2011, 11:31 am
by Cristián Lávaque
I see, then my best suggestion would be that you get help from a freelance developer to create that. http://jobs.wordpress.net

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 13th, 2011, 8:27 pm
by candy
Getting closer ..cracked some stuff already but still stuck with this though ...

Any idea how I can identify myself in the profile-loop.php as "the current user" ? I need to differenciate between my own profile and "profile of others"

something like this myabe
<?php if ( bp_has_profile() )&& (I am the current user) ) : ?>

so the difference between <?php if ( bp_has_profile() ) ) : ?> and <?php if ( bp_has_profile() )&& (I am the current user logged in here) ) : ?> should be that in the second case it applies to me personally (so I can see all details about myself but other users cant see all that I can see)

I think that could solve my issue :-)

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 13th, 2011, 9:54 pm
by Cristián Lávaque
I honestly don't know BuddyPress to answer that off the top of my head. :|

You're doing good, keep at it, I'm sure you'll find it soon. ;)

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 14th, 2011, 10:31 am
by candy
well, I really don't know what's going on here ...

All guys I asked so far told me this is a complicated thing to do and I need a buddypress/wordpress developer to do the job ... and the ones I happened to ask about the job said they need something like a month to the get it done

Still ... with almost zero programming knowledge I manage to get this done in one day ...

It's either that something is really wrong with the wide world, or I am a genius ... :ugeek:

But I'd definitely not go for the second one ...

For the curious guys out there, getting the current user (myself) in the profile-loop (and I guess elsewhere as well) can be achieved by using:

bp_is_my_profile()

Re: Help! Show profile field groups according to s2 membersh

PostPosted: May 14th, 2011, 11:32 am
by Cristián Lávaque
Very well done, Candy! :D