mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * WordPress Administration Scheme API
mp-wp_genesis 4 *
mp-wp_genesis 5 * Here we keep the DB structure and option values.
mp-wp_genesis 6 *
mp-wp_genesis 7 * @package WordPress
mp-wp_genesis 8 * @subpackage Administration
mp-wp_genesis 9 */
mp-wp_genesis 10
mp-wp_genesis 11 /**
mp-wp_genesis 12 * The database character collate.
mp-wp_genesis 13 * @var string
mp-wp_genesis 14 * @global string
mp-wp_genesis 15 * @name $charset_collate
mp-wp_genesis 16 */
mp-wp_genesis 17 $charset_collate = '';
mp-wp_genesis 18
mp-wp_genesis 19 // Declare these as global in case schema.php is included from a function.
mp-wp_genesis 20 global $wpdb, $wp_queries;
mp-wp_genesis 21
mp-wp_genesis 22 if ( $wpdb->has_cap( 'collation' ) ) {
mp-wp_genesis 23 if ( ! empty($wpdb->charset) )
mp-wp_genesis 24 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
mp-wp_genesis 25 if ( ! empty($wpdb->collate) )
mp-wp_genesis 26 $charset_collate .= " COLLATE $wpdb->collate";
mp-wp_genesis 27 }
mp-wp_genesis 28
mp-wp_genesis 29 /** Create WordPress database tables SQL */
mp-wp_genesis 30 $wp_queries = "CREATE TABLE $wpdb->terms (
mp-wp_genesis 31 term_id bigint(20) NOT NULL auto_increment,
mp-wp_genesis 32 name varchar(200) NOT NULL default '',
mp-wp_genesis 33 slug varchar(200) NOT NULL default '',
mp-wp_genesis 34 term_group bigint(10) NOT NULL default 0,
mp-wp_genesis 35 PRIMARY KEY (term_id),
mp-wp_genesis 36 UNIQUE KEY slug (slug),
mp-wp_genesis 37 KEY name (name)
mp-wp_genesis 38 ) $charset_collate;
mp-wp_genesis 39 CREATE TABLE $wpdb->term_taxonomy (
mp-wp_genesis 40 term_taxonomy_id bigint(20) NOT NULL auto_increment,
mp-wp_genesis 41 term_id bigint(20) NOT NULL default 0,
mp-wp_genesis 42 taxonomy varchar(32) NOT NULL default '',
mp-wp_genesis 43 description longtext NOT NULL,
mp-wp_genesis 44 parent bigint(20) NOT NULL default 0,
mp-wp_genesis 45 count bigint(20) NOT NULL default 0,
mp-wp_genesis 46 PRIMARY KEY (term_taxonomy_id),
mp-wp_genesis 47 UNIQUE KEY term_id_taxonomy (term_id,taxonomy)
mp-wp_genesis 48 ) $charset_collate;
mp-wp_genesis 49 CREATE TABLE $wpdb->term_relationships (
mp-wp_genesis 50 object_id bigint(20) NOT NULL default 0,
mp-wp_genesis 51 term_taxonomy_id bigint(20) NOT NULL default 0,
mp-wp_genesis 52 term_order int(11) NOT NULL default 0,
mp-wp_genesis 53 PRIMARY KEY (object_id,term_taxonomy_id),
mp-wp_genesis 54 KEY term_taxonomy_id (term_taxonomy_id)
mp-wp_genesis 55 ) $charset_collate;
mp-wp_genesis 56 CREATE TABLE $wpdb->comments (
mp-wp_genesis 57 comment_ID bigint(20) unsigned NOT NULL auto_increment,
mp-wp_genesis 58 comment_post_ID int(11) NOT NULL default '0',
mp-wp_genesis 59 comment_author tinytext NOT NULL,
mp-wp_genesis 60 comment_author_email varchar(100) NOT NULL default '',
mp-wp_genesis 61 comment_author_url varchar(200) NOT NULL default '',
mp-wp_genesis 62 comment_author_IP varchar(100) NOT NULL default '',
mp-wp_genesis 63 comment_date datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 64 comment_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 65 comment_content text NOT NULL,
mp-wp_genesis 66 comment_karma int(11) NOT NULL default '0',
mp-wp_genesis 67 comment_approved varchar(20) NOT NULL default '1',
mp-wp_genesis 68 comment_agent varchar(255) NOT NULL default '',
mp-wp_genesis 69 comment_type varchar(20) NOT NULL default '',
mp-wp_genesis 70 comment_parent bigint(20) NOT NULL default '0',
mp-wp_genesis 71 user_id bigint(20) NOT NULL default '0',
mp-wp_genesis 72 PRIMARY KEY (comment_ID),
mp-wp_genesis 73 KEY comment_approved (comment_approved),
mp-wp_genesis 74 KEY comment_post_ID (comment_post_ID),
mp-wp_genesis 75 KEY comment_approved_date_gmt (comment_approved,comment_date_gmt),
mp-wp_genesis 76 KEY comment_date_gmt (comment_date_gmt)
mp-wp_genesis 77 ) $charset_collate;
mp-wp_genesis 78 CREATE TABLE $wpdb->links (
mp-wp_genesis 79 link_id bigint(20) NOT NULL auto_increment,
mp-wp_genesis 80 link_url varchar(255) NOT NULL default '',
mp-wp_genesis 81 link_name varchar(255) NOT NULL default '',
mp-wp_genesis 82 link_image varchar(255) NOT NULL default '',
mp-wp_genesis 83 link_target varchar(25) NOT NULL default '',
mp-wp_genesis 84 link_category bigint(20) NOT NULL default '0',
mp-wp_genesis 85 link_description varchar(255) NOT NULL default '',
mp-wp_genesis 86 link_visible varchar(20) NOT NULL default 'Y',
mp-wp_genesis 87 link_owner int(11) NOT NULL default '1',
mp-wp_genesis 88 link_rating int(11) NOT NULL default '0',
mp-wp_genesis 89 link_updated datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 90 link_rel varchar(255) NOT NULL default '',
mp-wp_genesis 91 link_notes mediumtext NOT NULL,
mp-wp_genesis 92 link_rss varchar(255) NOT NULL default '',
mp-wp_genesis 93 PRIMARY KEY (link_id),
mp-wp_genesis 94 KEY link_category (link_category),
mp-wp_genesis 95 KEY link_visible (link_visible)
mp-wp_genesis 96 ) $charset_collate;
mp-wp_genesis 97 CREATE TABLE $wpdb->options (
mp-wp_genesis 98 option_id bigint(20) NOT NULL auto_increment,
mp-wp_genesis 99 blog_id int(11) NOT NULL default '0',
mp-wp_genesis 100 option_name varchar(64) NOT NULL default '',
mp-wp_genesis 101 option_value longtext NOT NULL,
mp-wp_genesis 102 autoload varchar(20) NOT NULL default 'yes',
mp-wp_genesis 103 PRIMARY KEY (option_id,blog_id,option_name),
mp-wp_genesis 104 KEY option_name (option_name)
mp-wp_genesis 105 ) $charset_collate;
mp-wp_genesis 106 CREATE TABLE $wpdb->postmeta (
mp-wp_genesis 107 meta_id bigint(20) NOT NULL auto_increment,
mp-wp_genesis 108 post_id bigint(20) NOT NULL default '0',
mp-wp_genesis 109 meta_key varchar(255) default NULL,
mp-wp_genesis 110 meta_value longtext,
mp-wp_genesis 111 PRIMARY KEY (meta_id),
mp-wp_genesis 112 KEY post_id (post_id),
mp-wp_genesis 113 KEY meta_key (meta_key)
mp-wp_genesis 114 ) $charset_collate;
mp-wp_genesis 115 CREATE TABLE $wpdb->posts (
mp-wp_genesis 116 ID bigint(20) unsigned NOT NULL auto_increment,
mp-wp_genesis 117 post_author bigint(20) NOT NULL default '0',
mp-wp_genesis 118 post_date datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 119 post_date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 120 post_content longtext NOT NULL,
mp-wp_genesis 121 post_title text NOT NULL,
mp-wp_genesis 122 post_category int(4) NOT NULL default '0',
mp-wp_genesis 123 post_excerpt text NOT NULL,
mp-wp_genesis 124 post_status varchar(20) NOT NULL default 'publish',
mp-wp_genesis 125 comment_status varchar(20) NOT NULL default 'open',
mp-wp_genesis 126 ping_status varchar(20) NOT NULL default 'open',
mp-wp_genesis 127 post_password varchar(20) NOT NULL default '',
mp-wp_genesis 128 post_name varchar(200) NOT NULL default '',
mp-wp_genesis 129 to_ping text NOT NULL,
mp-wp_genesis 130 pinged text NOT NULL,
mp-wp_genesis 131 post_modified datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 132 post_modified_gmt datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 133 post_content_filtered text NOT NULL,
mp-wp_genesis 134 post_parent bigint(20) NOT NULL default '0',
mp-wp_genesis 135 guid varchar(255) NOT NULL default '',
mp-wp_genesis 136 menu_order int(11) NOT NULL default '0',
mp-wp_genesis 137 post_type varchar(20) NOT NULL default 'post',
mp-wp_genesis 138 post_mime_type varchar(100) NOT NULL default '',
mp-wp_genesis 139 comment_count bigint(20) NOT NULL default '0',
mp-wp_genesis 140 PRIMARY KEY (ID),
mp-wp_genesis 141 KEY post_name (post_name),
mp-wp_genesis 142 KEY type_status_date (post_type,post_status,post_date,ID),
mp-wp_genesis 143 KEY post_parent (post_parent)
mp-wp_genesis 144 ) $charset_collate;
mp-wp_genesis 145 CREATE TABLE $wpdb->users (
mp-wp_genesis 146 ID bigint(20) unsigned NOT NULL auto_increment,
mp-wp_genesis 147 user_login varchar(60) NOT NULL default '',
mp-wp_genesis 148 user_pass varchar(64) NOT NULL default '',
mp-wp_genesis 149 user_nicename varchar(50) NOT NULL default '',
mp-wp_genesis 150 user_email varchar(100) NOT NULL default '',
mp-wp_genesis 151 user_url varchar(100) NOT NULL default '',
mp-wp_genesis 152 user_registered datetime NOT NULL default '0000-00-00 00:00:00',
mp-wp_genesis 153 user_activation_key varchar(60) NOT NULL default '',
mp-wp_genesis 154 user_status int(11) NOT NULL default '0',
mp-wp_genesis 155 display_name varchar(250) NOT NULL default '',
mp-wp_genesis 156 PRIMARY KEY (ID),
mp-wp_genesis 157 KEY user_login_key (user_login),
mp-wp_genesis 158 KEY user_nicename (user_nicename)
mp-wp_genesis 159 ) $charset_collate;
mp-wp_genesis 160 CREATE TABLE $wpdb->usermeta (
mp-wp_genesis 161 umeta_id bigint(20) NOT NULL auto_increment,
mp-wp_genesis 162 user_id bigint(20) NOT NULL default '0',
mp-wp_genesis 163 meta_key varchar(255) default NULL,
mp-wp_genesis 164 meta_value longtext,
mp-wp_genesis 165 PRIMARY KEY (umeta_id),
mp-wp_genesis 166 KEY user_id (user_id),
mp-wp_genesis 167 KEY meta_key (meta_key)
mp-wp_genesis 168 ) $charset_collate;";
mp-wp_genesis 169
mp-wp_genesis 170 /**
mp-wp_genesis 171 * Create WordPress options and set the default values.
mp-wp_genesis 172 *
mp-wp_genesis 173 * @since 1.5.0
mp-wp_genesis 174 * @uses $wpdb
mp-wp_genesis 175 * @uses $wp_db_version
mp-wp_genesis 176 */
mp-wp_genesis 177 function populate_options() {
mp-wp_genesis 178 global $wpdb, $wp_db_version;
mp-wp_genesis 179
mp-wp_genesis 180 $guessurl = wp_guess_url();
mp-wp_genesis 181
mp-wp_genesis 182 do_action('populate_options');
mp-wp_genesis 183
mp-wp_genesis 184 add_option('siteurl', $guessurl);
mp-wp_genesis 185 add_option('blogname', __('My Blog'));
mp-wp_genesis 186 add_option('blogdescription', __('Just another WordPress weblog'));
mp-wp_genesis 187 add_option('users_can_register', 0);
mp-wp_genesis 188 add_option('admin_email', 'you@example.com');
mp-wp_genesis 189 add_option('start_of_week', 1);
mp-wp_genesis 190 add_option('use_balanceTags', 0);
mp-wp_genesis 191 add_option('use_smilies', 1);
mp-wp_genesis 192 add_option('require_name_email', 1);
mp-wp_genesis 193 add_option('comments_notify', 1);
mp-wp_genesis 194 add_option('posts_per_rss', 10);
mp-wp_genesis 195 add_option('rss_excerpt_length', 50);
mp-wp_genesis 196 add_option('rss_use_excerpt', 0);
mp-wp_genesis 197 add_option('default_category', 1);
mp-wp_genesis 198 add_option('default_comment_status', 'open');
mp-wp_genesis 199 add_option('default_ping_status', 'open');
mp-wp_genesis 200 add_option('default_pingback_flag', 1);
mp-wp_genesis 201 add_option('default_post_edit_rows', 10);
mp-wp_genesis 202 add_option('posts_per_page', 10);
mp-wp_genesis 203 add_option('what_to_show', 'posts');
mp-wp_genesis 204 add_option('date_format', __('F j, Y'));
mp-wp_genesis 205 add_option('time_format', __('g:i a'));
mp-wp_genesis 206 add_option('links_updated_date_format', __('F j, Y g:i a'));
mp-wp_genesis 207 add_option('links_recently_updated_prepend', '<em>');
mp-wp_genesis 208 add_option('links_recently_updated_append', '</em>');
mp-wp_genesis 209 add_option('links_recently_updated_time', 120);
mp-wp_genesis 210 add_option('comment_moderation', 0);
mp-wp_genesis 211 add_option('moderation_notify', 1);
mp-wp_genesis 212 add_option('permalink_structure');
mp-wp_genesis 213 add_option('gzipcompression', 0);
mp-wp_genesis 214 add_option('hack_file', 0);
mp-wp_genesis 215 add_option('blog_charset', 'UTF-8');
mp-wp_genesis 216 add_option('moderation_keys');
mp-wp_genesis 217 add_option('active_plugins');
mp-wp_genesis 218 add_option('home', $guessurl);
mp-wp_genesis 219 // in case it is set, but blank, update "home"
mp-wp_genesis 220 if ( !__get_option('home') ) update_option('home', $guessurl);
mp-wp_genesis 221 add_option('category_base');
mp-wp_genesis 222 add_option('ping_sites', 'http://rpc.pingomatic.com/');
mp-wp_genesis 223 add_option('advanced_edit', 0);
mp-wp_genesis 224 add_option('comment_max_links', 2);
mp-wp_genesis 225 add_option('gmt_offset', date('Z') / 3600);
mp-wp_genesis 226 // 1.5
mp-wp_genesis 227 add_option('default_email_category', 1);
mp-wp_genesis 228 add_option('recently_edited');
mp-wp_genesis 229 add_option('use_linksupdate', 0);
mp-wp_genesis 230 add_option('template', 'default');
mp-wp_genesis 231 add_option('stylesheet', 'default');
mp-wp_genesis 232 add_option('comment_whitelist', 1);
mp-wp_genesis 233 add_option('page_uris');
mp-wp_genesis 234 add_option('blacklist_keys');
mp-wp_genesis 235 add_option('comment_registration', 0);
mp-wp_genesis 236 add_option('rss_language', 'en');
mp-wp_genesis 237 add_option('html_type', 'text/html');
mp-wp_genesis 238 // 1.5.1
mp-wp_genesis 239 add_option('use_trackback', 0);
mp-wp_genesis 240 // 2.0
mp-wp_genesis 241 add_option('default_role', 'subscriber');
mp-wp_genesis 242 add_option('db_version', $wp_db_version);
mp-wp_genesis 243 // 2.0.1
mp-wp_genesis 244 if ( ini_get('safe_mode') ) {
mp-wp_genesis 245 // Safe mode screws up mkdir(), so we must use a flat structure.
mp-wp_genesis 246 add_option('uploads_use_yearmonth_folders', 0);
mp-wp_genesis 247 add_option('upload_path', WP_CONTENT_DIR);
mp-wp_genesis 248 } else {
mp-wp_genesis 249 add_option('uploads_use_yearmonth_folders', 1);
mp-wp_genesis 250 add_option('upload_path', WP_CONTENT_DIR . '/uploads');
mp-wp_genesis 251 }
mp-wp_genesis 252
mp-wp_genesis 253 // 2.0.3
mp-wp_genesis 254 add_option('secret', wp_generate_password(64));
mp-wp_genesis 255
mp-wp_genesis 256 // 2.1
mp-wp_genesis 257 add_option('blog_public', '1');
mp-wp_genesis 258 add_option('default_link_category', 2);
mp-wp_genesis 259 add_option('show_on_front', 'posts');
mp-wp_genesis 260
mp-wp_genesis 261 // 2.2
mp-wp_genesis 262 add_option('tag_base');
mp-wp_genesis 263
mp-wp_genesis 264 // 2.5
mp-wp_genesis 265 add_option('show_avatars', '1');
mp-wp_genesis 266 add_option('avatar_rating', 'G');
mp-wp_genesis 267 add_option('upload_url_path', '');
mp-wp_genesis 268 add_option('thumbnail_size_w', 150);
mp-wp_genesis 269 add_option('thumbnail_size_h', 150);
mp-wp_genesis 270 add_option('thumbnail_crop', 1);
mp-wp_genesis 271 add_option('medium_size_w', 300);
mp-wp_genesis 272 add_option('medium_size_h', 300);
mp-wp_genesis 273
mp-wp_genesis 274 // 2.6
mp-wp_genesis 275 add_option('avatar_default', 'mystery');
mp-wp_genesis 276 add_option('enable_app', 0);
mp-wp_genesis 277 add_option('enable_xmlrpc', 0);
mp-wp_genesis 278
mp-wp_genesis 279 // 2.7
mp-wp_genesis 280 add_option('large_size_w', 1024);
mp-wp_genesis 281 add_option('large_size_h', 1024);
mp-wp_genesis 282 add_option('image_default_link_type', 'file');
mp-wp_genesis 283 add_option('image_default_size', '');
mp-wp_genesis 284 add_option('image_default_align', '');
mp-wp_genesis 285 add_option('close_comments_for_old_posts', 0);
mp-wp_genesis 286 add_option('close_comments_days_old', 14);
mp-wp_genesis 287 add_option('thread_comments', 0);
mp-wp_genesis 288 add_option('thread_comments_depth', 5);
mp-wp_genesis 289 add_option('page_comments', 1);
mp-wp_genesis 290 add_option('comments_per_page', 50);
mp-wp_genesis 291 add_option('default_comments_page', 'newest');
mp-wp_genesis 292 add_option('comment_order', 'asc');
mp-wp_genesis 293 add_option('use_ssl', 0);
mp-wp_genesis 294 add_option('sticky_posts', array());
mp-wp_genesis 295 add_option('widget_categories', array());
mp-wp_genesis 296 add_option('widget_text', array());
mp-wp_genesis 297 add_option('widget_rss', array());
mp-wp_genesis 298 add_option('update_core', array());
mp-wp_genesis 299 add_option('dismissed_update_core', array());
mp-wp_genesis 300
mp-wp_genesis 301 // Delete unused options
mp-wp_genesis 302 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
mp-wp_genesis 303 foreach ($unusedoptions as $option) :
mp-wp_genesis 304 delete_option($option);
mp-wp_genesis 305 endforeach;
mp-wp_genesis 306
mp-wp_genesis 307 // Set up a few options not to load by default
mp-wp_genesis 308 $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' );
mp-wp_genesis 309 foreach ($fatoptions as $fatoption) :
mp-wp_genesis 310 $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'");
mp-wp_genesis 311 endforeach;
mp-wp_genesis 312 }
mp-wp_genesis 313
mp-wp_genesis 314 /**
mp-wp_genesis 315 * Execute WordPress role creation for the various WordPress versions.
mp-wp_genesis 316 *
mp-wp_genesis 317 * @since 2.0.0
mp-wp_genesis 318 */
mp-wp_genesis 319 function populate_roles() {
mp-wp_genesis 320 populate_roles_160();
mp-wp_genesis 321 populate_roles_210();
mp-wp_genesis 322 populate_roles_230();
mp-wp_genesis 323 populate_roles_250();
mp-wp_genesis 324 populate_roles_260();
mp-wp_genesis 325 populate_roles_270();
mp-wp_genesis 326 }
mp-wp_genesis 327
mp-wp_genesis 328 /**
mp-wp_genesis 329 * Create the roles for WordPress 2.0
mp-wp_genesis 330 *
mp-wp_genesis 331 * @since 2.0.0
mp-wp_genesis 332 */
mp-wp_genesis 333 function populate_roles_160() {
mp-wp_genesis 334 // Add roles
mp-wp_genesis 335
mp-wp_genesis 336 // Dummy gettext calls to get strings in the catalog.
mp-wp_genesis 337 _c('Administrator|User role');
mp-wp_genesis 338 _c('Editor|User role');
mp-wp_genesis 339 _c('Author|User role');
mp-wp_genesis 340 _c('Contributor|User role');
mp-wp_genesis 341 _c('Subscriber|User role');
mp-wp_genesis 342
mp-wp_genesis 343 add_role('administrator', 'Administrator|User role');
mp-wp_genesis 344 add_role('editor', 'Editor|User role');
mp-wp_genesis 345 add_role('author', 'Author|User role');
mp-wp_genesis 346 add_role('contributor', 'Contributor|User role');
mp-wp_genesis 347 add_role('subscriber', 'Subscriber|User role');
mp-wp_genesis 348
mp-wp_genesis 349 // Add caps for Administrator role
mp-wp_genesis 350 $role = get_role('administrator');
mp-wp_genesis 351 $role->add_cap('switch_themes');
mp-wp_genesis 352 $role->add_cap('edit_themes');
mp-wp_genesis 353 $role->add_cap('activate_plugins');
mp-wp_genesis 354 $role->add_cap('edit_plugins');
mp-wp_genesis 355 $role->add_cap('edit_users');
mp-wp_genesis 356 $role->add_cap('edit_files');
mp-wp_genesis 357 $role->add_cap('manage_options');
mp-wp_genesis 358 $role->add_cap('moderate_comments');
mp-wp_genesis 359 $role->add_cap('manage_categories');
mp-wp_genesis 360 $role->add_cap('manage_links');
mp-wp_genesis 361 $role->add_cap('upload_files');
mp-wp_genesis 362 $role->add_cap('import');
mp-wp_genesis 363 $role->add_cap('unfiltered_html');
mp-wp_genesis 364 $role->add_cap('edit_posts');
mp-wp_genesis 365 $role->add_cap('edit_others_posts');
mp-wp_genesis 366 $role->add_cap('edit_published_posts');
mp-wp_genesis 367 $role->add_cap('publish_posts');
mp-wp_genesis 368 $role->add_cap('edit_pages');
mp-wp_genesis 369 $role->add_cap('read');
mp-wp_genesis 370 $role->add_cap('level_10');
mp-wp_genesis 371 $role->add_cap('level_9');
mp-wp_genesis 372 $role->add_cap('level_8');
mp-wp_genesis 373 $role->add_cap('level_7');
mp-wp_genesis 374 $role->add_cap('level_6');
mp-wp_genesis 375 $role->add_cap('level_5');
mp-wp_genesis 376 $role->add_cap('level_4');
mp-wp_genesis 377 $role->add_cap('level_3');
mp-wp_genesis 378 $role->add_cap('level_2');
mp-wp_genesis 379 $role->add_cap('level_1');
mp-wp_genesis 380 $role->add_cap('level_0');
mp-wp_genesis 381
mp-wp_genesis 382 // Add caps for Editor role
mp-wp_genesis 383 $role = get_role('editor');
mp-wp_genesis 384 $role->add_cap('moderate_comments');
mp-wp_genesis 385 $role->add_cap('manage_categories');
mp-wp_genesis 386 $role->add_cap('manage_links');
mp-wp_genesis 387 $role->add_cap('upload_files');
mp-wp_genesis 388 $role->add_cap('unfiltered_html');
mp-wp_genesis 389 $role->add_cap('edit_posts');
mp-wp_genesis 390 $role->add_cap('edit_others_posts');
mp-wp_genesis 391 $role->add_cap('edit_published_posts');
mp-wp_genesis 392 $role->add_cap('publish_posts');
mp-wp_genesis 393 $role->add_cap('edit_pages');
mp-wp_genesis 394 $role->add_cap('read');
mp-wp_genesis 395 $role->add_cap('level_7');
mp-wp_genesis 396 $role->add_cap('level_6');
mp-wp_genesis 397 $role->add_cap('level_5');
mp-wp_genesis 398 $role->add_cap('level_4');
mp-wp_genesis 399 $role->add_cap('level_3');
mp-wp_genesis 400 $role->add_cap('level_2');
mp-wp_genesis 401 $role->add_cap('level_1');
mp-wp_genesis 402 $role->add_cap('level_0');
mp-wp_genesis 403
mp-wp_genesis 404 // Add caps for Author role
mp-wp_genesis 405 $role = get_role('author');
mp-wp_genesis 406 $role->add_cap('upload_files');
mp-wp_genesis 407 $role->add_cap('edit_posts');
mp-wp_genesis 408 $role->add_cap('edit_published_posts');
mp-wp_genesis 409 $role->add_cap('publish_posts');
mp-wp_genesis 410 $role->add_cap('read');
mp-wp_genesis 411 $role->add_cap('level_2');
mp-wp_genesis 412 $role->add_cap('level_1');
mp-wp_genesis 413 $role->add_cap('level_0');
mp-wp_genesis 414
mp-wp_genesis 415 // Add caps for Contributor role
mp-wp_genesis 416 $role = get_role('contributor');
mp-wp_genesis 417 $role->add_cap('edit_posts');
mp-wp_genesis 418 $role->add_cap('read');
mp-wp_genesis 419 $role->add_cap('level_1');
mp-wp_genesis 420 $role->add_cap('level_0');
mp-wp_genesis 421
mp-wp_genesis 422 // Add caps for Subscriber role
mp-wp_genesis 423 $role = get_role('subscriber');
mp-wp_genesis 424 $role->add_cap('read');
mp-wp_genesis 425 $role->add_cap('level_0');
mp-wp_genesis 426 }
mp-wp_genesis 427
mp-wp_genesis 428 /**
mp-wp_genesis 429 * Create and modify WordPress roles for WordPress 2.1.
mp-wp_genesis 430 *
mp-wp_genesis 431 * @since 2.1.0
mp-wp_genesis 432 */
mp-wp_genesis 433 function populate_roles_210() {
mp-wp_genesis 434 $roles = array('administrator', 'editor');
mp-wp_genesis 435 foreach ($roles as $role) {
mp-wp_genesis 436 $role = get_role($role);
mp-wp_genesis 437 if ( empty($role) )
mp-wp_genesis 438 continue;
mp-wp_genesis 439
mp-wp_genesis 440 $role->add_cap('edit_others_pages');
mp-wp_genesis 441 $role->add_cap('edit_published_pages');
mp-wp_genesis 442 $role->add_cap('publish_pages');
mp-wp_genesis 443 $role->add_cap('delete_pages');
mp-wp_genesis 444 $role->add_cap('delete_others_pages');
mp-wp_genesis 445 $role->add_cap('delete_published_pages');
mp-wp_genesis 446 $role->add_cap('delete_posts');
mp-wp_genesis 447 $role->add_cap('delete_others_posts');
mp-wp_genesis 448 $role->add_cap('delete_published_posts');
mp-wp_genesis 449 $role->add_cap('delete_private_posts');
mp-wp_genesis 450 $role->add_cap('edit_private_posts');
mp-wp_genesis 451 $role->add_cap('read_private_posts');
mp-wp_genesis 452 $role->add_cap('delete_private_pages');
mp-wp_genesis 453 $role->add_cap('edit_private_pages');
mp-wp_genesis 454 $role->add_cap('read_private_pages');
mp-wp_genesis 455 }
mp-wp_genesis 456
mp-wp_genesis 457 $role = get_role('administrator');
mp-wp_genesis 458 if ( ! empty($role) ) {
mp-wp_genesis 459 $role->add_cap('delete_users');
mp-wp_genesis 460 $role->add_cap('create_users');
mp-wp_genesis 461 }
mp-wp_genesis 462
mp-wp_genesis 463 $role = get_role('author');
mp-wp_genesis 464 if ( ! empty($role) ) {
mp-wp_genesis 465 $role->add_cap('delete_posts');
mp-wp_genesis 466 $role->add_cap('delete_published_posts');
mp-wp_genesis 467 }
mp-wp_genesis 468
mp-wp_genesis 469 $role = get_role('contributor');
mp-wp_genesis 470 if ( ! empty($role) ) {
mp-wp_genesis 471 $role->add_cap('delete_posts');
mp-wp_genesis 472 }
mp-wp_genesis 473 }
mp-wp_genesis 474
mp-wp_genesis 475 /**
mp-wp_genesis 476 * Create and modify WordPress roles for WordPress 2.3.
mp-wp_genesis 477 *
mp-wp_genesis 478 * @since 2.3.0
mp-wp_genesis 479 */
mp-wp_genesis 480 function populate_roles_230() {
mp-wp_genesis 481 $role = get_role( 'administrator' );
mp-wp_genesis 482
mp-wp_genesis 483 if ( !empty( $role ) ) {
mp-wp_genesis 484 $role->add_cap( 'unfiltered_upload' );
mp-wp_genesis 485 }
mp-wp_genesis 486 }
mp-wp_genesis 487
mp-wp_genesis 488 /**
mp-wp_genesis 489 * Create and modify WordPress roles for WordPress 2.5.
mp-wp_genesis 490 *
mp-wp_genesis 491 * @since 2.5.0
mp-wp_genesis 492 */
mp-wp_genesis 493 function populate_roles_250() {
mp-wp_genesis 494 $role = get_role( 'administrator' );
mp-wp_genesis 495
mp-wp_genesis 496 if ( !empty( $role ) ) {
mp-wp_genesis 497 $role->add_cap( 'edit_dashboard' );
mp-wp_genesis 498 }
mp-wp_genesis 499 }
mp-wp_genesis 500
mp-wp_genesis 501 /**
mp-wp_genesis 502 * Create and modify WordPress roles for WordPress 2.6.
mp-wp_genesis 503 *
mp-wp_genesis 504 * @since 2.6.0
mp-wp_genesis 505 */
mp-wp_genesis 506 function populate_roles_260() {
mp-wp_genesis 507 $role = get_role( 'administrator' );
mp-wp_genesis 508
mp-wp_genesis 509 if ( !empty( $role ) ) {
mp-wp_genesis 510 $role->add_cap( 'update_plugins' );
mp-wp_genesis 511 $role->add_cap( 'delete_plugins' );
mp-wp_genesis 512 }
mp-wp_genesis 513 }
mp-wp_genesis 514
mp-wp_genesis 515 /**
mp-wp_genesis 516 * Create and modify WordPress roles for WordPress 2.7.
mp-wp_genesis 517 *
mp-wp_genesis 518 * @since 2.7.0
mp-wp_genesis 519 */
mp-wp_genesis 520 function populate_roles_270() {
mp-wp_genesis 521 $role = get_role( 'administrator' );
mp-wp_genesis 522
mp-wp_genesis 523 if ( !empty( $role ) ) {
mp-wp_genesis 524 $role->add_cap( 'install_plugins' );
mp-wp_genesis 525 $role->add_cap( 'update_themes' );
mp-wp_genesis 526 }
mp-wp_genesis 527 }
mp-wp_genesis 528
mp-wp_genesis 529 ?>