bbPress profile page add custom page menu
-
Hi there is no hook that allows me to do this like in buddyPress? For example, buddyPress also has this “bp_core_new_nav_item”.
How can I do this? I really haven’t found a solution. A solution to this.
-
if you mean amend the ‘topics started, relies created’ etc, menu, then this is in the template
\templates\default\bbpress\user-details.php which you can amend and put in a bbpress directory in your child theme
eg…
find
wp-content/plugins/bbpress/templates/default/bbpress/user-details.phptransfer this to your pc and edit to what you want
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/user-details.phpbbPress will now use this template instead of the original
I will do this in a plugin, not a theme.
What I want is I want to add a link there as in the picture below, and I want what I want to appear on the page that opens when I click it. I did it for BuddyPress but couldn’t find a solution for bbPress.
ok, so you could use the hook in the standard template to add the item in a plugin
<?php do_action( 'bbp_template_after_user_details_menu_items' ); ?>
Is there a document showing how to use this? There were no good things when I searched for it: D Thank you.
I got it now, thanks.
add_action( 'bbp_template_after_user_details_menu_items', 'rew_add_item' ); function rew_add_item () { ?> <ul> <li class="pictures"> <span class="pictures-link"> <a href="https://prnt.sc/wcemvm">Click to show picture</a> </span> </li> </ul> <?php }
Yes, I added a menu that way, but how do I add a page, that is, the page to be loaded according to the url.
sorry, I don’t fully understand – the code will take you to any url you want.
do you mean user specific?
or if you got it working in buddypress what code did you use there?
or maybe describe what you want to achieve?
For example, I will add a link called my stories, when it is clicked, it will open to this profile page, just like the likes page.
http: // localhost / projects / wpdev2 / forums / users / mrbeycan / topics /
Like that
Clicked
http: // localhost / projects / wpdev2 / forums / users / mrbeycan / my-stories /
I will fill the gap that will open a blank page just like Topics.
add_action( 'bbp_template_after_user_details_menu_items', 'rew_add_item' ); function rew_add_item () { ?> <ul> <li class="pictures"> <span class="pictures-link"> <?php $username = bbp_get_user_nicename(bbp_get_displayed_user_id()); echo '<a href="http://localhost/projects/wpdev2/forums/users/'.$username.'/my-stories/">Click to show picture</a>' ; ?> </span> </li> </ul> <?php }
Yes, thank you, I’ll do it like this. But as for my stories page, https://prnt.sc/wcfl51 gives 404 error.
I want it to look like any other page.
sorry I am confused …I can give you code to go to any url, but unless you create some content for that url, it will 404.
what are you expecting it to do when you click that link ?
https://prnt.sc/wcfqk7 is a page like this, that is, if there is a profile page, there will be such a stories page, I will show certain things there.
ok, doing that using url’s is well beyond free help or indeed my knowledge of wordpress/bbpress.
The code can be amended to pass a $_REQUEST of say ‘loginname’
you can then create a page in wordpress, and use a shortcode to hook to php code that would look up the login name and display data related to that user, but then you have to have an area to create that data and store it in the database, or let the user create – so you would need creation/edit/delete pages and code.
It is all quite doable but well beyond free help
- You must be logged in to reply to this topic.