Title: PHP code optimization
Last modified: August 19, 2016

---

# PHP code optimization

 *  [cornetjr](https://wordpress.org/support/users/cornetjr/)
 * (@cornetjr)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-code-optimization/)
 * 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 ”
    - ” . get_avatar( $user_email, 60) . “
    - “;
       echo ”
    - Logged in as **” . $user_login . “**.
    - “;
       } else { } ?>
    - 
    - <?php wp_loginout(); ?>
    - <?php }?>
    -  </div>

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-code-optimization/#post-1128922)
 * Define “doesn’t work”. What doesn’t work about it?
 *  Thread Starter [cornetjr](https://wordpress.org/support/users/cornetjr/)
 * (@cornetjr)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/php-code-optimization/#post-1128924)
 * 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.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP code optimization’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [cornetjr](https://wordpress.org/support/users/cornetjr/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/php-code-optimization/#post-1128924)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
