Very simple forum Signature with Xprofile
-
I modified a little script I found inside a plugin named “bbp signature” https://wordpress.org/plugins/bbp-signature/
That plugin actually does not work with Buddypress, it is a bbpress plugin
[modified by moderator]But the code wasn’t too terrible. even though I only kept a few line of it.
So here’s the solution;
make sure you have buddypress with xprofile enabled *(extended profiles)
1. Create a new text box field in Xprofile and name it “Signature”. *(caps is important, no quotation mark.)
Then add that code to the function.php of your child theme.
//Add Signature function bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) { // Default arguments $defaults = array( 'separator' => '<hr />', 'before' => '<div class="bbp-signature">', 'after' => '</div>' ); $r = wp_parse_args( $args, $defaults ); extract( $r ); // Verify topic id, get author id, and potential signature $reply_id = bbp_get_reply_id ( $reply_id ); $user_id = bbp_get_reply_author_id( $reply_id ); $signature = xprofile_get_field_data( 'Signature', $user_id ); // If signature exists, adjust the content accordingly if ( !empty( $signature )) $content = $content . $separator . $before . $signature . $after; return apply_filters( 'bbp_reply_content_append_signature', $content, $reply_id, $separator ); } add_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
That’s it !
PS. If you want to enable HTML in xprofile there is a way but it’s risky.
you can read about it here : https://buddypress.org/support/topic/html-in-profile-field-again/
- You must be logged in to reply to this topic.