Community Support Forums — WordPress® ( Users Helping Users ) — 2011-06-27T12:11:36-05:00 http://www.primothemes.com/forums/feed.php?f=4&t=1141 2011-06-27T12:11:36-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=21806#p21806 <![CDATA[Re: How to show Level membership to all members]]> viewtopic.php?f=40&t=9477&src_doc_v=110605#src_doc_user_access_role%28%29

Code:
<?php echo c_ws_plugin__s2member_user_access::user_access_role(new WP_User($user_id)); ?>

Statistics: Posted by Cristián Lávaque — June 27th, 2011, 12:11 pm


]]>
2011-06-27T10:15:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=21802#p21802 <![CDATA[Re: How to show Level membership to all members]]>
Thanks for your reply!

Statistics: Posted by y2gabs — June 27th, 2011, 10:15 am


]]>
2011-06-26T19:19:12-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=21770#p21770 <![CDATA[Re: How to show Level membership to all members]]>
Code:
<?php echo get_user_field('s2member_access_label'$user_id); ?>

Statistics: Posted by Cristián Lávaque — June 26th, 2011, 7:19 pm


]]>
2011-06-26T12:11:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=21753#p21753 <![CDATA[Re: How to show Level membership to all members]]>
Please let me know.


<div class="item-meta">
<span class="activity">
<?php
$id = bp_member_user_id();
$user = new WP_User( $id );

if ( $user->has_cap( 's2member_level4') ) :
$membership = 'Adh&eacute;rent VIP';
elseif ( $user->has_cap( 's2member_level3') ) :
$membership = 'Adh&eacute;rent';
elseif ( $user->has_cap( 's2member_level0') ) :
$membership = 'Sympathisant';
endif
?>
Current membership level: <?php echo $membership ?>
</span>
</div>

Statistics: Posted by y2gabs — June 26th, 2011, 12:11 pm


]]>
2010-11-07T17:18:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4551#p4551 <![CDATA[Re: How to show Level membership to all members]]>
I think all it takes for it to work inside the members loop is a little tweak: try $id = bp_member_user_id() instead of bp_displayed_user_id(). This last function only works on member profile pages, but the first one should get you what you want inside the loop.

So the code would be simply:

Code:
<div class="item-meta">
   <span class="activity">
      <?php
         $id = bp_member_user_id();
         $user = new WP_User( $id );
                     
         if ( $user->has_cap( 's2member_level4') ) :
            $membership = 'Adh&eacute;rent VIP';
         elseif ( $user->has_cap( 's2member_level3') ) :
            $membership = 'Adh&eacute;rent';
         elseif ( $user->has_cap( 's2member_level0') ) :
            $membership = 'Sympathisant';
         endif
      ?>
      Current membership level: <?php echo $membership ?>
   </span>
</div>

Statistics: Posted by arwyl — November 7th, 2010, 5:18 pm


]]>
2010-11-07T16:11:41-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4548#p4548 <![CDATA[Re: How to show Level membership to all members]]>
I would try something like:

Code:
$query = "SELECT DISTINCT(meta_value) FROM wp_usermeta WHERE meta_key='wp_capabilities'";
$resultx = $wpdb->get_col($query);


This is very similar to the concept I am working on for s2Member for custom fields. Getting the information yuo seek from the fields can also be found in the sample code in the s2members forums post located at

http://www.primothemes.com/forums/viewtopic.php?f=4&t=627

Statistics: Posted by Guest — November 7th, 2010, 4:11 pm


]]>
2010-11-07T03:52:52-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4534#p4534 <![CDATA[Re: How to show Level membership to all members]]> Thanks all of you for your answer.
Anyway, i can't fix this. I modify the member-loop.php file in buddypress. Any code i try, show information about the current user log in.

See my code
Code:
   <ul id="members-list" class="item-list">
   <?php while ( bp_members() ) : bp_the_member(); ?>

      <li>
         <div class="item-avatar">
            <a href="<?php bp_member_permalink() ?>"><?php bp_member_avatar() ?></a>
         </div>

         <div class="item">
            <div class="item-title">
               <a href="<?php bp_member_permalink() ?>"><?php bp_member_name() ?></a>

               <?php if ( bp_get_member_latest_update() ) : ?>

                  <span class="update"> - <?php bp_member_latest_update( 'length=10' ) ?></span>

               <?php endif; ?>

            </div>

            <div class="item-meta"><span class="activity"><?php bp_member_last_active() ?></span></div>
            <div class="item-meta">
                <span class="activity">
               
            <?php
               
                $id = bp_displayed_user_id();
                $user = new WP_User( $id );
               
                    if ( $user->has_cap( 's2member_level4') ) :
                    $membership = 'Adh&eacute;rent VIP';
                elseif ( $user->has_cap( 's2member_level3') ) :
                    $membership = 'Adh&eacute;rent';
                elseif ( $user->has_cap( 's2member_level0') ) :
                    $membership = 'Sympathisant';
                endif ?>
               
                    Current membership level: <?php echo $membership ?>
               
   
                </span>
                </div>

            <?php do_action( 'bp_directory_members_item' ) ?>

            <?php
             /***
              * If you want to show specific profile fields here you can,
              * but it'll add an extra query for each member in the loop
              * (only one regardless of the number of fields you show):
              *
              * bp_member_profile_data( 'field=the field name' );
              */
            ?>
         </div>

         <div class="action">

            <?php do_action( 'bp_directory_members_actions' ); ?>

         </div>

         <div class="clear"></div>
      </li>

   <?php endwhile; ?>
   </ul>


