Changeset 3517 for trunk/wp-includes/capabilities.php
- Timestamp:
- 02/12/2006 07:53:23 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/capabilities.php
r3513 r3517 35 35 return $this->role_objects[$role]; 36 36 } 37 37 38 38 function remove_role($role) { 39 39 if ( ! isset($this->role_objects[$role]) ) 40 40 return; 41 41 42 42 unset($this->role_objects[$role]); 43 43 unset($this->role_names[$role]); 44 44 unset($this->roles[$role]); 45 45 46 46 update_option($this->role_key, $this->roles); 47 47 } … … 71 71 { 72 72 return isset($this->role_names[$role]); 73 } 73 } 74 74 } 75 75 … … 151 151 $this->get_role_caps(); 152 152 } 153 153 154 154 function get_role_caps() { 155 155 global $wp_roles; 156 156 157 157 if ( ! isset($wp_roles) ) 158 158 $wp_roles = new WP_Roles(); … … 170 170 $this->allcaps = array_merge($this->allcaps, $this->caps); 171 171 } 172 172 173 173 function add_role($role) { 174 174 $this->caps[$role] = true; … … 177 177 $this->update_user_level_from_caps(); 178 178 } 179 179 180 180 function remove_role($role) { 181 181 if ( empty($this->roles[$role]) || (count($this->roles) <= 1) ) … … 185 185 $this->get_role_caps(); 186 186 } 187 187 188 188 function set_role($role) { 189 189 foreach($this->roles as $oldrole) … … 204 204 } 205 205 } 206 206 207 207 function update_user_level_from_caps() { 208 208 global $table_prefix; … … 210 210 update_usermeta($this->id, $table_prefix.'user_level', $this->user_level); 211 211 } 212 212 213 213 function add_cap($cap, $grant = true) { 214 214 $this->caps[$cap] = $grant; … … 221 221 update_usermeta($this->id, $this->cap_key, $this->caps); 222 222 } 223 223 224 224 //has_cap(capability_or_role_name) or 225 225 //has_cap('edit_post', post_id) … … 227 227 if ( is_numeric($cap) ) 228 228 $cap = $this->translate_level_to_cap($cap); 229 229 230 230 $args = array_slice(func_get_args(), 1); 231 231 $args = array_merge(array($cap, $this->id), $args); … … 346 346 case 'read_post': 347 347 $post = get_post($args[0]); 348 348 349 349 if ( 'private' != $post->post_status ) { 350 350 $caps[] = 'read'; 351 break; 352 } 353 351 break; 352 } 353 354 354 $author_data = get_userdata($user_id); 355 355 $post_author_data = get_userdata($post->post_author);
Note: See TracChangeset
for help on using the changeset viewer.