can you explain a bit more about what you are wishing to achieve.
eg user posts a topic/reply/either? and then before being published
automatic text is added – then same text each time
Someone looks at the posts and does a manual edit
some code looks for x and changes it to y
nothing in the database is changed, but before any display soemthing happens?
etc.
A user posts a topic. That topic now has a couple of replies. We have implemented a standard of referencing other replies without quoting by simply using a hashtag and a number. Like ‘#5’ would be a reply to reply number 5 in the topic.
We currently have a plugin (that I did not write but have access to) that upon ‘commit’ or save will analyse the content of the reply and convert all #[NUMBER] strings into anchor references to other replies before content is saved to db.
This is just not very practical because when that same reply is edited the #[NUMBER] has now been wrapped in a tag to make it a link making editing the # part very annoying if that’s what users want to do.
Instead we would like to make the analyses and the conversion of the reply when the readout from db happens. Or at least before any text/replies are shown. That means the code has to run on every reply every time it needs to be shown, but the content save is as the user saved it.
Does that make any sense?
thanks for that – I think I understand 🙂
so the function that is used to display replies is is held in
\bbpress\includes\replies\template.php
line 576`
function bbp_get_reply_content( $reply_id = 0 ) {
$reply_id = bbp_get_reply_id( $reply_id );
// Check if password is required
if ( post_password_required( $reply_id ) ) {
return get_the_password_form();
}
$content = get_post_field( 'post_content', $reply_id );
// Filter & return
return apply_filters( 'bbp_get_reply_content', $content, $reply_id );
}
so
add_filter( 'bbp_get_reply_content', 'my_function', 10 , 2) ;
function my_function ($content, $reply_id ){
//your code here
}
I will try that and report back. Thank you very much, sir.