Support » Plugin: Custom Profile Filters for BuddyPress » Feature request: generate "tag cloud" from profile keywords?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Boone Gorges


    Hi Amanda. Sadly, it’s not easy to do this. The plugin only detects bracketed terms and then links them to a search matching those terms. But that search is based only on a URL parameter and is a text search against text fields. The bracketed terms are not structured in any way that makes them easy to query, across users, in one fell swoop.

    There’s a longstanding BuddyPress ticket for building a taxonomy-powered backend for BP profile fields If this is ever done, it’ll make it possible to integrate the square-bracket system of this plugin with the profile taxonomy – so that putting [foo] in brackets will assign you the tag [foo]. At that point, it’ll be possible to create tag clouds.

    Forgot I posted this as a feature request! Funny you mention this — a developer here said the same thing about the difficulty, but he hacked together a shortcode that produces the desired result. See

    I haven’t looked at the code, but I asked him just a couple of days ago to look into abstracting it enough so that it could be contributed to CBOX (couldn’t find a GitHub repo for the plugin; I think it predates GH!). Stay tuned. I’ll send him this thread.

    @amandafrench, did you ever get this code?

    Yes and no — sadly, said talented developer has left us, so he never did abstract the code for use in CBOX. 🙁 What a difference a month makes! I’ll see if I can dig it up, though.

    Sweet! Thanks! Would love this feature.

    Sorry it has taken me so long to do this, but I finally dug up the login info and took a look. As best I can tell, this was done as a functions.php file in a child theme. The child theme has the necessary style.css with the header, but that’s the only other file. The functions.php in the child theme creates a ‘taglist’ shortcode, as follows:

    function clean_taglist($field_value){
    	preg_match_all('/\[.*?\]/',$field_value, $matches);
    	$tags = '';
    	foreach($matches as $match_array) {
    		foreach($match_array as $match_item){
    			$tags = $tags . trim($match_item) . ',';
    	$tagarray = explode(',', $tags);
    	$tags = implode('; ', array_filter(array_iunique($tagarray)));
    	$tags = cpfb_add_brackets($tags);
    	$tags = cpfb_add_social_networking_links($tags);
    	$tags = cpfb_unlink_fields($tags);
    	return $tags;
    //[Array Unique Case Insensitive]
    function array_iunique($array) {
        return array_intersect_key(
    //[taglist field="field-name"]
    function taglist_func( $atts ){
    	$attributes = shortcode_atts( array(
            'field' => null,
            'brackets' => 'false'
        ), $atts );
    	// If no field defined, return error.
        if($attributes['field'] == null){
        	return "Missing required attribute: 'field'.";
    	$allusers = get_users();
    	$taglist = '';
    	//For fields requiring brackets (In this install, only one field)
    	if($attributes['brackets'] == 'true'){
    		foreach ($allusers as $user) {
    			$args = array(
    			    'field'     => $attributes['field'],
    			    'user_id'   => $user->ID
    			$taglist = $taglist . bp_get_profile_field_data($args);
    		$taglist = clean_taglist($taglist);
    	//For fields without brackets (all other fields)
    		foreach ($allusers as $user) {
    			$args = array(
    			    'field'     => $attributes['field'],
    			    'user_id'   => $user->ID
    			$taglist = $taglist . bp_get_profile_field_data($args) . ';';
    		$tagarray = explode(';', $taglist);
    		$tagarray = array_filter(array_iunique($tagarray));
    		foreach($tagarray as $key => $org){
    			$tagarray[$key] = trim(xprofile_filter_link_profile_data($org));
    		$taglist = implode('; ', $tagarray);
    	return $taglist;
    add_shortcode( 'taglist', 'taglist_func' );

    Hi Amanda, thank you for sharing the code!

    You are welcome, @rmiarka! All credit to Chris Klein of

    Hi Amanda!

    Somehow this script does not work anymore. It seems that
    $tagarray[$key] = trim(xprofile_filter_link_profile_data($org));
    is breaking the output. Have you noticed any problems too?


    Still works for us for the existing users, though admittedly we haven’t had any new users (the site’s not really being used). We are running Wp 4.5.2.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Feature request: generate "tag cloud" from profile keywords?’ is closed to new replies.