BuddyDev

Search

Replies

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54970

    Hi Jerome,
    Thank you for your patience.

    I have investigated the issue thoroughly and the only solution is to avoid using wp-bigraphy/similar mapping and use the BuddyPress Xprofile field(create one named Bio).

    The problem is with BuddyPress and It will have impact on your search as well.

    When a user saves a field which is mapped to WordPress fields, BuddyPress does not have it in the xprofile field data.

    If you had a field in xprofile and you mapped, the old data will remain there and will never be updated. In case of mapped fields, It updates user meta.

    The problem with this approach is it is neither consistent, causes data redundancy/inconsistent state and issues with Profile Data search. It seems, when this feature was introduced(It has been in recent years), It did not go through thorough testing.

    I will suggest avoid using this field mapping as there are no visible benefit of mapping the field.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54969

    HI Alex,
    I am sorry for the delayed reply.

    I have been thinking a solution about it. There is a solution without BuddyPress Friends suggestions pro though. xprofile query are costly(slow), so I am not sure if we should do that or not.

    The approach is to first create a xprofile query builder or this field

    
    function bpfscustom_get_multiselect_field_query( $user_id, $field_id, $match_field_id, $compare ) {
    
    	$field_data = xprofile_get_field_data( $field_id, $user_id );
    
    	if ( empty( $field_data ) ) {
    		return array();
    	}
    
    	if ( ! is_array( $field_data ) ) {
    		return array(
    			array(
    				'field'   => $match_field_id,
    				'value'   => $field_data,
    				'compare' => $compare,
    			)
    		);
    	}
    
    	$query = array();
    	foreach ( $field_data as $datum ) {
    		$query[] = array(
    			'field'   => $match_field_id,
    			'value'   => $datum,
    			'compare' => $compare,
    		);
    	}
    
    	return $query;
    }
    
    

    and then use it in the bp-friend-suggestions-pro-functions.php near line 119

    
    
    		if ( $rule['field_id'] == ACTUAl_MULTI_SELECT_FIELD_ID ) {
    			$queries = bpfscustom_get_multiselect_field_query( $user_id, $rule['field_id'], $rule['match_field_id'], $compare );
    			if ( ! empty( $queries ) ) {
    				$xp_query = array_merge( $xp_query, $queries );
    			}
    continue;
    		}
    

    You should replace the ACTUAl_MULTI_SELECT_FIELD_ID with the numeric field id for the multi select.

    So, the lines in this file which looked like this’

    
    		$xp_query[] = array(
    			'field'   => $rule['match_field_id'],
    			'value'   => $value,
    			'compare' => $compare,
    		);
    

    will be

    
    
    		if ( $rule['field_id'] == ACTUAl_MULTI_SELECT_FIELD_ID ) {
    			$queries = bpfscustom_get_multiselect_field_query( $user_id, $rule['field_id'], $rule['match_field_id'], $compare );
    			if ( ! empty( $queries ) ) {
    				$xp_query = array_merge( $xp_query, $queries );
    			}
    			continue;
    		}
    
    		$xp_query[] = array(
    			'field'   => $rule['match_field_id'],
    			'value'   => $value,
    			'compare' => $compare,
    		);
    
    

    Hope that helps.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54968

    Hi Dianne,
    Thank you for the reply and renewing membership. Announcement coming on February 4th(current plan).
    It is something we discussed over mail long ago, I got some of your great suggestions, It’s delayed but finally getting ready 🙂

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54681

    I am sorry, I typed values instead of value in the suggested condition.

    Here is the correct code.

    
    if( is_array($value)) {
      $value = maybe_serialize( $value );
    }

    Please try it.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54679

    Hi Jerome,
    Thank you for your patience.

    I am sorry, that is a bug. Please remove the code I supplied earlier(It was a mistake, I supplied code from profile data control and not moderator).

    The problem is happening because BuddyPress ignores the xprofile data and uses WordPress user meta data for these ignoring some of our actions. This happens when you use a mapped WordPress field(Biography, first name, last name).

    I am working on a solution, please expect a plugin update by 21st.

    Thank you
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54678

    Hi Alex,
    Please make sure you are using maybe_serialize and not maybe_unserialize. The former will always return a serialized string.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54676

    Hi Nik,
    Thank you for the detailed report.

    I will look into it and get back to you by 22nd.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54675

    Hi,
    I am sorry, It seems their support is not able to understand the question.

    Simplify the question for them:-

    – Is there a function to check if we are on thank you page. Like is_page(‘xyz’) but specific to memberpress? We need the code to check when we are on the thank you page, can you provide that?

    I believe they should be able to understand it and help with the code.

    regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54674

    Thank you for confirming. I am glad it worked.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24778
    Brajesh Singh on #54673

    Hi Kim,
    I am sorry, none of those are supported at the moment.

    BuddyPress(or our xprofile custom field types) do not have the ability to import profile field data.

    Regards
    Brajesh