Support » Plugin: BuddyPress Xprofile Custom Field Types » Autolink not working

  • I have two fields which I disabled Autolink for. on te members page these fields appear as links to non-existent search pages. I’d like these fields not to be linked. any ideas way the auto link feature isn’t working or how to turn it off?

    I’ve tried creating a bp-custom.php and using this code:

    <?
    add_action( ‘init’, ‘remove_xprofile_links’ );
    function remove_xprofile_links() {
    remove_filter( ‘bp_get_the_profile_field_value’, ‘xprofile_filter_link_profile_data’, 9, 3 );
    }
    ?>

    With no effect.

    any help would be appreciated.

Viewing 3 replies - 16 through 18 (of 18 total)
  • It’s clear to me this is also the desired behaviour as shown in the other site I linked to above.

    They obviously have a dog breeds post type and owners my own more than one breed.

    They want to be able to link this to a search of the members directory to find other owners of the same breed.

    Plugin Author Brajesh Singh

    (@sbrajesh)

    Hi,
    Thank you.

    Your use case makes sense but it is not feasible with this plugin.

    If I understand, you want to associate terms with users. The use case of this taxonomy/post type is simple.

    In your case, I believe there is a plugin that can help
    https://wordpress.org/plugins/wp-user-groups/

    The problem with this plugin is we associate the terms as serilized array. In your case, to make it searchable you need terms to be asociated with users just like content has terms.

    The plugin https://wordpress.org/plugins/wp-user-groups/ allows associating terms(in the backend only) like rea l content term association and users can be searchable with it.

    It will need extra effort to make it work on the front end though.

    As for the confusion:- We will try to make it more explicit on the profile field creation screen that this is display only functionality and nor searchable.

    Regards
    Brajesh

    The plugin https://wordpress.org/plugins/wp-user-groups/ allows associating terms(in the backend only) like rea l content term association and users can be searchable with it.

    Thanks for the recommendation but sadly this defeats the purpose of users being able to update their own profile from the frontend if it only works backend.

    For now I’ve made it work as follows:

    	/**
    	 * Filter display.
    	 *
    	 * @param mixed $field_value
    	 * @param string $field_id
    	 *
    	 * @return mixed
    	 */
    	public static function display_filter( $field_value, $field_id = '' ) {
    
    	    if ( empty( $field_value ) ) {
    			return;
    		}
    
    		$field_value = explode(',', $field_value );
    		$term_ids = wp_parse_id_list( $field_value );
    
    		$tax = self::get_selected_taxonomy( $field_id );
            $list = '';
    
    		foreach( $term_ids as $term_id ) {
    			$tid = trim($term_id);
    			$term = get_term( $term_id, $tax );
    			if ( ! $term || is_wp_error( $term ) ) {
    				continue;
    			}
    			$query_arg = bp_core_get_component_search_query_arg( 'members' );
    			$search_url = add_query_arg( array( $query_arg => urlencode( $tid ) ), bp_get_members_directory_permalink() );
    			$list .= sprintf( '<li><a href="%1$s">%2$s</a></li>', esc_url( $search_url ), esc_html( $term->name ) );
    
            }
    
    		if ( $list ) {
    			return '<ul class="bpxcftr-multi-taxonomy-terms-list">'.$list.'</ul>';
    		}
    
    		return '';
    	}

    It partially works even when passing the id as the search term. It returns correct results but alos results for anywhere else that number appears e.g. phone numbers.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Autolink not working’ is closed to new replies.