Changeset 9684
- Timestamp:
- 04/03/2015 01:40:17 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-xprofile/bp-xprofile-template.php
r9676 r9684 20 20 */ 21 21 public $current_group = -1; 22 22 23 23 /** 24 24 * The number of groups returned by the paged query. … … 29 29 */ 30 30 public $group_count; 31 31 32 32 /** 33 33 * Array of groups located by the query. … … 38 38 */ 39 39 public $groups; 40 40 41 41 /** 42 42 * The group object currently being iterated on. … … 56 56 */ 57 57 public $current_field = -1; 58 58 59 59 /** 60 60 * The field count. … … 65 65 */ 66 66 public $field_count; 67 67 68 68 /** 69 69 * Field has data. … … 74 74 */ 75 75 public $field_has_data; 76 76 77 77 /** 78 78 * The field. … … 92 92 */ 93 93 public $in_the_loop; 94 94 95 95 /** 96 96 * The user ID. … … 921 921 * Output the tabs to switch between profile field groups. 922 922 * 923 * @since BuddyPress (1.0.0) 924 * 923 925 * @return string Field group tabs markup. 924 926 */ 925 927 function bp_profile_group_tabs() { 926 global $group_name; 927 928 $bp = buddypress(); 929 $groups = bp_profile_get_field_groups(); 930 931 if ( empty( $group_name ) ) 932 $group_name = bp_profile_group_name(false); 933 934 $tabs = array(); 928 echo bp_get_profile_group_tabs(); 929 930 /** 931 * Fires at the end of the tab output for switching between profile field 932 * groups. This action is in a strange place for legacy reasons. 933 * 934 * @since BuddyPress (1.0.0) 935 */ 936 do_action( 'xprofile_profile_group_tabs' ); 937 } 938 939 /** 940 * Return the XProfile group tabs 941 * 942 * @since BuddyPress (2.3.0) 943 * 944 * @return string 945 */ 946 function bp_get_profile_group_tabs() { 947 948 // Get field group data 949 $groups = bp_profile_get_field_groups(); 950 $group_name = bp_get_profile_group_name(); 951 $tabs = array(); 952 953 // Loop through field groups and put a tab-lst together 935 954 for ( $i = 0, $count = count( $groups ); $i < $count; ++$i ) { 936 if ( $group_name == $groups[$i]->name ) 955 956 // Setup the selected class 957 $selected = ''; 958 if ( $group_name === $groups[ $i ]->name ) { 937 959 $selected = ' class="current"'; 938 else 939 $selected = ''; 940 941 if ( !empty( $groups[$i]->fields ) ) { 942 $link = trailingslashit( bp_displayed_user_domain() . $bp->profile->slug . '/edit/group/' . $groups[$i]->id ); 943 $tabs[] = sprintf( '<li %1$s><a href="%2$s">%3$s</a></li>', $selected, $link, esc_html( $groups[$i]->name ) ); 944 } 960 } 961 962 // Skip if group has no fields 963 if ( empty( $groups[ $i ]->fields ) ) { 964 continue; 965 } 966 967 // Build the profile field group link 968 $link = trailingslashit( bp_displayed_user_domain() . buddypress()->profile->slug . '/edit/group/' . $groups[ $i ]->id ); 969 970 // Add tab to end of tabs array 971 $tabs[] = sprintf( 972 '<li %1$s><a href="%2$s">%3$s</a></li>', 973 $selected, 974 esc_url( $link ), 975 esc_html( apply_filters( 'bp_get_the_profile_group_name', $groups[ $i ]->name ) ) 976 ); 945 977 } 946 978 … … 955 987 */ 956 988 $tabs = apply_filters( 'xprofile_filter_profile_group_tabs', $tabs, $groups, $group_name ); 957 foreach ( (array) $tabs as $tab ) 958 echo $tab; 959 960 /** 961 * Fires at the end of the tab output for switching between profile field groups. 962 * 963 * @since BuddyPress (1.0.0) 964 */ 965 do_action( 'xprofile_profile_group_tabs' ); 989 990 return join( '', $tabs ); 966 991 } 967 992
Note: See TracChangeset
for help on using the changeset viewer.