Skip to:
Content
Pages
Categories
Search
Top
Bottom

I think a lot of people are confused In hooks, actions, filters!

  • Avatar of bp-help
    bp-help
    Participant

    @bphelp

    I have around 2 months experience in BP and I have noticed a lot of people getting confused on this subject and I will try to briefly simplify it. First off I am not an “expert” in BuddyPress. Secondly if you want to hook into buddypress then look at within the templates particularly the do_action ones. Here is a simple example in this matter, you create a plugin with the appropriate header/comments, then create a function within to get the job done, then you hook it by calling the appropriate part of buddypress. In my example I will use bp_head. Create a function with the requirements you need then hook it too buddypress by adding:
    add_action (‘bp_head’, ‘my_functions_name’);
    I hope this helps a few people but like I stated I am no expert I just learn somewhat quick and I enjoy sharing what I learn from others and from experimentation.I love buddypress as well so peace!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Avatar of bp-help
    bp-help
    Participant

    @bphelp

    If there is other folks more experienced that would like to share their experience then I suppose this is as a good thread as any to get this rolling. I love sharing what I have learned and I hope this thread will do good and give some insight as how folks can help themselves. Anyway I will do what I can to help here! I appreciate all contributions to this thread! :-)

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    Also I would like to add that if more experienced users could point novices like me in the proper direction to gain more skills and a better understanding of buddypress then it would be great. Anyway I love you all!

    Avatar of bp-help
    bp-help
    Participant

    @bphelp

    After a little sleep I decided to explain hooks further in hopes of giving a better understanding for novice users such as myself. The add_action (‘bp_head’, ‘my_functions_name’) specifically the bp_head in this this example tells WP and BP where to execute your function in this case the function would be my_functions_name. The way it hooks in this example is by calling bp_head followed by the name of your function. This way you do not have to manually call the function within a template file to make it work. I hope this makes sense. This is just an example and in some cases add_filter will be more appropriate so I hope folks find this a useful breakdown of how this works.

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

You must be logged in to reply to this topic.