Changeset 4236
- Timestamp:
- 10/09/2012 06:52:38 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bbp-admin/bbp-users.php
r4222 r4236 48 48 49 49 // Admin styles 50 add_action( 'admin_head', 50 add_action( 'admin_head', array( $this, 'admin_head' ) ); 51 51 52 52 // User profile edit/display actions 53 add_action( 'edit_user_profile', array( $this, 'user_profile_forums' ) ); 54 55 // User profile save actions 56 add_action( 'edit_user_profile_update', array( $this, 'user_profile_update' ) ); 53 add_action( 'edit_user_profile', array( $this, 'user_profile_forums' ) ); 57 54 58 55 // Noop WordPress additional caps output area … … 70 67 * @uses sanitize_html_class() To sanitize the classes 71 68 */ 72 public function admin_head() { 69 public function admin_head() { 73 70 ?> 74 71 … … 80 77 vertical-align: top; 81 78 } 82 79 83 80 div.bbp-user-capabilities h4 { 84 81 margin: 0 0 10px; 85 82 } 86 83 87 84 p.bbp-default-caps-wrapper { 88 85 clear: both; … … 100 97 * @since bbPress (r2464) 101 98 * 102 * @param $user_id The user id103 * @uses do_action() Calls 'bbp_user_profile_update'104 * @return bool Always false105 */106 public function user_profile_update( $user_id ) {107 108 // Bail if no user109 if ( empty( $user_id ) )110 return;111 112 // Either reset caps for role113 if ( ! empty( $_POST['bbp-default-caps'] ) ) {114 bbp_reset_user_caps( $user_id );115 116 // Or set caps individually117 } else {118 bbp_save_user_caps( $user_id );119 }120 }121 122 /**123 * Responsible for saving additional profile options and settings124 *125 * @since bbPress (r2464)126 *127 99 * @param WP_User $profileuser User data 128 100 * @uses do_action() Calls 'bbp_user_profile_forums' 129 101 * @return bool Always false 130 102 */ 131 public function user_profile_forums( $profileuser ) { 103 public function user_profile_forums( $profileuser ) { 132 104 133 105 // Bail if current user cannot edit users -
trunk/bbp-includes/bbp-core-actions.php
r4223 r4236 39 39 * near the bottom of this file. 40 40 * 41 * v--WordPress Actions v--bbPress Sub-actions 42 */ 43 add_action( 'plugins_loaded', 'bbp_loaded', 10 ); 44 add_action( 'init', 'bbp_init', 0 ); // Early for bbp_register 45 add_action( 'parse_query', 'bbp_parse_query', 2 ); // Early for overrides 46 add_action( 'widgets_init', 'bbp_widgets_init', 10 ); 47 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 ); 48 add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 ); 49 add_action( 'wp_head', 'bbp_head', 10 ); 50 add_action( 'wp_footer', 'bbp_footer', 10 ); 51 add_action( 'set_current_user', 'bbp_setup_current_user', 10 ); 52 add_action( 'setup_theme', 'bbp_setup_theme', 10 ); 53 add_action( 'after_setup_theme', 'bbp_after_setup_theme', 10 ); 54 add_action( 'template_redirect', 'bbp_template_redirect', 10 ); 55 add_action( 'login_form_login', 'bbp_login_form_login', 10 ); 41 * v--WordPress Actions v--bbPress Sub-actions 42 */ 43 add_action( 'plugins_loaded', 'bbp_loaded', 10 ); 44 add_action( 'init', 'bbp_init', 0 ); // Early for bbp_register 45 add_action( 'parse_query', 'bbp_parse_query', 2 ); // Early for overrides 46 add_action( 'widgets_init', 'bbp_widgets_init', 10 ); 47 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 ); 48 add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 ); 49 add_action( 'wp_head', 'bbp_head', 10 ); 50 add_action( 'wp_footer', 'bbp_footer', 10 ); 51 add_action( 'set_current_user', 'bbp_setup_current_user', 10 ); 52 add_action( 'setup_theme', 'bbp_setup_theme', 10 ); 53 add_action( 'after_setup_theme', 'bbp_after_setup_theme', 10 ); 54 add_action( 'template_redirect', 'bbp_template_redirect', 10 ); 55 add_action( 'login_form_login', 'bbp_login_form_login', 10 ); 56 add_action( 'edit_user_profile_update', 'bbp_edit_user_profile_update', 10 ); 56 57 57 58 /** … … 221 222 222 223 // User status 224 // @todo make these sub-actions 223 225 add_action( 'make_ham_user', 'bbp_make_ham_user' ); 224 226 add_action( 'make_spam_user', 'bbp_make_spam_user' ); 227 228 // User capabilities 229 add_action( 'bbp_edit_user_profile_update', 'bbp_edit_user_profile_update_capabilities' ); 225 230 226 231 // Caches … … 236 241 * 237 242 * 1. Form submission within a theme (new and edit) 238 * 2. Accessing private or hidden forums243 * 2. Accessing private or hidden content (forums/topics/replies) 239 244 * 3. Editing forums, topics, replies, users, and tags 240 245 */ -
trunk/bbp-includes/bbp-core-caps.php
r4222 r4236 875 875 return false; 876 876 877 // Bail if not a member of this blog878 if ( ! user_can( $user_id, 'read') )877 // Bail if current user cannot edit this user 878 if ( ! current_user_can( 'edit_user', $user_id ) ) 879 879 return false; 880 880 … … 914 914 return false; 915 915 916 // Bail if not a member of this blog917 if ( ! user_can( $user_id, 'read') )916 // Bail if current user cannot edit this user 917 if ( ! current_user_can( 'edit_user', $user_id ) ) 918 918 return false; 919 919 … … 938 938 // Success 939 939 return true; 940 } 941 942 /** 943 * Helper function hooked to 'bbp_edit_user_profile_update' action to save or update 944 * user roles and capabilities. 945 * 946 * @since bbPress (r4235) 947 * 948 * @param int $user_id 949 * @uses bbp_reset_user_caps() to reset caps 950 * @usse bbp_save_user_caps() to save caps 951 */ 952 function bbp_edit_user_profile_update_capabilities( $user_id = 0 ) { 953 954 // Bail if no user ID was passed 955 if ( empty( $user_id ) ) 956 return; 957 958 // Either reset caps for role 959 if ( ! empty( $_POST['bbp-default-caps'] ) ) { 960 bbp_reset_user_caps( $user_id ); 961 962 // Or set caps individually 963 } else { 964 bbp_save_user_caps( $user_id ); 965 } 940 966 } 941 967 -
trunk/bbp-includes/bbp-core-dependency.php
r4223 r4236 233 233 function bbp_login_form_login() { 234 234 do_action( 'bbp_login_form_login' ); 235 } 236 237 /** User Actions **************************************************************/ 238 239 /** 240 * The main action for hooking into a user saving their profile 241 * 242 * @since bbPress (r4235) 243 * @param int $user_id ID of user being edited 244 * @uses do_action() Calls 'bbp_edit_user_profile_update' 245 */ 246 function bbp_edit_user_profile_update( $user_id = 0 ) { 247 do_action( 'bbp_edit_user_profile_update', $user_id ); 235 248 } 236 249 -
trunk/bbp-includes/bbp-user-functions.php
r4228 r4236 934 934 $edit_user = edit_user( $user_id ); 935 935 936 // Either reset caps for role937 if ( ! empty( $_POST['bbp-default-caps'] ) ) {938 bbp_reset_user_caps( $user_id );939 940 // Or set caps individually941 } else {942 bbp_save_user_caps( $user_id );943 }944 945 936 // Error(s) editng the user, so copy them into the global 946 937 if ( is_wp_error( $edit_user ) ) {
Note: See TracChangeset
for help on using the changeset viewer.