Hi Steve,
As Robin answered, you could look into his coding for the bbP Style Pack to see how it works.
There is also https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#8-add-edit-profile-to-a-wordpress-menu that might give you a hint.
Pascal.
Ok. Thank you.
I guess that answers my questions.
The question being, is there a way to add a “my profile” link to a menu.
The answer is, if I am hearing correctly. Yes, sorta, if you edit some function files.
And the answer is also, No – there is no way to do this with bbPress. bbPress does not offer a way for people to edit their profiles unless the user is savy enough to know they should click their profile name in a forum post to see/edit their profile.
I just assumed there would be an easy way to do this. It seems a core function. But I guess I am wrong.
Makes me wonder how others make “profile” pages for their users?
Thanks for the answer.
@aksteve – I had the same frustration. Try this simple plugin I just created. It’ll print the profile url via a shortcode so you can insert it anywhere you like.
@tylertervooren where can I get the simple plugin you created?
after some difficulty I came up with a solution, which allows a standard menu item linking to eg:
forums/users/current
If a request is made to http://mysite/forums/users/current, the user name “current” is detected and replaced with the current user id, or, if the user is not logged in, redirect to login screen:
/*
* attempt to handle generic request for current user
*
* if the url is passed as forums/users/current/
* this function detects that the permalink has been set to bbp_user=current
* and
* - if the user is logged on, the query is changed to the current user
* - if the user is not logged on, the user is redirected to login screen
*
*/
function ink_bbp_request_current_user( $query_vars ) {
if ( isset( $query_vars[ 'bbp_user' ] ) ) {
switch ( $query_vars[ 'bbp_user' ] ) {
case 'current':
if ( get_current_user_id() ) {
$query_vars[ 'bbp_user' ] = bbp_get_current_user_name();
} else {
auth_redirect();
}
}
}
return $query_vars;
}
add_filter( 'bbp_request', 'ink_bbp_request_current_user', 10, 1 );
@jonathanmoorebcs for me, your code works great for admin users, but fails for contributor role users
small tweak to not break for users with names that include spaces. the issue was not a permissions one as i posted above.
/*
* attempt to handle generic request for current user
* https://bbpress.org/forums/topic/how-do-i-link-to-profile-page/
*
* if the url is passed as forums/users/current/
* this function detects that the permalink has been set to bbp_user=current
* and
* - if the user is logged on, the query is changed to the current user
* - if the user is not logged on, the user is redirected to login screen
*
*/
function ink_bbp_request_current_user( $query_vars ) {
if ( isset( $query_vars[ 'bbp_user' ] ) ) {
switch ( $query_vars[ 'bbp_user' ] ) {
case 'current':
if ( get_current_user_id() ) {
$query_vars[ 'bbp_user' ] = bbp_get_user_nicename(get_current_user_id());
} else {
auth_redirect();
}
}
}
return $query_vars;
}
add_filter( 'bbp_request', 'ink_bbp_request_current_user', 10, 1 );
@tylertervooren
Would you be able to update your plugin? I just went to get it and it says it hasn’t been updated for the 3 past WP updates. It has a big warning across it and says it’s been 3 years since updated. I really would love to try this! It might be just what I need!
@sunflowermom: Is there something about it that isn’t working?
I don’t know, I haven’t tried it…it just concerns me when I see that warning…so I don’t download plugins that haven’t been worked on for that long.
Hi,
I installed the plugin, but it doesn’t really show the account page, it only shows the link and it is not clickable? Am I correct? Is there not something like with WooCommerce where subs can click the link and it redirects them to their profile page? The short code for woo is [woocommerce_my_account].
This really should be added to bbpress. In the meantime, you can use
https://YourDomain.com/wp-admin/profile.php
as a permanent link to a user’s profile. HOWEVER: This sends people to their WordPress profile page, not to the more friendly looking bbpress profile. It does still allow them to do all the changes to their settings though.
you can change the WordPress profile to bbpress using the
bbp style pack
once activated go to
dashboard>settings>bbp style pack>login>option 6