- This topic has 10 replies, 2 voices, and was last updated 4 years, 1 month ago by David.
-
AuthorPosts
-
March 23, 2020 at 4:55 am #1207212Carsten
Hi there, I’m testing the use of a hook to replace my BuddyPress private message button, but the problem with this solution is, that the BP content is not an option in the display location rules.
Members page where the button should be displayed is https://domain/members/username/, where the username of course is dynamic.
Any solution to this problem?, would it be possible to include BP pages?
March 23, 2020 at 6:04 am #1207270DavidStaffCustomer SupportHi there,
does
Member
not show up in the list of Display Rule locations ?March 23, 2020 at 6:25 am #1207290CarstenNo, no Member in the list
March 23, 2020 at 6:48 am #1207345DavidStaffCustomer SupportI recall from your other topics that you removed the button from the
bp_member_header_actions
hook.So in the Hook Element, you can select Custom Hook from the Hooks list and add
bp_member_header_actions
to the field provided.Then you can use the Entire Site Display Rules.
March 23, 2020 at 7:12 am #1207508CarstenThe button has not been removed yet
// Messages button. if ( bp_is_active( 'messages' ) ) add_action( 'bp_member_header_actions', 'bp_send_private_message_button', 20 );
I added the custom hook, but I can’t see any new display rule for member?
March 23, 2020 at 7:27 am #1207520DavidStaffCustomer SupportWhat i am suggesting is that:
1. Use choose a custom Hook that exists ONLY where you need that element to be displayed.
2. Use the Display Rules:Entire Site
– the element will now be displayed only when the Hook is present.I am not a BuddyPress user but I assume that the
bp_member_header_actions
will only exist on templates that are visible to memebers.March 23, 2020 at 8:08 am #1207600CarstenI see, but the problem with this custom hook is that it is just adding an extra button to the header, not to after_content as I want.
Using the after_content hook is working, but shows on all pages and generate several errors on my page as described in my other topic,
https://generatepress.com/forums/topic/critical-error-connected-to-hook-element/March 23, 2020 at 8:20 am #1207615DavidStaffCustomer SupportNot sure if i am missing something Couple of choices.
1. Use a BuddyPress template tag to set the condtion – as you already have the condition you could use that with the Hook:
<?php if ( bp_is_active( 'messages' ) ) { ?>// Your code here <?php } ?>
OR
2. Find a BuddyPress hook that is more relevant to your positional needs.
Couldn’t find a visual guide – so use the Simply Show Hooks plugin to display hooks on the front end.March 23, 2020 at 8:43 am #1207656CarstenHi again, found the right hook to use, bp_after_member_body. Apparently this is not creating any errors either, so I guess the problem is solved ๐
Instead of adding a remove_action, my plan is to hide the buttons in the header with CSS.
Thanks
March 23, 2020 at 8:46 am #1207660CarstenHi David, my message just crossed your answer, which is in line with my solution. The list of BP actions can be found at buddypress.org.
Thanks again
March 23, 2020 at 8:52 am #1207675DavidStaffCustomer SupportAwesome – glad to hear that ๐
-
AuthorPosts
- You must be logged in to reply to this topic.