BP_XProfile_Group: fetch_default_visibility_levels ()
获取所有字段的admin-set首选项。
描述
返回
(数组)$default_visibility_levels一个数组,以field_id为键,默认可见级别+ allow_custom(是否管理员允许用户设置该字段)
源
文件:bp-xprofile /类/ class-bp-xprofile-group.php
Public static function fetch_default_visibility_levels() {global $wpdb;$default_visibility_levels = wp_cache_get('default_visibility_levels', 'bp_xprofile');If (false === $default_visibility_levels) {$bp = buddypress();$levels = $wpdb->get_results("SELECT object_id, meta_key, meta_value FROM {$bp->profile->table_name_meta} WHERE object_type = 'field' AND (meta_key = 'default_visibility' OR meta_key = 'allow_custom_visibility')");//排列字段id为键值,可见性级别为值。数组$ default_visibility_levels = ();Foreach ($level as $level) {switch ($level->meta_key) {case 'default_visibility': $default_visibility [$level->object_id]['default'] = $level->meta_value;打破;Case 'allow_custom_visibility': $default_visibility_levels[$level->object_id]['allow_custom'] = $level->meta_value;打破; } } wp_cache_set( 'default_visibility_levels', $default_visibility_levels, 'bp_xprofile' ); } return $default_visibility_levels; }
更新日志
版本 | 描述 |
---|---|
BuddyPress 1.6.0 | 介绍了。 |