latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

View s2member level in buddyPress profil

Home Forums Community Forum View s2member level in buddyPress profil

This topic contains 3 replies, has 2 voices. Last updated by  Eduan 3 years, 6 months ago.

Topic Author Topic
Posted: Monday Jul 8th, 2013 at 3:54 pm #53125

Is it possible to view S2Member level in BuddyPress profile?

I mean if I’m level 1 member so it is in my profile and if I look in a level 0 profile then it says he is level 0

in the same way if I’m looking at a level 2 profile that will appear he is a level 2 member?

This must apply to all members, everyone should be able to see what level the other members are in.

one. PHP code would be great :)

sorry for poor english – hope you understand what I mean

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Wednesday Jul 10th, 2013 at 10:38 pm #53265
Eduan
Username: Eduan
Moderator

Hello Kenneth,

Check under Dashboard -› s2Member® -› API / Scripting -› PHP/API Constants. You should find a PHP contant that you can echo in order to output the user’s current s2Member level. :)

– Eduan

Posted: Thursday Jul 11th, 2013 at 4:03 pm #53314

The only code I can find to make an output to membership status is

<?php if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 4){ ?>
    A Member has an Access Level of 4.
<?php } else if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 3){ ?>
    A Member has an Access Level of 3.
<?php } else if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 2){ ?>
    A Member has an Access Level of 2.
<?php } else if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 1){ ?>
    A Member has an Access Level of 1.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
    A User is logged in as a Free Subscriber.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
    A User is not logged in at all.
<?php } ?>

Or

<?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>

But that will show my current membership status. If I change my status from example. Level 1 to Level 3 it will show that all members I’m looking at is Level 3

The same if I change it to Level 1 again, it will show that all members I’m looking at is Level 1

If it’s another code I need can you give me a hint?

Posted: Friday Jul 12th, 2013 at 11:05 am #53354
Eduan
Username: Eduan
Moderator

If I remember right S2MEMBER_CURRENT_USER_ACCESS_LABEL doesn’t output the level, but rather the label for that level, for example “Silver” for level 1, “Peasant” for level 0 etc. Of course configurable under Dashboard -› s2Member® -› General Options -› Membership Levels/Labels.

<?php if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 4){ ?>
    A Member has an Access Level of 4.
<?php } else if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 3){ ?>
    A Member has an Access Level of 3.
<?php } else if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 2){ ?>
    A Member has an Access Level of 2.
<?php } else if (S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 1){ ?>
    A Member has an Access Level of 1.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === 0){ ?>
    A User is logged in as a Free Subscriber.
<?php } else if(S2MEMBER_CURRENT_USER_ACCESS_LEVEL === -1){ ?>
    A User is not logged in at all.
<?php } ?>

And again, if I remember right this outputs the current user’s level, so all you have to do is output S2MEMBER_CURRENT_USER_ACCESS_LEVEL and you don’t need to do all this PHP voodoo to output the current level. :)

If I change my status from example. Level 1 to Level 3 it will show that all members I’m looking at is Level 3

That is a genuine concern.

You will need to do some code that works while BuddyPress is getting its info so that you know what user the code should look for. Then you’ll just need to check the user’s role and output it or something similar.

I don’t have experience with this so I’m just giving out ideas. May not work exactly like I say. :)

– Eduan

Viewing 3 replies - 1 through 3 (of 3 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.