Skip to:
Content
Pages
Categories
Search
Top
Bottom

Buddypress & BBPress Signature


  • Ericks89
    Participant

    @ericks89

    Wordpress version: 4.3
    Buddypress version: 2.3.3

    Is there any way to designate a user profile field for a forum signature? While searching for support at wordpress.org I found a topic saying as of version 1.4 you can designate profile fields for the signature field, however since 1.4 was quite awhile ago I just assume it’s changed.

    Is there any way to create a user profile field to display as a forum signature? I’m using BBPress.

    Thanks!

Viewing 1 replies (of 1 total)

  • danbp
    Moderator

    @danbp

    @ericks89,

    There is a way, if you use BBPress Signature. 😉 Modifying bbp_get_reply_content filter.

    Here an example fetching 3 xprofile fields called Signature, Industry and Type. Change it to your need. Code goes into bp-custom.php or child theme functions.php

    
    function my_bbp_reply_content_append_user_signature( $content = '', $reply_id = 0, $args = array() ) {
    	// Default arguments
    	$defaults = array(
    		'separator' => '<hr />',
    		'before'    => '<div class="bbp-reply-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 );
    	
    	// Get fields data. Caution: name is case sensitive.
    	if(function_exists('bbpress') ) {
    		$signature = xprofile_get_field_data( 'Signature', $user_id );	
    		$wowi = '<br>'. xprofile_get_field_data( 'Service', $user_id );
    		$wowt = '<br>'. xprofile_get_field_data( 'Type', $user_id );
    	}
    	else {
    		$signature = bbp_get_user_signature ( $user_id  );
    	}
    
    	// If signature exists, adjust the content accordingly
    	if ( !empty( $signature ) )
    		$content = $content . $separator . $before . $signature . $wowi . $wowt . $after;
    
    	return apply_filters( 'my_bbp_reply_content_append_signature', $content, $reply_id, $separator );
    }
    
    if ( !is_admin() ) {
       // remove the original BBPress filter
       remove_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
       // add our custom filter
       add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 1, 2 );	
    }
    

    May this help. 😉

Viewing 1 replies (of 1 total)
  • The topic ‘Buddypress & BBPress Signature’ is closed to new replies.
Skip to toolbar