Changeset 7960
- Timestamp:
- 02/21/2014 11:08:04 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-template.php
r7926 r7960 1872 1872 } 1873 1873 1874 /** 1875 * Is this a user's profile settings? 1876 * 1877 * Eg http://example.com/members/joe/settings/profile/. 1878 * 1879 * @since BuddyPress (2.0.0) 1880 * 1881 * @return bool True if the current page is a user's Profile Settings page. 1882 */ 1883 function bp_is_user_settings_profile() { 1884 if ( bp_is_user_settings() && bp_is_current_action( 'profile' ) ) 1885 return true; 1886 1887 return false; 1888 } 1889 1874 1890 /** Groups ********************************************************************/ 1875 1891 -
trunk/bp-templates/bp-legacy/buddypress/members/single/settings.php
r6627 r7960 35 35 bp_get_template_part( 'members/single/settings/general' ); 36 36 break; 37 case 'profile' : 38 bp_get_template_part( 'members/single/settings/profile' ); 39 break; 37 40 default: 38 41 bp_get_template_part( 'members/single/plugins' ); -
trunk/bp-templates/bp-legacy/css/buddypress.css
r7952 r7960 895 895 #buddypress table.notifications, 896 896 #buddypress table.notifications-settings, 897 #buddypress table.profile-settings, 897 898 #buddypress table.profile-fields, 898 899 #buddypress table.wp-profile-fields, … … 903 904 #buddypress table.notifications thead tr, 904 905 #buddypress table.notifications-settings thead tr, 906 #buddypress table.profile-settings thead tr, 905 907 #buddypress table.profile-fields thead tr, 906 908 #buddypress table.wp-profile-fields thead tr, … … 928 930 #buddypress table.notifications tr td, 929 931 #buddypress table.notifications-settings tr td, 932 #buddypress table.profile-settings tr td, 930 933 #buddypress table.profile-fields tr td, 931 934 #buddypress table.wp-profile-fields tr td, … … 964 967 #buddypress table.notifications tr.alt td, 965 968 #buddypress table.notifications-settings tr.alt td, 969 #buddypress table.profile-settings tr.alt td, 966 970 #buddypress table.profile-fields tr.alt td, 967 971 #buddypress table.wp-profile-fields tr.alt td, … … 983 987 display: none; 984 988 } 985 #buddypress table.notification-settings th.title { 989 #buddypress table.notification-settings th.title, 990 #buddypress table.profile-settings th.title { 986 991 width: 80%; 987 992 } -
trunk/bp-themes/bp-default/_inc/css/default.css
r7133 r7960 1954 1954 background: #f5f5f5; 1955 1955 } 1956 table.notification-settings { 1956 table.notification-settings, 1957 table.profile-settings { 1957 1958 margin-bottom: 20px; 1958 1959 text-align: left; … … 1965 1966 display: none; 1966 1967 } 1967 table.notification-settings th.title { 1968 table.notification-settings th.title, 1969 table.profile-settings th.title { 1968 1970 width: 80%; 1969 1971 } -
trunk/bp-themes/bp-default/members/single/settings.php
r6627 r7960 31 31 locate_template( array( 'members/single/settings/general.php' ), true ); 32 32 33 elseif ( bp_is_current_action( 'profile' ) ) : 34 locate_template( array( 'members/single/settings/profile.php' ), true ); 35 33 36 else : 34 37 locate_template( array( 'members/single/plugins.php' ), true ); 35 38 36 39 endif; 37 38 ?> -
trunk/bp-xprofile/bp-xprofile-actions.php
r6291 r7960 44 44 } 45 45 add_action( 'bp_actions', 'xprofile_action_delete_avatar' ); 46 47 /** 48 * Handles the saving of xprofile field visibilities 49 * 50 * @since BuddyPress (1.9) 51 */ 52 function bp_xprofile_action_settings() { 53 54 // Bail if not a POST action 55 if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) { 56 return; 57 } 58 59 // Bail if no submit action 60 if ( ! isset( $_POST['xprofile-settings-submit'] ) ) { 61 return; 62 } 63 64 // Bail if not in settings 65 if ( ! bp_is_user_settings_profile() ) { 66 return; 67 } 68 69 // 404 if there are any additional action variables attached 70 if ( bp_action_variables() ) { 71 bp_do_404(); 72 return; 73 } 74 75 // Nonce check 76 check_admin_referer( 'bp_xprofile_settings' ); 77 78 do_action( 'bp_xprofile_settings_before_save' ); 79 80 /** Save ******************************************************************/ 81 82 // Only save if there are field ID's being posted 83 if ( ! empty( $_POST['field_ids'] ) ) { 84 85 // Get the POST'ed field ID's 86 $posted_field_ids = explode( ',', $_POST['field_ids'] ); 87 88 // Save the visibility settings 89 foreach ( $posted_field_ids as $field_id ) { 90 91 $visibility_level = 'public'; 92 93 if ( !empty( $_POST['field_' . $field_id . '_visibility'] ) ) { 94 $visibility_level = $_POST['field_' . $field_id . '_visibility']; 95 } 96 97 xprofile_set_field_visibility_level( $field_id, bp_displayed_user_id(), $visibility_level ); 98 } 99 } 100 101 /** Other *****************************************************************/ 102 103 do_action( 'bp_xprofile_settings_after_save' ); 104 105 // Redirect to the root domain 106 bp_core_redirect( bp_displayed_user_domain() . bp_get_settings_slug() . '/privacy' ); 107 } 108 add_action( 'bp_actions', 'bp_xprofile_action_settings' ); -
trunk/bp-xprofile/bp-xprofile-loader.php
r7862 r7960 60 60 'classes', 61 61 'filters', 62 'settings', 62 63 'template', 63 64 'buddybar', … … 220 221 } 221 222 223 // Privacy Settings 224 if ( bp_is_active( 'settings' ) ) { 225 226 // Get the settings slug 227 $settings_slug = bp_get_settings_slug(); 228 229 // Add the sub-navigation 230 $sub_nav[] = array( 231 'name' => __( 'Profile', 'buddypress' ), 232 'slug' => 'profile', 233 'parent_url' => trailingslashit( $user_domain . $settings_slug ), 234 'parent_slug' => $settings_slug, 235 'screen_function' => 'bp_xprofile_screen_settings', 236 'position' => 30, 237 'user_has_access' => bp_core_can_edit_settings() 238 ); 239 } 240 222 241 parent::setup_nav( $main_nav, $sub_nav ); 223 242 } … … 272 291 } 273 292 293 // Privacy Settings 294 if ( bp_is_active( 'settings' ) ) { 295 296 // Setup the logged in user variables 297 $settings_link = trailingslashit( bp_loggedin_user_domain() . bp_get_settings_slug() ); 298 299 // Add main Settings menu 300 $wp_admin_nav[] = array( 301 'parent' => 'my-account-' . $bp->settings->id, 302 'id' => 'my-account-' . $bp->settings->id . '-profile', 303 'title' => __( 'Profile', 'buddypress' ), 304 'href' => trailingslashit( $settings_link . 'profile' ) 305 ); 306 } 274 307 } 275 308 -
trunk/bp-xprofile/bp-xprofile-screens.php
r7889 r7960 209 209 bp_core_load_template( apply_filters( 'xprofile_template_change_avatar', 'members/single/home' ) ); 210 210 } 211 212 /** 213 * Show the xprofile settings template 214 * 215 * @since BuddyPress (2.0.0) 216 */ 217 function bp_xprofile_screen_settings() { 218 219 // Redirect if no privacy settings page is accessible 220 if ( bp_action_variables() || ! bp_is_active( 'xprofile' ) ) { 221 bp_do_404(); 222 return; 223 } 224 225 // Load the template 226 bp_core_load_template( apply_filters( 'bp_settings_screen_xprofile', '/members/single/plugin' ) ); 227 } -
trunk/bp-xprofile/bp-xprofile-template.php
r7914 r7960 937 937 } 938 938 939 /** Visibility ****************************************************************/ 940 939 941 /** 940 942 * Echo the field visibility radio buttons … … 963 965 return apply_filters( 'bp_profile_get_visibility_radio_buttons', $html ); 964 966 } 967 968 /** 969 * Output the XProfile field visibility select list for settings 970 * 971 * @since BuddyPress (2.0.0) 972 */ 973 function bp_xprofile_settings_visibility_select( $args = '' ) { 974 echo bp_xprofile_get_settings_visibility_select( $args ); 975 } 976 /** 977 * Return the XProfile field visibility select list for settings 978 * 979 * @since BuddyPress (2.0.0) 980 */ 981 function bp_xprofile_get_settings_visibility_select( $args = '' ) { 982 983 // Parse optional arguments 984 $r = bp_parse_args( $args, array( 985 'before' => '', 986 'after' => '', 987 'class' => 'bp-xprofile-visibility' 988 ), 'xprofile_settings_visibility_select' ); 989 990 // Start the output buffer 991 ob_start(); 992 993 // Anything before 994 echo $r['before']; ?> 995 996 <?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?> 997 998 <select class="<?php echo esc_attr( $r['class'] ); ?>" name="field_<?php bp_the_profile_field_id(); ?>_visibility"> 999 1000 <?php foreach ( bp_xprofile_get_visibility_levels() as $level ) : ?> 1001 1002 <option value="<?php echo esc_attr( $level['id'] ); ?>" <?php selected( $level['id'], bp_get_the_profile_field_visibility_level() ); ?>><?php echo esc_html( $level['label'] ); ?></option> 1003 1004 <?php endforeach; ?> 1005 1006 </select> 1007 1008 <?php else : ?> 1009 1010 <span class="field-visibility-settings-notoggle" title="<?php _e( "This field's visibility cannot be changed.", 'buddypress' ); ?>"><?php bp_the_profile_field_visibility_level_label(); ?></span> 1011 1012 <?php endif; 1013 1014 // Anything after 1015 echo $r['after']; 1016 1017 // Output the dropdown list 1018 return apply_filters( 'bp_xprofile_settings_visibility_select', ob_get_clean() ); 1019 }
Note: See TracChangeset
for help on using the changeset viewer.