[Resolved] No options for BP conten in the display location rules.

Home Forums Support No options for BP conten in the display location rules.

This topic contains 10 replies, has 2 voices, and was last updated by  David 2 months, 1 week ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1207212

    Carsten

    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?

    #1207270

    David Customer Support

    Hi there,

    does Member not show up in the list of Display Rule locations ?

    #1207290

    Carsten

    No, no Member in the list

    #1207345

    David Customer Support

    I 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.

    #1207508

    Carsten

    The 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?

    #1207520

    David Customer Support

    What 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.

    #1207600

    Carsten

    I 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/

    #1207615

    David Customer Support

    Not 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.

    #1207656

    Carsten

    Hi 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

    #1207660

    Carsten

    Hi 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

    #1207675

    David Customer Support

    Awesome – glad to hear that 🙂

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.