Skip to:
Content
Pages
Categories
Search
Top
Bottom

Solved – How to use bp Nouveau theme hooks?


  • tatiana_k
    Participant

    @tatiana_k

    The previous buddypress theme used actions, for example do_action( ‘bp_after_profile_content’ ).
    Now there’re hooks instead, for example bp_nouveau_xprofile_hook( ‘after’, ‘loop_content’ );

    And I cannot find any information how these hooks can be used.
    What function do I have to use instead of add_action now?

Viewing 3 replies - 1 through 3 (of 3 total)

  • vapvarun
    Participant

    @vapvarun

    You can compare the template files for both
    https://github.com/buddypress/BuddyPress/tree/master/src/bp-templates


    tatiana_k
    Participant

    @tatiana_k

    As you can see I have already compared it.
    In first case I used add_action() function.
    What function should I use with the second one?


    tatiana_k
    Participant

    @tatiana_k

    Here’s the solution how to use Nouveau theme hooks.
    It’s a bit complicated, but I’ve not found a way easier. And no other instructions.

    1. Find the hook you need.
    2. Search through the buddypress files and find the function with the same name (hook is a function, so find the source).
    In my example it’s function bp_nouveau_xprofile_hook($when = ”, $suffix = ”) {} (code reference page)
    3. Write down the array with all $hook components.
    Here they are bp/after/profile/loop_content
    I’d like to say that the pattern is
    bp/first-argument-in-hook/hook-name-from-function/second-argument-in-hook
    but here I had to change xprofile to profile, so the source code is still essential.
    4. Merge the array with _ (bp_after_profile_loop_content)
    5. Congratulations! We’ve got a custom action name and can continue with add_action().

    Honestly, I don’t understand why it has to be so complicated now, but here we are.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar