An example is when I posted this message I now see: Topic created successfully” – where is that code?
damn that’s all bp core stuff. Is there no way to over ride this in a theme? like to say “when submit is liked if the post was successful – do this instead of that” in a theme?
oh no – the plugin in one would be better as I need to over right the method to not display a message but instead a java script popup that I am interested in testing. But I have never developed a plugin and I wanted to build it right into the theme instead of having a separate plugin.
I’m also interested to post and you’re suggestion is a big help. I think I’ll try getting into it right now. thank you and I’ll start following your directions.
doesn’t like spam _>” title=”>_>” class=”bbcode_smiley” />
Does any one have any blog posts, forum topics, wikis, documentation on how to write or over write a buddy press function?
@akyleadam what you’re trying to change was the text string “Topic created successfully” into e.g. “when submit is liked if the post was successful – do this instead of that” and the links I gave could do that.
Take the first link, instead of creating a plugin, you can add this to your active theme’s functions.php – replacing the text string in that post to your own:
`class PJW_Translation_Mangler {
/**
* Filter the translation string before it is displayed.
*
* @param $translation The current translation
* @param $text The text being translated
* @param $context The context for the translation
* @param $domain The domain for the translation
* @return string The translated / filtered text.
*/
function filter_gettext($translation, $text, $domain) {
$translations = &get_translations_for_domain( $domain );
if ( $text == ‘Topic created successfully’ ) {
return $translations->translate( ‘when submit is liked if the post was successful – do this instead of that’ );
}
return $translation;
}
}
add_filter(‘gettext’, array(‘PJW_Translation_Mangler’, ‘filter_gettext’), 10, 4);`
You see where I’ve substituted you own terms with that of the code given by Westi
@mercime except what I want is:
When the page loads after you hit submit you are greeted with the success or error message (on any thing you do such as saving, editing…what ever) What i want is to take that text out, replace it with a java script pop up – so when the page loads to show you your new topi that pop up displays to say what ever message i gave it for error or success. I have a nice android based notification popup to do this so it will not be obtrusive.
This is my end game.
@mercime also your example failed. I keep all functions I write in a separate folder in a lib folder, and called that custom function via: include_once(TEMPLATEPATH . ‘lib/CustomFunctions/DisplayMessage.php’);
How ever the message is un changed (the message I was cheking for was: The topic was created successfully
and I testing by changing to: I am changed.
This is the ode:
class translator
{
function filter_gettext($translation, $text, $domain)
{
$translations = $get_translations_for_domain($domain);
if( $text == ‘The topic was created successfully’)
{
return $translations->translate(‘I am changed’);
}
return $translation;
}
}
add_filter(‘gettext’, array(‘translator’, ‘filter_gettext’), 10, 4);
bump – can I please get some help?