Skip to content

Instantly share code, notes, and snippets.

@imath

imath/1.01.patch Secret

Created Jul 3, 2015
Embed
What would you like to do?
bp-xprofile-field-for-member-types : first patch to get along with 5192.bp_xprofile_get_hidden_fields_for_user.patch one. see https://github.com/lmoffereins/bp-xprofile-field-for-member-types/issues/1 & https://buddypress.trac.wordpress.org/ticket/5192
diff --git bp-xprofile-field-for-member-types.php bp-xprofile-field-for-member-types.php
index 6926728..f062861 100644
--- bp-xprofile-field-for-member-types.php
+++ bp-xprofile-field-for-member-types.php
@@ -169,6 +169,18 @@ final class BP_XProfile_Field_For_Member_Types {
public function filter_hidden_fields( $hidden_fields, $displayed_user_id, $current_user_id ) {
global $wpdb, $bp;
+ $current_screen = false;
+
+ // get_current_screen() is only available in Admin
+ if ( is_admin() ) {
+ $current_screen = get_current_screen();
+ }
+
+ // Make sure all fields are listed within the xProfile fields administration screen
+ if ( isset( $current_screen->id ) && false !== strpos( $current_screen->id, 'users_page_bp-profile-setup' ) ) {
+ return $hidden_fields;
+ }
+
// Hidden = All - Visible for displayed user AND current user
$all_fields = array_map( 'intval', (array) $wpdb->get_col( "SELECT id FROM {$bp->profile->table_name_fields}" ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment