Title: carson7634's Replies | WordPress.org

---

# carson7634

  [  ](https://wordpress.org/support/users/carson7634/)

 *   [Profile](https://wordpress.org/support/users/carson7634/)
 *   [Topics Started](https://wordpress.org/support/users/carson7634/topics/)
 *   [Replies Created](https://wordpress.org/support/users/carson7634/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/carson7634/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/carson7634/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/carson7634/engagements/)
 *   [Favorites](https://wordpress.org/support/users/carson7634/favorites/)

 Search replies:

## Forum Replies Created

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

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BuddyPress Profile Tabs] Hide empty field groups](https://wordpress.org/support/topic/hide-empty-field-groups/)
 *  Thread Starter [carson7634](https://wordpress.org/support/users/carson7634/)
 * (@carson7634)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/hide-empty-field-groups/#post-7209969)
 * What editor are you using to modify the file?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BuddyPress Profile Tabs] Hide empty field groups](https://wordpress.org/support/topic/hide-empty-field-groups/)
 *  Thread Starter [carson7634](https://wordpress.org/support/users/carson7634/)
 * (@carson7634)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/hide-empty-field-groups/#post-7209958)
 * You are welcome, but credit goes to Jake for creating the plug-in to begin with.
   Buddy press really should pay the man and add this as a stock feature!
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Customizer Not Displaying or Saving Changes](https://wordpress.org/support/topic/customizer-not-displaying-or-saving-changes/)
 *  Thread Starter [carson7634](https://wordpress.org/support/users/carson7634/)
 * (@carson7634)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/customizer-not-displaying-or-saving-changes/#post-7360698)
 * Update:
 * I have tried installing WP on a different host. Using both the manual installation
   instructions and the automated installation provided by cPanel. The issue persists
   across hosts, and forms of installation. Here is the process I use for installing
   WP manually
 * 1) Download WP
    2) Unzip to local file 3) Create database using MySQL in cPanel
   4) Create user for database, recording name and pass 5) Give all privileges to
   created user 6) Upload contents of unzipped wp file to public_html 7) Visit site
   and fill out installation forms, using info collected in step 4
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BuddyPress Profile Tabs] Hide empty field groups](https://wordpress.org/support/topic/hide-empty-field-groups/)
 *  Thread Starter [carson7634](https://wordpress.org/support/users/carson7634/)
 * (@carson7634)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/hide-empty-field-groups/#post-7209956)
 * Hello Jacob,
 * I totally understand not wanting another database call. I am new to wordpress
   and php (more of a c++/Java guy) so these are the things I should learn about.
   Fortunately this did work for me, but I agree that it might not be the best solution.
   I feel like the implementation that you described would be excellent.
 * Thavaz,
 * I am sorry, I think I posted that without fully testing it. I actually see the
   loop in a different location in my installation. It needed to be placed earlier.
   Use with caution, and if Jacob implements this feature, burn my code with fire!
   😛
 * In my installation it is between:
    ‘$this->groups_list = $wpdb->get_results( 
   $profile_field_groups_query );’ and ‘$current_user_id = get_current_user_id();’
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[BuddyPress Profile Tabs] Hide empty field groups](https://wordpress.org/support/topic/hide-empty-field-groups/)
 *  Thread Starter [carson7634](https://wordpress.org/support/users/carson7634/)
 * (@carson7634)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/hide-empty-field-groups/#post-7209937)
 * After staring at the code for a few hours, I came up with this. Works like a 
   charm for me. Even uses the ‘error_log()’ function to tell you what fields are
   found to be “not empty.” I found that the URL field type always comes back not
   empty. I’m sure this could be corrected with a tweak, but I don’t need it to 
   work this way.
 * Paste this code into the “class-bp-profile-tabs.php” file located in “wp-content/
   plugins/buddypress-profile-tabs/public”
 * Paste it just below
    `$member_type = bp_get_member_type( $current_user_id );`
 * but above
    `if ( ! empty( $member_type ) )`
 *     ```
       // Loop removing empty groups
       foreach ( $this->groups_list as $tab_group_index => $tab_group )
       {
               /* SQL Query for profile fields */
       	$profile_fields_query = 'SELECT id, group_id, name FROM '.$wpdb->prefix.'bp_xprofile_fields WHERE group_id='.$tab_group->id;
   
       	/* Gets profile fields from database */
       	$this->fields_list = $wpdb->get_results( $profile_fields_query );
   
       	/* flag for non empty fields within group */
       	$tab_group_is_empty = true;
   
       	/* Check if each field is empty, if one is found to not be empty, set flag to false and break */
       	foreach( $this->fields_list as $field_index => $profile_field )
       	{
       		// Args for getting profile field data
       		$field_args = array('field' => $profile_field->id, 'user_id' => bp_displayed_user_id());
   
       		// Get profile field data
       		$field_value = bp_get_profile_field_data($field_args);
   
       		// Check if empty
       		if(!empty($field_value))
       		{
       			error_log('Value Found: '.$tab_group->name.' - '.$profile_field->name);
   
       			// If not empty, set flag to false and break out of loop.
       			$tab_group_is_empty = false;
       			break;
       		}
       	}
   
       	// Remove tab group if it is empty
       	if($tab_group_is_empty)
       	{
       		unset( $this->groups_list[ $tab_group_index ] );
       		$this->tabs_to_filter .= $tab_group->id . ',';
       	}
   
       }
       ```
   

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