Forums

PHP code optimization (3 posts)

  1. cornetjr
    Member
    Posted 4 months ago #

    Here is my crappy code that used to work and now doesn't under 2.8. I understand that this is not optimized. I pieced together bits and pieces from the web. Although I am getting more familiar with php, I still have a lot to learn. Any help would be appreciated.

    <div class="widgetarea">
    <ul id="sidebarwidgeted">
    <?php if (!(current_user_can('level_0'))){ ?>
    <h3>User Dashboard:</h3>
    <p><?php wp_loginout(); ?> | <?php wp_register('', '');?> | " title="Lost Password">Lost Password</p>
    <?php } else { ?>
    <h3><?php echo $current_user->user_login; ?>'s Dashboard:</h3>
    <ul class="admin_box">
    <?php if (is_user_logged_in()){
    global $user_email, $user_login;
    get_currentuserinfo();
    echo "

  2. " . get_avatar( $user_email, 60) . "
  3. ";
    echo "
  4. Logged in as " . $user_login . ".
  5. ";
    } else {
    } ?>

  6. user_login; ?>/"><?php echo $current_user->user_login; ?> Profile
  7. <?php wp_loginout(); ?>
  8. <?php }?>

    </div>

  • Otto42
    Moderator
    Posted 4 months ago #

    Define "doesn't work". What doesn't work about it?

  • cornetjr
    Member
    Posted 4 months ago #

    Sorry that was pretty vague. In a couple of areas I am trying to call the logged in user name. The call below works beautifully with or with wp_supercache runnng

    " . $user_login . "

    The call below does not call the user name at all when supercache is running, but does so when it is disabled.

    <?php echo $current_user->user_login; ?>

    Thanks for your help.

  • Reply

    You must log in to post.

    About this Topic

    Tags

    No tags yet.