populate_roles_160

Create the roles for WordPress 2.0.

Description

populate_roles_160(); 

Usage

  1. if ( !function_exists( 'populate_roles_160' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/schema.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = populate_roles_160(); 
  7.  

Defined (1)

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

/wp-admin/includes/schema.php  
  1. function populate_roles_160() { 
  2. // Add roles 
  3.  
  4. // Dummy gettext calls to get strings in the catalog. 
  5. /** translators: user role */ 
  6. _x('Administrator', 'User role'); 
  7. /** translators: user role */ 
  8. _x('Editor', 'User role'); 
  9. /** translators: user role */ 
  10. _x('Author', 'User role'); 
  11. /** translators: user role */ 
  12. _x('Contributor', 'User role'); 
  13. /** translators: user role */ 
  14. _x('Subscriber', 'User role'); 
  15.  
  16. add_role('administrator', 'Administrator'); 
  17. add_role('editor', 'Editor'); 
  18. add_role('author', 'Author'); 
  19. add_role('contributor', 'Contributor'); 
  20. add_role('subscriber', 'Subscriber'); 
  21.  
  22. // Add caps for Administrator role 
  23. $role = get_role('administrator'); 
  24. $role->add_cap('switch_themes'); 
  25. $role->add_cap('edit_themes'); 
  26. $role->add_cap('activate_plugins'); 
  27. $role->add_cap('edit_plugins'); 
  28. $role->add_cap('edit_users'); 
  29. $role->add_cap('edit_files'); 
  30. $role->add_cap('manage_options'); 
  31. $role->add_cap('moderate_comments'); 
  32. $role->add_cap('manage_categories'); 
  33. $role->add_cap('manage_links'); 
  34. $role->add_cap('upload_files'); 
  35. $role->add_cap('import'); 
  36. $role->add_cap('unfiltered_html'); 
  37. $role->add_cap('edit_posts'); 
  38. $role->add_cap('edit_others_posts'); 
  39. $role->add_cap('edit_published_posts'); 
  40. $role->add_cap('publish_posts'); 
  41. $role->add_cap('edit_pages'); 
  42. $role->add_cap('read'); 
  43. $role->add_cap('level_10'); 
  44. $role->add_cap('level_9'); 
  45. $role->add_cap('level_8'); 
  46. $role->add_cap('level_7'); 
  47. $role->add_cap('level_6'); 
  48. $role->add_cap('level_5'); 
  49. $role->add_cap('level_4'); 
  50. $role->add_cap('level_3'); 
  51. $role->add_cap('level_2'); 
  52. $role->add_cap('level_1'); 
  53. $role->add_cap('level_0'); 
  54.  
  55. // Add caps for Editor role 
  56. $role = get_role('editor'); 
  57. $role->add_cap('moderate_comments'); 
  58. $role->add_cap('manage_categories'); 
  59. $role->add_cap('manage_links'); 
  60. $role->add_cap('upload_files'); 
  61. $role->add_cap('unfiltered_html'); 
  62. $role->add_cap('edit_posts'); 
  63. $role->add_cap('edit_others_posts'); 
  64. $role->add_cap('edit_published_posts'); 
  65. $role->add_cap('publish_posts'); 
  66. $role->add_cap('edit_pages'); 
  67. $role->add_cap('read'); 
  68. $role->add_cap('level_7'); 
  69. $role->add_cap('level_6'); 
  70. $role->add_cap('level_5'); 
  71. $role->add_cap('level_4'); 
  72. $role->add_cap('level_3'); 
  73. $role->add_cap('level_2'); 
  74. $role->add_cap('level_1'); 
  75. $role->add_cap('level_0'); 
  76.  
  77. // Add caps for Author role 
  78. $role = get_role('author'); 
  79. $role->add_cap('upload_files'); 
  80. $role->add_cap('edit_posts'); 
  81. $role->add_cap('edit_published_posts'); 
  82. $role->add_cap('publish_posts'); 
  83. $role->add_cap('read'); 
  84. $role->add_cap('level_2'); 
  85. $role->add_cap('level_1'); 
  86. $role->add_cap('level_0'); 
  87.  
  88. // Add caps for Contributor role 
  89. $role = get_role('contributor'); 
  90. $role->add_cap('edit_posts'); 
  91. $role->add_cap('read'); 
  92. $role->add_cap('level_1'); 
  93. $role->add_cap('level_0'); 
  94.  
  95. // Add caps for Subscriber role 
  96. $role = get_role('subscriber'); 
  97. $role->add_cap('read'); 
  98. $role->add_cap('level_0');