I have been able to add it for everyone…
How did you do that?
Wrap it in a conditional: if ( bp_is_my_profile() ) {...}
http://hookr.io/functions/bp_is_my_profile/
Hello,
Thank you for answering shanebp.
I did it with translation files, so simple and dumb for someone like me who knows very very little about PHP.
Anyway, thank you! Your suggestion lead me to the right track and I did it.
For anyone wondering how to do it:
Overload (search in forum) a template for profile.php and add wherever you need the following:
<?php if ( bp_is_my_profile() )
echo "Your custom text with HTML code or whatever"
?>
Thanks again! 😀
Hi @fakurkr,
the other solution is to use the existing action hooks existing in each BP template.
Templates are the files stored in bp-templates/bp-legacy/buddypress/ directory.
For example if you read the code in buddypress/members/single/member-header.php, you will find not less than 6 action hooks, only for the profile header. This means 6 potential places where to add something like a message.
Th other avantage of this method is that you don’t need to modify any template and that you stay independant from any theme, because you will use a function from bp-custom.php
In your case, adding a message on user’s profile with help of a function like this:
function bpfr_my_message_on_profile () {
echo 'Your custom text with HTML code or whatever';
add_action( 'bp_before_member_header_meta', 'bpfr_my_message_on_profile' );
And because it is only fired on a profile header, you don’t need the conditional (my_profile). You can of course add other conditions. Sky is the limit !