How to add a link where using is_admin()
-
First off, I love this plugin, it’s my new favorite.
I added a log in form using this to the sidebar. I can’t for some reason get the global is_admin() function to work right.
Code:
if (!is_user_logged_in()): echo wp_login_form(); echo '<a href="'; echo wp_login_url(); echo '" title="Login">Secure Login</a> or <a href="'; echo (site_url()) . "/" . "register" . "/"; echo '">Register</a>.'; else: global $current_user; get_currentuserinfo(); echo '<h4>Welcome <a href="'; echo (bp_loggedin_user_domain()); echo '">'; echo bp_loggedin_user_fullname(); echo '</h4></a>'; echo '<div class="pull-left"><a href="'; echo (bp_loggedin_user_domain()); echo '">'; echo get_avatar( $current_user->ID, 80 ); echo '</a></div>'; echo '<a href="'; echo (bp_loggedin_user_domain() . "profile" . "/" . "edit"); echo '">Update Profile</a><br>'; echo '<a href="'; echo (bp_loggedin_user_domain()) . "activity" . "/"; echo '">Update Status</a><br>'; echo '<a href="'; echo (bp_loggedin_user_domain()) . "messages" . "/"; echo '">Check Inbox</a>'; echo '<div class="clearfix"></div><a class="btn btn-mini btn-primary" title="Logout" href="'; echo wp_logout_url( get_permalink() ); echo '">Logout</a>?'; echo '<a class="btn btn-mini btn-primary center" title="Help" href="/help">Help</a> '; if ( is_admin() ): echo '<a class="btn btn-mini btn-primary" title="Dashboard" href="'; echo admin_url(); echo '">Dashboard</a>'; endif; endif;
Basically I want the final button to only show for admin users only but it still showing for all users.
Any ideas?
Thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to add a link where using is_admin()’ is closed to new replies.