Support » Plugins » Hacks » Add Link to BP Sliding Login Panel to Access Dashboard Page for WP User Frontend

  • command that would simply create the label “User CP” and link to the http://www.domain.com/dashboard/ page I created for the WP User Front End plugin.
  • my site is http://www.globalgamecast.com if you want to check it out.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m unsure of your context, so I may be wrong. If your link works as is for status updates, try this for dashboard:
    <li><a href="<?php echo site_url() . '/dashboard/' ?>">User CP</a></li>
    I don’t see any point in defining your own constant unless you plan to use it in other places and would want to easily update the value in the future.

    @bcworks I so appreciate your reply! I did not know how to call the URL using php, and thanks for showing that to me. And you are correct that it makes no sense to define my own constant. The only thing is that in this scenario, we only want the link to show only when the user is logged in, so wouldn’t we need to still have the echo bp_loggedin_user_domain() portion of the code or something similar?

    Moderator bcworkz

    (@bcworkz)

    I’m not familiar with BP functions, but from the name, it appeared to return an url including /username/, so I substituted site_url() to get the url you wished. I didn’t think it managed the display by whether the user was logged in, but then what would it display without a user? (no answer required) It would leave some broke html if it returned nothing, I suppose it may return the root domain only.

    In any case, a better way to control display by whether logged in or not is to remove the entire list element when not logged in, so do something like:

    <?php if ( is_user_logged_in()) {
      $url = site_url() . '/dashboard/';
      echo "<li><a href='$url'>User CP</a></li>";
    } ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add Link to BP Sliding Login Panel to Access Dashboard Page for WP User Frontend’ is closed to new replies.