• My WP is going to be used as a CMS for my family to pass pictures, news, etc. on to each other since we are spread out over the US. Its also integrated with bbPress.

    I’m using a template for the sandbox theme and currently creating a custom functions.php that will display a user options box and links etc. when the user is logged in, and a Login/Register link when they are logged out. However, I’m not aware of any template tags that allow me to display a username to the currently logged in user, not the author of the current post. Can anyone help me?

    Here is the code inside function login_box() so far(Since I’m using sandbox I figure I can use the body class loggedin to display which div.loginbox is neccessary without doing any extra php):

    <div id="in" class="loginbox">
      <span id="greeting">Hello, User</span>
      <a href="/wp/wp-admin/profile.php">
        <img id="userpic">User pic goes here(using a user avatar plugin)</img>
        <p id="userbio">User bio goes here</p><!-- may or may not be included, depending on space, etc. -->
      </a>
      <div id="bbpress">bbPress links and notifications will go here</div>
      <div id="themeswitch">Theme Switcher dropdown box functions called here</div>
      <span id="loginout"><?php wp_loginout(); ?></span>
    </div>
    <div id="out" class="loginbox">
      <span id="loginout"><?php wp_loginout(); ?></span>
      <span id="register"><?php wp_register(); ?></span>
    </div>

    Also, if you have any suggestions on using WP and bbPress together as a CMS please feel free to add them!

  • The topic ‘Functions.php user login box’ is closed to new replies.