Did i mystake somewhere ? Well that's not that easy to fix that...
Thanks again for you help

Cedric

Statistics: Posted by pericard — November 7th, 2010, 3:52 am


]]>
2010-11-06T23:55:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4529#p4529 <![CDATA[Re: How to show Level membership to all members]]> $bp->displayed_user contains the data for the user whose profile is being displayed (see http://codex.buddypress.org/developer-docs/the-bp-global/). So if you want to get, say, the user ID, you can use the function bp_displayed_user_id().

Then you could use something like this:

Code:
<?php

$id = bp_displayed_user_id();
$user = new WP_User( $id );

if ( $user->has_cap( 's2member_level4') ) :
    $membership = 'Platinum';
elseif ( $user->has_cap( 's2member_level3') ) :
    $membership = 'Gold';


And so on, until you've listed all your membership levels and their corresponding names. Then you'd round up with something like this:

Code:
else :
    $membership = 'Free Membership';
endif ?>


Then you could add a div to display the info:

Code:
<div class="membership-info">
    Current membership level: <?php echo $membership ?>
</div>


There's probably a better way of doing this, but this works! :mrgreen:

Statistics: Posted by arwyl — November 6th, 2010, 11:55 pm


]]>
2010-11-05T22:16:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4526#p4526 <![CDATA[Re: How to show Level membership to all members]]> Open new post or page in HTML tab

Try this

Code:
<?php
    $current_user = wp_get_current_user() ;
    echo 'User level: ' . $current_user->user_level ;
?>


There is another example that will show the level of a user who is not logged in. You will have to search for it in Wordpress or in Google. The current user info is the only one I have used, although I have seen how to get the other, and it is very similar.

Statistics: Posted by KirkWard — November 5th, 2010, 10:16 pm


]]>
2010-11-04T12:53:53-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4504#p4504 <![CDATA[Re: How to show Level membership to all members]]> I'm lost to do what i want.

Any idea or solution ?
Cedric

Statistics: Posted by pericard — November 4th, 2010, 12:53 pm


]]>
2010-11-04T11:29:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4503#p4503 <![CDATA[Re: How to show Level membership to all members]]>
What i need is not to load informations about a user currently logged in, but informations (especially the s2member level membership) about all the members in the buddypress members directory. This member si level 0, level 1, level 2... ?

Does the variable $current_user can provide that ? It appears to me that it will show informations only about a user currently logged in. Am i wrong ?

If you could explain a little more, i would be very glad.

Thanks
Cedric

Statistics: Posted by pericard — November 4th, 2010, 11:29 am


]]>
2010-11-04T10:55:02-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4501#p4501 <![CDATA[Re: How to show Level membership to all members]]>
http://codex.wordpress.org/Function_Ref ... rrent_user

Statistics: Posted by KirkWard — November 4th, 2010, 10:55 am


]]>
2010-11-04T10:24:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4498#p4498 <![CDATA[Re: How to show Level membership to all members]]>
Thank you in advance for your help please,

Cedric

Statistics: Posted by pericard — November 4th, 2010, 10:24 am


]]>
2010-11-03T07:54:15-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4483#p4483 <![CDATA[Re: How to show Level membership to all members]]>
Can anyone please tell us what we need to use to do this.

Thanks,
Andrew.

Statistics: Posted by akingston — November 3rd, 2010, 7:54 am


]]>
2010-11-02T09:01:31-05:00 http://www.primothemes.com/forums/viewtopic.php?t=1141&p=4471#p4471 <![CDATA[How to show Level membership to all members]]> I'm using s2member pro version with buddypress. I'd like to be able to show to all members what level membership has each member. Using that :
Code:
<?php echo S2MEMBER_CURRENT_USER_ACCESS_LABEL; ?>
it will show the membership level only to the current user logged, but i want to find a code which show the membership level to all the members. It's important for my project to make a difference between members who paid and those who didn't pay.
Thanks in advance for your help and sorry for my approximative english.

Cedric

Statistics: Posted by pericard — November 2nd, 2010, 9:01 am


]]>