Changeset 53436
- Timestamp:
- 05/23/2022 02:59:44 PM (3 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/capabilities.php
r53408 r53436 1021 1021 * @param bool[] $capabilities List of capabilities keyed by the capability name, 1022 1022 * e.g. array( 'edit_posts' => true, 'delete_posts' => false ). 1023 * @return WP_Role| null WP_Role object if role is added, null if already exists.1023 * @return WP_Role|void WP_Role object, if the role is added. 1024 1024 */ 1025 1025 function add_role( $role, $display_name, $capabilities = array() ) { … … 1027 1027 return; 1028 1028 } 1029 1029 1030 return wp_roles()->add_role( $role, $display_name, $capabilities ); 1030 1031 } -
trunk/src/wp-includes/class-wp-roles.php
r51518 r53436 74 74 75 75 /** 76 * Constructor 76 * Constructor. 77 77 * 78 78 * @since 2.0.0 … … 92 92 93 93 /** 94 * Make private/protected methods readable for backward compatibility.94 * Makes private/protected methods readable for backward compatibility. 95 95 * 96 96 * @since 4.0.0 … … 108 108 109 109 /** 110 * Set up the object properties.110 * Sets up the object properties. 111 111 * 112 112 * The role key is set to the current prefix for the $wpdb object with … … 124 124 125 125 /** 126 * Reinitialize the object126 * Reinitializes the object. 127 127 * 128 128 * Recreates the role objects. This is typically called only by switch_to_blog() … … 139 139 140 140 /** 141 * Add role name with capabilities tolist.141 * Adds a role name with capabilities to the list. 142 142 * 143 143 * Updates the list of roles, if the role doesn't already exist. 144 144 * 145 * The capabilities are defined in the following format `array( 'read' => true );`146 * To explicitly deny a role a capability youset the value for that capability to false.145 * The capabilities are defined in the following format: `array( 'read' => true )`. 146 * To explicitly deny the role a capability, set the value for that capability to false. 147 147 * 148 148 * @since 2.0.0 … … 150 150 * @param string $role Role name. 151 151 * @param string $display_name Role display name. 152 * @param bool[] $capabilities List of capabilities keyed by the capability name, 153 * e.g. array( 'edit_posts' => true, 'delete_posts' => false ). 154 * @return WP_Role|void WP_Role object, if role is added. 152 * @param bool[] $capabilities Optional. List of capabilities keyed by the capability name, 153 * e.g. `array( 'edit_posts' => true, 'delete_posts' => false )`. 154 * Default empty array. 155 * @return WP_Role|void WP_Role object, if the role is added. 155 156 */ 156 157 public function add_role( $role, $display_name, $capabilities = array() ) { … … 172 173 173 174 /** 174 * Remove role by name.175 * Removes a role by name. 175 176 * 176 177 * @since 2.0.0 … … 197 198 198 199 /** 199 * Add capability to role.200 * Adds a capability to role. 200 201 * 201 202 * @since 2.0.0 … … 218 219 219 220 /** 220 * Remove capability from role.221 * Removes a capability from role. 221 222 * 222 223 * @since 2.0.0 … … 237 238 238 239 /** 239 * Retrieve role object by name.240 * Retrieves a role object by name. 240 241 * 241 242 * @since 2.0.0 … … 253 254 254 255 /** 255 * Retrieve list of role names.256 * Retrieves a list of role names. 256 257 * 257 258 * @since 2.0.0 … … 264 265 265 266 /** 266 * Whetherrole name is currently in the list of available roles.267 * Determines whether a role name is currently in the list of available roles. 267 268 * 268 269 * @since 2.0.0 … … 293 294 294 295 /** 295 * After the roles have been initialized, allowplugins to add their own roles.296 * Fires after the roles have been initialized, allowing plugins to add their own roles. 296 297 * 297 298 * @since 4.7.0
Note: See TracChangeset
for help on using the changeset viewer.