bb_init_roles

Setup all default roles and associate them with capabilities.

Description

bb_init_roles( (BP_Roles) &$roles ); 

Parameters (1)

0. $roles (BP_Roles) => &$roles
Roles object to add default roles to

Usage

  1. if ( !function_exists( 'bb_init_roles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php'; 
  3.  
  4. // Roles object to add default roles to 
  5. $roles = &$roles; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_init_roles($roles); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-capabilities.php  
  1. function bb_init_roles( &$roles ) { 
  2. $roles->add_role( 'keymaster', __('Key Master'), array( 
  3. 'use_keys' => true, // Verb forms of roles - keymaster 
  4. 'administrate' => true, // administrator 
  5. 'moderate' => true, // moderator 
  6. 'participate' => true, // member 
  7.  
  8. 'keep_gate' => true, // Make new Key Masters //+ 
  9. 'import_export' => true, // Import and export data //+ 
  10. 'recount' => true, // bb-do-counts.php //+ 
  11. 'manage_options' => true, // backend //+ 
  12. 'manage_themes' => true, // Themes //+ 
  13. 'manage_plugins' => true, // Plugins //+ 
  14. 'manage_options' => true, // Options //+ 
  15. 'edit_users' => true,  
  16. 'manage_tags' => true, // Rename, Merge, Destroy 
  17. 'edit_others_favorites' => true,  
  18. 'manage_forums' => true, // Add/Rename forum 
  19. 'delete_forums' => true, // Delete forum 
  20. 'delete_topics' => true,  
  21. 'close_topics' => true,  
  22. 'stick_topics' => true,  
  23. 'move_topics' => true,  
  24. 'view_by_ip' => true, // view-ip.php 
  25. 'edit_closed' => true, // Edit closed topics 
  26. 'edit_deleted' => true, // Edit deleted topics/posts 
  27. 'browse_deleted' => true, // Use 'deleted' view 
  28. 'edit_others_tags' => true,  
  29. 'edit_others_topics' => true,  
  30. 'delete_posts' => true,  
  31. 'throttle' => true, // Post back to back arbitrarily quickly 
  32. 'ignore_edit_lock' => true,  
  33. 'edit_others_posts' => true,  
  34. 'edit_favorites' => true,  
  35. 'edit_tags' => true,  
  36. 'edit_topics' => true, // Edit title, resolution status 
  37. 'edit_posts' => true,  
  38. 'edit_profile' => true,  
  39. 'write_topics' => true,  
  40. 'write_posts' => true,  
  41. 'change_password' => true,  
  42. 'read' => true 
  43. ) ); 
  44.  
  45. $roles->add_role( 'administrator', __('Administrator'), array( 
  46. 'administrate' => true,  
  47. 'moderate' => true,  
  48. 'participate' => true,  
  49.  
  50. 'edit_users' => true, //+ 
  51. 'edit_others_favorites' => true, //+ 
  52. 'manage_forums' => true, //+ 
  53. 'delete_forums' => true, //+ 
  54. 'manage_tags' => true,  
  55. 'delete_topics' => true,  
  56. 'close_topics' => true,  
  57. 'stick_topics' => true,  
  58. 'move_topics' => true,  
  59. 'view_by_ip' => true,  
  60. 'edit_closed' => true,  
  61. 'edit_deleted' => true,  
  62. 'browse_deleted' => true,  
  63. 'edit_others_tags' => true,  
  64. 'edit_others_topics' => true,  
  65. 'delete_posts' => true,  
  66. 'throttle' => true,  
  67. 'ignore_edit_lock' => true,  
  68. 'edit_others_posts' => true,  
  69. 'edit_favorites' => true,  
  70. 'edit_tags' => true,  
  71. 'edit_topics' => true,  
  72. 'edit_posts' => true,  
  73. 'edit_profile' => true,  
  74. 'write_topics' => true,  
  75. 'write_posts' => true,  
  76. 'change_password' => true,  
  77. 'read' => true 
  78. ) ); 
  79.  
  80. $roles->add_role( 'moderator', __('Moderator'), array( 
  81. 'moderate' => true,  
  82. 'participate' => true,  
  83.  
  84. 'manage_tags' => true, //+ 
  85. 'delete_topics' => true, //+ 
  86. 'close_topics' => true, //+ 
  87. 'stick_topics' => true, //+ 
  88. 'move_topics' => true, //+ 
  89. 'view_by_ip' => true, //+ 
  90. 'edit_closed' => true, //+ 
  91. 'edit_deleted' => true, //+ 
  92. 'browse_deleted' => true, //+ 
  93. 'edit_others_tags' => true, //+ 
  94. 'edit_others_topics' => true, //+ 
  95. 'delete_posts' => true, //+ 
  96. 'throttle' => true, //+ 
  97. 'ignore_edit_lock' => true, //+ 
  98. 'edit_others_posts' => true, //+ 
  99. 'edit_favorites' => true,  
  100. 'edit_tags' => true,  
  101. 'edit_topics' => true,  
  102. 'edit_posts' => true,  
  103. 'edit_profile' => true,  
  104. 'write_topics' => true,  
  105. 'write_posts' => true,  
  106. 'change_password' => true,  
  107. 'read' => true 
  108. ) ); 
  109.  
  110.  
  111. $roles->add_role( 'member', __('Member'), array( 
  112. 'participate' => true,  
  113.  
  114. 'edit_favorites' => true,  
  115. 'edit_tags' => true,  
  116. 'edit_topics' => true,  
  117. 'edit_posts' => true,  
  118. 'edit_profile' => true,  
  119. 'write_topics' => true,  
  120. 'write_posts' => true,  
  121. 'change_password' => true,  
  122. 'read' => true 
  123. ) ); 
  124.  
  125. $roles->add_role( 'inactive', __('Inactive'), array( 
  126. 'change_password' => true,  
  127. 'read' => true 
  128. ) ); 
  129.  
  130. $roles->add_role( 'blocked', __('Blocked'), array( 
  131. 'not_play_nice' => true // Madness - a negative capability. Don't try this at home. 
  132. ) );