Changeset 1669

Show
Ignore:
Timestamp:
08/27/08 18:51:57 (3 months ago)
Author:
mdawaffe
Message:

Conform to new BP_Roles init. [BP121]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bb-includes/capabilities.php

    r1541 r1669  
    2424} 
    2525 
    26 function bb_get_roles( $roles ) { 
    27         $new_roles = array( 
    28                 'keymaster' => array( 'name' => __('Key Master'), 'capabilities' => array( 
    29                         'use_keys' => true,                                     // Verb forms of roles - keymaster 
    30                         'administrate' => true,                         // administrator 
    31                         'moderate' => true,                             // moderator 
    32                         'participate' => true,                          // member 
    33  
    34                         'keep_gate' => true,                            // Make new Key Masters         //+ 
    35                         'import_export' => true,                        // Import and export data       //+ 
    36                         'recount' => true,                                      // bb-do-counts.php                     //+ 
    37                         'manage_options' => true,                       // backend                                      //+ 
    38                         'manage_themes' => true,                        // Themes                                       //+ 
    39                         'manage_plugins' => true,                       // Plugins                                      //+ 
    40                         'manage_options' => true,                       // Options                                      //+ 
    41                         'edit_users' => true, 
    42                         'manage_tags' => true,                          // Rename, Merge, Destroy 
    43                         'edit_others_favorites' => true, 
    44                         'manage_forums' => true,                        // Add/Rename forum 
    45                         'delete_forums' => true,                        // Delete forum 
    46                         'delete_topics' => true, 
    47                         'close_topics' => true, 
    48                         'stick_topics' => true, 
    49                         'move_topics' => true, 
    50                         'view_by_ip' => true,                           // view-ip.php 
    51                         'edit_closed' => true,                          // Edit closed topics 
    52                         'edit_deleted' => true,                         // Edit deleted topics/posts 
    53                         'browse_deleted' => true,                       // Use 'deleted' view 
    54                         'edit_others_tags' => true, 
    55                         'edit_others_topics' => true, 
    56                         'delete_posts' => true, 
    57                         'throttle' => true,                                     // Post back to back arbitrarily quickly 
    58                         'ignore_edit_lock' => true, 
    59                         'edit_others_posts' => true, 
    60                         'edit_favorites' => true, 
    61                         'edit_tags' => true, 
    62                         'edit_topics' => true,                          // Edit title, resolution status 
    63                         'edit_posts' => true, 
    64                         'edit_profile' => true, 
    65                         'write_topics' => true, 
    66                         'write_posts' => true, 
    67                         'change_password' => true, 
    68                         'read' => true 
    69                 ) ), 
    70  
    71                 'administrator' => array( 'name' => __('Administrator'), 'capabilities' => array( 
    72                         'administrate' => true, 
    73                         'moderate' => true, 
    74                         'participate' => true, 
    75  
    76                         'edit_users' => true,                           //+ 
    77                         'edit_others_favorites' => true,        //+ 
    78                         'manage_forums' => true,                        //+ 
    79                         'delete_forums' => true,                        //+ 
    80                         'manage_tags' => true, 
    81                         'delete_topics' => true, 
    82                         'close_topics' => true, 
    83                         'stick_topics' => true, 
    84                         'move_topics' => true, 
    85                         'view_by_ip' => true, 
    86                         'edit_closed' => true, 
    87                         'edit_deleted' => true, 
    88                         'browse_deleted' => true, 
    89                         'edit_others_tags' => true, 
    90                         'edit_others_topics' => true, 
    91                         'delete_posts' => true, 
    92                         'throttle' => true, 
    93                         'ignore_edit_lock' => true, 
    94                         'edit_others_posts' => true, 
    95                         'edit_favorites' => true, 
    96                         'edit_tags' => true, 
    97                         'edit_topics' => true, 
    98                         'edit_posts' => true, 
    99                         'edit_profile' => true, 
    100                         'write_topics' => true, 
    101                         'write_posts' => true, 
    102                         'change_password' => true, 
    103                         'read' => true 
    104                 ) ), 
    105  
    106                 'moderator' => array( 'name' => __('Moderator'), 'capabilities' => array( 
    107                         'moderate' => true, 
    108                         'participate' => true, 
    109                         'manage_tags' => true,                  //+ 
    110                         'delete_topics' => true,                //+ 
    111                         'close_topics' => true,                 //+ 
    112                         'stick_topics' => true,                 //+ 
    113                         'move_topics' => true,                  //+ 
    114                         'view_by_ip' => true,                   //+ 
    115                         'edit_closed' => true,                  //+ 
    116                         'edit_deleted' => true,                 //+ 
    117                         'browse_deleted' => true,               //+ 
    118                         'edit_others_tags' => true,             //+ 
    119                         'edit_others_topics' => true,   //+ 
    120                         'delete_posts' => true,                 //+ 
    121                         'throttle' => true,                             //+ 
    122                         'ignore_edit_lock' => true,             //+ 
    123                         'edit_others_posts' => true,    //+ 
    124                         'edit_favorites' => true, 
    125                         'edit_tags' => true, 
    126                         'edit_topics' => true, 
    127                         'edit_posts' => true, 
    128                         'edit_profile' => true, 
    129                         'write_topics' => true, 
    130                         'write_posts' => true, 
    131                         'change_password' => true, 
    132                         'read' => true 
    133                 ) ), 
    134  
    135                 'member' => array( 'name' => __('Member'), 'capabilities' => array( 
    136                         'participate' => true, 
    137                         'edit_favorites' => true, 
    138                         'edit_tags' => true, 
    139                         'edit_topics' => true, 
    140                         'edit_posts' => true, 
    141                         'edit_profile' => true, 
    142                         'write_topics' => true, 
    143                         'write_posts' => true, 
    144                         'change_password' => true, 
    145                         'read' => true 
    146                 ) ), 
    147  
    148                 'inactive' => array( 'name' => __('Inactive'), 'capabilities' => array( 
    149                         'change_password' => true, 
    150                         'read' => true 
    151                 ) ), 
    152  
    153                 'blocked' => array( 'name' => __('Blocked'), 'capabilities' => array( 
    154                         'not_play_nice' => true 
    155                 ) ) 
    156         ); 
    157         return array_merge( $roles, $new_roles ); 
     26function bb_init_roles( &$roles ) { 
     27        $roles->add_role( 'keymaster', __('Key Master'), array( 
     28                'use_keys' => true,                     // Verb forms of roles - keymaster 
     29                'administrate' => true,                 // administrator 
     30                'moderate' => true,                     // moderator 
     31                'participate' => true,                  // member 
     32 
     33                'keep_gate' => true,                    // Make new Key Masters         //+ 
     34                'import_export' => true,                // Import and export data       //+ 
     35                'recount' => true,                      // bb-do-counts.php             //+ 
     36                'manage_options' => true,               // backend                      //+ 
     37                'manage_themes' => true,                // Themes                       //+ 
     38                'manage_plugins' => true,               // Plugins                      //+ 
     39                'manage_options' => true,               // Options                      //+ 
     40                'edit_users' => true, 
     41                'manage_tags' => true,                  // Rename, Merge, Destroy 
     42                'edit_others_favorites' => true, 
     43                'manage_forums' => true,                // Add/Rename forum 
     44                'delete_forums' => true,                // Delete forum 
     45                'delete_topics' => true, 
     46                'close_topics' => true, 
     47                'stick_topics' => true, 
     48                'move_topics' => true, 
     49                'view_by_ip' => true,                   // view-ip.php 
     50                'edit_closed' => true,                  // Edit closed topics 
     51                'edit_deleted' => true,                 // Edit deleted topics/posts 
     52                'browse_deleted' => true,               // Use 'deleted' view 
     53                'edit_others_tags' => true, 
     54                'edit_others_topics' => true, 
     55                'delete_posts' => true, 
     56                'throttle' => true,                     // Post back to back arbitrarily quickly 
     57                'ignore_edit_lock' => true, 
     58                'edit_others_posts' => true, 
     59                'edit_favorites' => true, 
     60                'edit_tags' => true, 
     61                'edit_topics' => true,                  // Edit title, resolution status 
     62                'edit_posts' => true, 
     63                'edit_profile' => true, 
     64                'write_topics' => true, 
     65                'write_posts' => true, 
     66                'change_password' => true, 
     67                'read' => true 
     68        ) ); 
     69 
     70        $roles->add_role( 'administrator', __('Administrator'), array( 
     71                'administrate' => true, 
     72                'moderate' => true, 
     73                'participate' => true, 
     74 
     75                'edit_users' => true,                   //+ 
     76                'edit_others_favorites' => true,        //+ 
     77                'manage_forums' => true,                //+ 
     78                'delete_forums' => true,                //+ 
     79                'manage_tags' => true, 
     80                'delete_topics' => true, 
     81                'close_topics' => true, 
     82                'stick_topics' => true, 
     83                'move_topics' => true, 
     84                'view_by_ip' => true, 
     85                'edit_closed' => true, 
     86                'edit_deleted' => true, 
     87                'browse_deleted' => true, 
     88                'edit_others_tags' => true, 
     89                'edit_others_topics' => true, 
     90                'delete_posts' => true, 
     91                'throttle' => true, 
     92                'ignore_edit_lock' => true, 
     93                'edit_others_posts' => true, 
     94                'edit_favorites' => true, 
     95                'edit_tags' => true, 
     96                'edit_topics' => true, 
     97                'edit_posts' => true, 
     98                'edit_profile' => true, 
     99                'write_topics' => true, 
     100                'write_posts' => true, 
     101                'change_password' => true, 
     102                'read' => true 
     103        ) ); 
     104 
     105 
     106        $roles->add_role( 'moderator', __('Moderator'), array( 
     107                'moderate' => true, 
     108                'participate' => true, 
     109 
     110                'manage_tags' => true,          //+ 
     111                'delete_topics' => true,        //+ 
     112                'close_topics' => true,         //+ 
     113                'stick_topics' => true,         //+ 
     114                'move_topics' => true,          //+ 
     115                'view_by_ip' => true,           //+ 
     116                'edit_closed' => true,          //+ 
     117                'edit_deleted' => true,         //+ 
     118                'browse_deleted' => true,       //+ 
     119                'edit_others_tags' => true,     //+ 
     120                'edit_others_topics' => true,   //+ 
     121                'delete_posts' => true,         //+ 
     122                'throttle' => true,             //+ 
     123                'ignore_edit_lock' => true,     //+ 
     124                'edit_others_posts' => true,    //+ 
     125                'edit_favorites' => true, 
     126                'edit_tags' => true, 
     127                'edit_topics' => true, 
     128                'edit_posts' => true, 
     129                'edit_profile' => true, 
     130                'write_topics' => true, 
     131                'write_posts' => true, 
     132                'change_password' => true, 
     133                'read' => true 
     134        ) ); 
     135 
     136 
     137        $roles->add_role( 'member', __('Member'), array( 
     138                'participate' => true, 
     139 
     140                'edit_favorites' => true, 
     141                'edit_tags' => true, 
     142                'edit_topics' => true, 
     143                'edit_posts' => true, 
     144                'edit_profile' => true, 
     145                'write_topics' => true, 
     146                'write_posts' => true, 
     147                'change_password' => true, 
     148                'read' => true 
     149        ) ); 
     150 
     151 
     152        $roles->add_role( 'inactive', __('Inactive'), array( 
     153                'change_password' => true, 
     154                'read' => true 
     155        ) ); 
     156 
     157        $roles->add_role( 'blocked', __('Blocked'), array( 
     158                'not_play_nice' => true // Madness - a negative capability.  Don't try this at home. 
     159        ) ); 
    158160} 
    159161 
  • trunk/bb-includes/default-filters.php

    r1575 r1669  
    9999} 
    100100 
    101 add_filter( 'get_roles', 'bb_get_roles' ); 
     101add_filter( 'init_roles', 'bb_init_roles' ); 
    102102add_filter( 'map_meta_cap', 'bb_map_meta_cap', 1, 4 ); 
    103103