carson7634
Forum Replies Created
-
Forum: Plugins
In reply to: [BuddyPress Profile Tabs] Hide empty field groupsWhat editor are you using to modify the file?
Forum: Plugins
In reply to: [BuddyPress Profile Tabs] Hide empty field groupsYou 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
In reply to: Customizer Not Displaying or Saving ChangesUpdate:
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 4Forum: Plugins
In reply to: [BuddyPress Profile Tabs] Hide empty field groupsHello 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
In reply to: [BuddyPress Profile Tabs] Hide empty field groupsAfter 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 . ','; } }