Skip to:
Content
Pages
Categories
Search
Top
Bottom

Passing some BuddyPress profile fields and xprofile fields to bbpress signature


  • fabwintle
    Participant

    @fabwintle

    Hi,

    I am setting up a community website for non-savvy businesses.
    I would like the forum signature field to be automatically populated with a selection of fields from the user’s BBpress profile and xprofile fields.

    Is this possible? I am weak in PHP but can follow instructions and I am very motivated.

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)

  • danbp
    Participant

    @danbp

    Hi @fabwintle,

    have you tried this plugin ?
    https://wordpress.org/plugins/gd-bbpress-tools/

    there was also an older topic on bbpress forum with a solution

    [resolved] [Resolved] BBPress signatures with Buddypress


    fabwintle
    Participant

    @fabwintle

    Hi @danbp,

    I Have this plugin indeed, however what I want to do is automatically populate my signature with existing fields. I don’t believe this plugin achieves that. All it does is adds a ‘signature’ field to the BP x profile field that my member would need to populate themselves.

    Any other idea?


    danbp
    Participant

    @danbp

    Any other idea? Yes !
    Use bbP Signature instead. This plugin has a filtrable function where you can easely add custom fields near signature.

    Activate the plugin. Create a field called signature and add this snippet to bp-custom.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 );
    	if(function_exists('bp_has_groups')) {
    		$signature = xprofile_get_field_data( 'Signature', $user_id );
    	// here we add our custom fields
    		$wowi = '<br>'. xprofile_get_field_data( 'Industry', $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_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_user_signature', 1, 2 );
    	add_filter( 'bbp_get_reply_content', 'my_bbp_reply_content_append_user_signature', 1, 2 );	
    }

    fabwintle
    Participant

    @fabwintle

    Thank you very much @danbp for your answer.

    I have set it up – however I am not seeing the signature in the bp forum

    I suspect it could be because of the bp_has_groups? I am actually not using the groups forums but the sitewide bbp forums.

    Also, would this work for existing users or only for new users?

    Thanks a lot, I cannot wait for this to work!

    Fabie


    danbp
    Participant

    @danbp

    It works for all users (past & new) as soon as they added a signature to their profile.

    Try to replace if(function_exists('bp_has_groups')) by if(function_exists('bbpress') )


    fabwintle
    Participant

    @fabwintle

    Thanks again @danbp.

    Unfortunately, I think what I am experiencing is described here: http://www.tourismtribe.com/wp-admin/plugin-install.php?tab=plugin-information&plugin=bbp-signature&TB_iframe=true&width=600&height=550. My signature doesn’t appear at the bottom of my forum post (even if I add a standard one). So I think the plugin isn’t working.

    Do you have any other trick up your sleeve?


    danbp
    Participant

    @danbp

    @fabwintle Hi Fabienne,

    i’m pretty sure the plugin is working. So you probably do something wrong somewhere, perhaps with your theme or another plugin.

    IMHO, a link formated like the one you indicate in your post is unusual. And a register page with over 45 javascript runing is… very unusual too. So i’m not surprised that you have some issues with a custom function.

    Aside, i haven’t seen any description on that page, at least because i’m not logged in ?

    Honestly, I encourage you to hire a dev to configure and optimize correctly your install. If you want to open it publicly in a mounth, it’s not tool late. Once you get memebrs, it will became difficult to repair.


    fabwintle
    Participant

    @fabwintle

    Hi Dan,

    You are totally right, my job this week is to secure a web dev to help me polish and optimise the site. I have sent a few requests for proposals out already, would you like to receive one or maybe recommend me someone?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Passing some BuddyPress profile fields and xprofile fields to bbpress signature’ is closed to new replies.
Skip to toolbar