a common signature, or a different one per keymaster ?
I only have one keymaster, so for my use I’d just want to be able to set a signature for the sole keymaster.
A great question. I would be interested in multiples though.
untested but try
add_filter( 'bbp_get_reply_content', 'rew_reply_signature', 1, 2 );
add_filter( 'bbp_get_topic_content', 'rew_topic_signature', 1, 2 );
function rew_topic_signature ($content = '', $topic_id = 0) {
$topic_id = bbp_get_topic_id ( $topic_id );
$user_id = bbp_get_topic_author_id( $topic_id );
$separator = '<hr />' ;
$before = '<div class="bbp-topic-signature">' ;
$after = '</div>' ;
if ($user_id == 3) $signature = 'signature for user 3' ;
if ($user_id == 57) $signature 'signature for user 57' ;
if ( !empty( $signature ) )
$content = $content . $separator . $before . $signature . $after;
return apply_filters( 'rew_topic_signature ', $content, $topic_id) ;
}
function rew_reply_signature ($content = '', $reply_id = 0) {
$reply_id = bbp_get_reply_id ( $reply_id );
$user_id = bbp_get_reply_author_id( $reply_id );
$separator = '<hr />' ;
$before = '<div class="bbp-reply-signature">' ;
$after = '</div>' ;
if ($user_id == 3) $signature = 'signature for user 3' ;
if ($user_id == 57) $signature 'signature for user 57' ;
if ( !empty( $signature ) )
$content = $content . $separator . $before . $signature . $after;
return apply_filters( 'rew_reply_signature ', $content, $reply_id) ;
}
Put this in your child theme’s function file – or use
Code Snippets
above amended – spotted an error
This is fantastic — I will definitely test this out.
Am I right in thinking that the two times this line appears:
if ($user_id == 57) $signature 'signature for user 57' ;
Should actually read as:
if ($user_id == 57) $signature = 'signature for user 57' ;
Unfortunately, this code didn’t work — it removed the content of all forum posts!
@robin-w I suppose your first line
add_filter( ‘bbp_get_reply_content’, ‘rew_signature’, 1, 2 );
Should have been
add_filter( ‘bbp_get_reply_content’, ‘rew_reply_signature’, 1, 2 );
right?
And same remark for the topic line below
@casiepa thanks for that spot – yes !!
That got it! Thank you both so much!
great – glad you are fixed