I made some changes on BuddyPress theme
– if don’t show what you did, how could it be possible to help you ?
Revert back step by step to find what you did wrong.
I removed this line: do_action( 'bp_member_header_actions' );
from members/single/cover-image-header.php and add it in members/single/home.php file.
…and of course the buttons now appear where they don’t as you removed the action hook they use to get fired.
Put them back (the line you removed goes to line 45 in cover-image-header.php)!
And tell here what you want to do.
I want to put these buttons in another place of the layout.
That’s why I add this action to home.php file.
What is the correct way to this?
By default these buttons are showing on the profile header.
The action location is defined in
/bp-templates/bp-legacy/buddypress/members/single/member-header.php:66
/bp-templates/bp-legacy/buddypress/members/single/cover-image-header.php:45
When Profile Cover option is enabled (see bp settings), BP use the cove-image-header file.
If the option is disabled, he use member-header.
In both case, these buttons need the displayed_user_id and the loggedin_user_id to work. This means you need to be at least in the member loop.
You want these buttons to appear elsewhere. OK. But where exactly ?
Don’t hesitate to provide a screenshot sketching the new place.
Thanks for the explanation.
I think is better to share my members/single/home.php. Here is the link:
https://gist.github.com/marcelo2605/a0d7cb73902c22af4ca01516269f0cf8
The action is in line 129.
I tested your code and got first a page not found error while trying to send a private message from the new position.
I deactivated both action hook in cover and home files.
Disallowed cover image option. And tested again and everithing worked.
Allowed cover image and worked also.
So i confirm that your code works and all buttons show up (with active href’s), at least with Twenty Sixteen theme, at the members profile page bottom.
In resume, the only thing you have to do is to deactivate the original action hook in both files (so you can allow/disallow cover images).
Forgot to mention that there is a litle error in your code line 133
<?= wpautop(xprofile_get_field_data("About me", bp_displayed_user_id() ) ); ?>
Should be
<?php wpautop(xprofile_get_field_data("About me", bp_displayed_user_id() ) ); ?>
Thanks for the help. I will analyse my code.