Make WordPress Core


Ignore:
Timestamp:
09/20/2005 11:48:28 PM (18 years ago)
Author:
ryan
Message:

Spiffier role creation code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r2851 r2898  
    2323    }
    2424
    25     function add_role($role, $capabilities, $display_name) {
     25    function add_role($role, $display_name, $capabilities = '') {
     26        if ( isset($this->roles[$role]) )
     27            return;
     28
    2629        $this->roles[$role] = array('name' => $display_name,
    2730                                                                'capabilities' => $capabilities);
     
    4245    }
    4346
    44     function add_cap($role, $cap, $grant) {
     47    function add_cap($role, $cap, $grant = true) {
    4548        $this->roles[$role]['capabilities'][$cap] = $grant;
    4649        update_option($this->role_key, $this->roles);
     
    7881    }
    7982
    80     function add_cap($cap, $grant) {
     83    function add_cap($cap, $grant = true) {
    8184        global $wp_roles;
    8285
Note: See TracChangeset for help on using the changeset viewer.