Info
- 5 posts
- 3 voices
- Started 2 years ago by ariolander
- Latest reply from Gautam
- This topic is not resolved
Get Profile Links
-
- Posted 2 years ago #
bb_get_profile_link(bb_get_current_user_info( 'id' ))
Is there any way to get the URL to the logged in user's profile without all that "view your profile" junk it tacks onto the above call?
I am trying to customize my logged-in.php into something like:
<ul> <li>Profile</li> <li>Edit</li> <li>PM</li> <li>Favorites</li> <li>Logout</li> </ul>Except I can never get it to pump out clean URLs =/
-
- Posted 2 years ago #
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' ) ) -
- Posted 2 years ago #
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:
http://bbpress.org/forums/topic/profile_menu-doesnt-work-on-all-pagesI 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...
-
- Posted 2 years ago #
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:
http://trac.bbpress.org/browser/trunk/bb-includes/functions.bb-template.php#L2768 -
- Posted 2 years ago #
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 -
http://trac.bbpress.org/browser/trunk/bb-includes/functions.bb-template.php#L2195 -
You must log in to post.