Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

Using member ids in theme

Simple Membership Plugin › Forums › Simple Membership Plugin › Using member ids in theme

Tagged: Member, php, theme

  • This topic has 3 replies, 2 voices, and was last updated 10 years, 11 months ago by Kristianvv.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • February 26, 2015 at 8:12 pm #1097
    Kristianvv
    Participant

    Hello,

    I love your plugin, but I was wondering is I can use the member id’s to show content in the wordpess theme itself?

    Here is an example of what I mean. (sorry

    <?php 
         $user_id = get_current_user_id();
         $group = Groups_Group::read_by_name( 'member' );
         if ( Groups_User_Group::read( $user_id, $group->group_id ) ) :
         ?>
         content for members here
         <?php else: ?>
         content for nonmember here
         <?php endif;?>
    February 27, 2015 at 1:01 am #1099
    nur
    Participant

    if you are looking for wordpress member id then you can use this approach. but this is not going to give you simple membership user id (which is different from wordpress user id). to get simple membership user id, you can do this:

    
    $auth = BAuth::get_instance();
    if ($auth->is_logged_in()){
        $member_id  = $auth->get('member_id');
        // content for members
    }
    else{
       // content for non-members
    }
    
    March 3, 2015 at 8:53 pm #1143
    Kristianvv
    Participant

    Thank you so much! this is just what i need!

    March 3, 2015 at 9:00 pm #1144
    Kristianvv
    Participant

    I do have a little problem tough, i get a error.

    syntax error, unexpected '&'

    and it is in this line:

    if ($auth->is_logged_in()):

    edit: something strange must have happened.. My mail client changes the -> to “&”

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy