Forums

CMS Customization: Need the correct user_id for elseif statement (3 posts)

  1. MikeUni
    Member
    Posted 1 year ago #

    Hello-

    I'm using this CMS plugin by WP-Wave, not getting any replies and they have temporarily taken down there forum for a few months now and trying to get a little creative with the is_user_logged_in function.

    In there readme text they show the this php code:

    <?php if (is_user_logged_in())   { ?>
    <li><a href="http://Yourdomain.com/deposit/" title="Deposit">Deposit</a></li>
    <li><a href="http://Yourdomain.com/profile/" title="Edit Profile">Edit Profile</a></li>
    <li><a href="http://Yourdomain.com/register/?action=renew_upgrade" title="Renew or Upgrade your account">Renew / Upgrade</a></li>
    <li><a href="<?php echo wp_logout_url(); ?>" title="Log out from this account">Log out</a></li>
    <?php } ?>

    Which of course shows/reveals to all logged in members. I have done that in a previous website but want to get a little funky with it... :)

    I want to break it down further.

    This is what I am trying to do:

    <?php
    global $user_ID;
    	if (1!=get_usermeta($user_ID,'planid')) {
    //Free Members can see
        include ('plans/free.php');
    } elseif (2!=get_usermeta($user_ID,'planid')){
    //Gold Members can see
        include ('plans/gold.php');
    } elseif (3!=get_usermeta($user_ID,'planid')){
    //White Gold Members can see
    	include ('plans/whitegold.php');
    } else {
    //Non Members can see
    	include ('plans/nonmembers.php');
    }
     ?>

    Thank you in advance for helping me in this.

    Mike

  2. Rahul Sonar
    Member
    Posted 1 year ago #

    user this

    <?php global $current_user;
          get_currentuserinfo();
    
          echo 'Username: ' . $current_user->user_login . "\n";
          echo 'User email: ' . $current_user->user_email . "\n";
          echo 'User first name: ' . $current_user->user_firstname . "\n";
          echo 'User last name: ' . $current_user->user_lastname . "\n";
          echo 'User display name: ' . $current_user->display_name . "\n";
          echo 'User ID: ' . $current_user->ID . "\n";
    ?>
  3. MikeUni
    Member
    Posted 1 year ago #

    THx for the response Rahul. Its nots working for me as of yet.

    I came up with this:

    <?php
    global $current_user;
          get_currentuserinfo();
    
    	if (1!=get_currentuserinfo($user_ID,'planid')) {
        include ('plans/free.php');
    } elseif (2!=get_currentuserinfo($user_ID,'planid')){
        include ('plans/gold.php');
    } elseif (3!=get_currentuserinfo($user_ID,'planid')){
    	include ('plans/whitegold.php');
    } else {
    	include ('plans/nonmembers.php');
    }
     ?>

    AND THIS:

    <?php
    global $current_user;
          get_currentuserinfo();
    
    	if (1!=get_currentuserinfo($current_user->ID,'planid')) {
        include ('plans/free.php');
    } elseif (2!=get_currentuserinfo($current_user->ID,'planid')){
        include ('plans/gold.php');
    } elseif (3!=get_currentuserinfo($current_user->ID,'planid')){
    	include ('plans/whitegold.php');
    } else {
    	include ('plans/nonmembers.php');
    }
     ?>

    What I am getting is the Free Membership is the only one going through when I am logging in the other accounts. It will only pull the first if statement. Where am I going wrong?

    [mod: if your codes are getting any longer, please use the pastebin, as per forum rules]

Topic Closed

This topic has been closed to new replies.

About this Topic