• Resolved qgibbs1

    (@qgibbs1)


    I have a table that is showing some of the current user info for someone who is logged in. The problem is, if the info is not there or the field is blank I want the entire row not to be shown. Such as Middle Name. If the middle name is not there or is empty I want it to be show like this.

    First Name: Blah
    Last Name: Blahas

    and not

    First Name: Blah
    Middle Name:
    Last Name: Blahas

    The code I have is

    <?php global $current_user;  get_currentuserinfo(); echo 'Relationship to Employee:' . $current_user->dep1_relationship . "\n";?><br>
    <?php global $current_user;  get_currentuserinfo(); echo 'First Name:' . $current_user->dep1_firstname . "\n";?>
    <?php global $current_user;  get_currentuserinfo(); echo 'Middle Name:' . $current_user->dep1_middlename . "\n";?>
    <?php global $current_user;  get_currentuserinfo(); echo 'Last Name:' . $current_user->dep1_lastname . "\n";?><br>
    <?php global $current_user;  get_currentuserinfo(); echo 'SSN:' . $current_user->dep1_social . "\n";?><br>
    <?php global $current_user;  get_currentuserinfo(); echo 'Date of Birth:' . $current_user->dep1_dob . "\n";?><br>
    <?php global $current_user;  get_currentuserinfo(); echo 'Gender:' . $current_user->dep1_gender . "\n";?><br>
    <?php global $current_user;  get_currentuserinfo(); echo 'Student:' . $current_user->dep1_student . "\n";?><br>
    <?php global $current_user;  get_currentuserinfo(); echo 'Add of Cancel:' . $current_user->dep1_addorcancelcoverage . "\n";?><br>

    Thank you for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php global $current_user; get_currentuserinfo(); if( !empty($current_user->dep1_middlename) ){ echo ‘Middle Name:’ . $current_user->dep1_middlename . “\n”; } ?>

    Something like this may solve your issue. Also, I don’t think you need to write “global $current_user; get_currentuserinfo();” for so many times. Just write it once at the start the your codes.

    Thread Starter qgibbs1

    (@qgibbs1)

    Thank you very much! It worked like a charm. You are awesome!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Current User info hiding a row’ is closed to new replies.