| @@ -307,17 +307,9 @@ | ||
| 307 | 307 | 'has_archive' => false, |
| 308 | 308 | 'query_var' => false, |
| 309 | 309 | 'can_export' => false, |
| 310 | 310 | 'rewrite' => false, |
| 311 | - 'capabilities' => array( | |
| 312 | - 'edit_post' => 'read', | |
| 313 | - 'edit_posts' => 'read', | |
| 314 | - 'edit_others_posts' => 'read', | |
| 315 | - 'publish_posts' => 'read', | |
| 316 | - 'read_post' => 'read', | |
| 317 | - 'read_private_posts' => 'read', | |
| 318 | - 'delete_post' => 'read', | |
| 319 | - ), | |
| 311 | + 'capabilities' => $this->get_admin_only_capabilities(), | |
| 320 | 312 | ); |
| 321 | 313 | |
| 322 | 314 | register_post_type( 'bulkpost', $args ); |
| 323 | 315 | |
| @@ -357,22 +349,39 @@ | ||
| 357 | 349 | 'has_archive' => false, |
| 358 | 350 | 'query_var' => false, |
| 359 | 351 | 'can_export' => false, |
| 360 | 352 | 'rewrite' => false, |
| 361 | - 'capabilities' => array( | |
| 362 | - 'edit_post' => 'read', | |
| 363 | - 'edit_posts' => 'read', | |
| 364 | - 'edit_others_posts' => 'read', | |
| 365 | - 'publish_posts' => 'read', | |
| 366 | - 'read_post' => 'read', | |
| 367 | - 'read_private_posts' => 'read', | |
| 368 | - 'delete_post' => 'read', | |
| 369 | - ), | |
| 353 | + 'capabilities' => $this->get_admin_only_capabilities(), | |
| 370 | 354 | ); |
| 371 | 355 | |
| 372 | 356 | register_post_type( 'bulkpage', $args ); |
| 373 | 357 | |
| 374 | 358 | do_action( 'mainwp_register_post_type' ); |
| 359 | + } | |
| 360 | + | |
| 361 | + /** | |
| 362 | + * Get admin-only capabilities for MainWP bulk content post types. | |
| 363 | + * | |
| 364 | + * @return array | |
| 365 | + */ | |
| 366 | + private function get_admin_only_capabilities() { | |
| 367 | + return array( | |
| 368 | + 'edit_post' => 'manage_options', | |
| 369 | + 'read_post' => 'manage_options', | |
| 370 | + 'delete_post' => 'manage_options', | |
| 371 | + 'edit_posts' => 'manage_options', | |
| 372 | + 'edit_others_posts' => 'manage_options', | |
| 373 | + 'delete_posts' => 'manage_options', | |
| 374 | + 'publish_posts' => 'manage_options', | |
| 375 | + 'read_private_posts' => 'manage_options', | |
| 376 | + 'read' => 'manage_options', | |
| 377 | + 'delete_private_posts' => 'manage_options', | |
| 378 | + 'delete_published_posts' => 'manage_options', | |
| 379 | + 'delete_others_posts' => 'manage_options', | |
| 380 | + 'edit_private_posts' => 'manage_options', | |
| 381 | + 'edit_published_posts' => 'manage_options', | |
| 382 | + 'create_posts' => 'manage_options', | |
| 383 | + ); | |
| 375 | 384 | } |
| 376 | 385 | |
| 377 | 386 | /** |
| 378 | 387 | * Method post_updated_messages() |