Hi Brajesh
I want to control and target profile fields groups individually with BP custom hooks.
But how do I define each profile field group, can I use the group id, or group name for this?
I found this markup, is this the way to go?
Define custom hook:
// Primary Group custom hook function custom_hook() { do_action('custom_hook'); }
Tag custom hook
<?php custom_hook(); ?>
Add function
<?php function hello_wordpress() { echo '<h1>Hello WordPress!</h1>'; } add_action('custom_hook', 'hello_wordpress', 7); ?>
Regards
CarstenHi Carsten,
The above is correct way to create custom actions and attaching to those action.I am not sure what you want to accomplish, but it seems you want to display group data somewhere?
To do that, you will need group id. If you want, you can pass group id as the 2nd parameter of the do_action function.
PS:- If the goal is to only display fields data, creating custom hooks may not be needed.
Regards
BrajeshHi Brajesh, thanks for your feed back.
I have illustrated my goal, which is to place the edit buttons directly under their respective groups like this:
Regards
CarstenSorry #29617 was added by mistake ‘Please disregard this topic, I think there is a plugin conflict going on’
I still very much would like you to have a look at this
I have illustrated my goal, which is to place the edit buttons directly under their respective groups like this:
Regards
CarstenHi Carsten,
If your goal is to add edit button under each group, there is an easy solution. You should override the profile loop template.you can copy buddypress/members/single/profile/profile-loop.php from your template pack or theme to your child theme/buddypress/members/single/profile/profile-loop.php
That will give you all the flexibility.
Regards
BrajeshHi Brajesh, yes, that is my goal, but of course it shall be the corresponding edit button for that group.
ok, so after copying the profile-loop.php, how should I override it?
What will that mean for the site functionality in general, overwriting this?
Thanks
CarstenTemplate override is a p[referred way for any changes that you need in the UI.
Which template pack are you using? Nouveau or legacy? I can post the code to show the edit button.
Regards
BrajeshThank you Carsten.
Here is the code for profile-loop.php
https://gist.github.com/sbrajesh/0ea24b0cafacaa098dbf8d61e5eda8bePlease check the “Revision” tab there to see what I changed from the original file.
Please let me know if it works for you or not?
Regards
Brajesh
The topic ‘ [Resolved] Creating a BP custom hook’ is closed to new replies.