[buddypress-trac] [BuddyPress Trac] #6757: Empty Groups appear in Extended Profile on WP Admin causing error during save

buddypress-trac noreply at wordpress.org
Tue Dec 1 07:16:51 UTC 2015


#6757: Empty Groups appear in Extended Profile on WP Admin causing error during
save
----------------------------------+------------------------------
 Reporter:  garrett-eclipse       |       Owner:
     Type:  defect (bug)          |      Status:  new
 Priority:  normal                |   Milestone:  Awaiting Review
Component:  Component - XProfile  |     Version:  2.4.0
 Severity:  normal                |  Resolution:
 Keywords:                        |
----------------------------------+------------------------------

Comment (by garrett-eclipse):

 WORKAROUND UPDATE

 The metabox can be removed through the same
 ''bp_members_admin_xprofile_metabox'' action hook as follows;
 {{{#!php
 <?php
 add_action( 'bp_members_admin_xprofile_metabox', array( $this,
 'remove_empty_groups_metaboxes' ), 20, 3 );
 public function remove_empty_groups_metaboxes($user_id, $screen_id,
 $stats_metabox) {
         // Get all users xprofile groups
         $groups = bp_xprofile_get_groups( array(
                 'fetch_fields' => true,
                 'user_id'      => $user_id
         ) );

         foreach( $groups as $group ) {
                 if ( empty( $group->fields ) ) {
                         // Remove empty groups metabox
                         remove_meta_box('bp_xprofile_user_admin_fields_' .
 sanitize_key( sanitize_title( $group->name ) ), $screen_id, 'normal');
                 }
         }
 }
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6757#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list