function bb_get_admin_link( $args = '' ) {
if ( !bb_current_user_can( 'moderate' ) )
return;
if ( $args && is_string($args) && false === strpos($args, '=') )
$args = array( 'text' => $args );
$defaults = array('text' => __('Admin'), 'before' => '', 'after' => '');
$args = wp_parse_args( $args, $defaults );
extract($args, EXTR_SKIP);
$uri = esc_attr( bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) );
return apply_filters( 'bb_get_admin_link', $before . '<a href="' . $uri . '">' . $text . '</a>' . $after, $args );
}
So if you don’t mind bypassing the moderation ability check, just use
esc_attr( bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN) );
or
bb_get_uri('bb-admin/', null, BB_URI_CONTEXT_A_HREF + BB_URI_CONTEXT_BB_ADMIN);
depending if you’ll be escaping the URL later.
To keep the check, use if ( bb_current_user_can( 'moderate' ) )
I was going to hide it behind tags:
<?php if ( bb_is_user_logged_in() ) : ?>
What I wanted to do was to replace the standard:
<?php if ( is_bb_profile() ) profile_menu(); ?>
With other things including links for the “Your Profile”, “Edit (your) Profile”, PM Inbox, Memberslist, “Logout” etc.
Basically I am trying tp bypass the profile_menu() non-global status along the lines of this thread that I wasn’t able to work:
https://bbpress.org/forums/topic/profile_menu-doesnt-work-on-all-pages
I was trying to force the URL and trying to force such a global profile menu using:
<?php echo bb_option('uri'); ?>/profile/<?php echo bb_get_current_user_info( ' name ' ); ?>
But that is pretty ghetto and as you can see it outputs the display name not the username so thus can’t be used for getting a link to the user’s profile…
Use this:
bb_get_profile_link(‘id=’.strval(bb_get_current_user_info( ‘id’ )).’&text=YOUR_TEXT_HERE&before=BEFORE_THE_LINK&after=AFTER_THE_LINK’);
You can view the function here:
https://trac.bbpress.org/browser/trunk/bb-includes/functions.bb-template.php#L2768
Or you can just call get_user_profile_link();
function to get the simple link.
If the user is logged in, it will automatically get the user id.
Function can be found here –
https://trac.bbpress.org/browser/trunk/bb-includes/functions.bb-template.php#L2195