Changeset 4046
- Timestamp:
- 07/02/2012 07:06:30 AM (13 years ago)
- Location:
- branches/plugin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-admin/bbp-functions.php
r3966 r4046 21 21 22 22 // Prevent duplicate separators when no new menu items exist 23 if ( !current_user_can( 'edit_ replies' ) )23 if ( !current_user_can( 'edit_forums' ) && !current_user_can( 'edit_topics' ) && !current_user_can( 'edit_replies' ) ) 24 24 return; 25 25 … … 41 41 * @return bool Always true 42 42 */ 43 function bbp_admin_custom_menu_order( $menu_order ) {44 if ( !current_user_can( 'edit_ replies' ) )43 function bbp_admin_custom_menu_order( $menu_order = false ) { 44 if ( !current_user_can( 'edit_forums' ) && !current_user_can( 'edit_topics' ) && !current_user_can( 'edit_replies' ) ) 45 45 return $menu_order; 46 46 … … 59 59 function bbp_admin_menu_order( $menu_order ) { 60 60 61 // Bail if user cannot see any top level bbPress menus 62 if ( empty( $menu_order ) || ( !current_user_can( 'edit_forums' ) && !current_user_can( 'edit_topics' ) && !current_user_can( 'edit_replies' ) ) ) 63 return $menu_order; 64 61 65 // Initialize our custom order array 62 66 $bbp_menu_order = array(); 63 67 64 // Get the index of our custom separator 65 $bbp_separator = array_search( 'separator-bbpress', $menu_order ); 66 67 // Forums 68 if ( current_user_can( 'edit_forums' ) ) { 69 $top_menu_type = bbp_get_forum_post_type(); 70 71 // Topics 72 } elseif ( current_user_can( 'edit_topics' ) ) { 73 $top_menu_type = bbp_get_topic_post_type(); 74 75 // Replies 76 } elseif ( current_user_can( 'edit_replies' ) ) { 77 $top_menu_type = bbp_get_reply_post_type(); 78 79 // Bail if there are no bbPress menus present 80 } else { 81 return; 82 } 68 // Menu values 69 $second_sep = 'separator2'; 70 $custom_menus = array( 71 'separator-bbpress', // Separator 72 'edit.php?post_type=' . bbp_get_forum_post_type(), // Forums 73 'edit.php?post_type=' . bbp_get_topic_post_type(), // Topics 74 'edit.php?post_type=' . bbp_get_reply_post_type() // Replies 75 ); 83 76 84 77 // Loop through menu order and do some rearranging 85 foreach ( $menu_order as $index => $item ) { 86 87 // Current item is ours, so set our separator here 88 if ( ( ( 'edit.php?post_type=' . $top_menu_type ) == $item ) ) { 89 $bbp_menu_order[] = 'separator-bbpress'; 90 unset( $menu_order[$bbp_separator] ); 91 } 92 93 // Skip our separator 94 if ( !in_array( $item, array( 'separator-bbpress' ) ) ) { 78 foreach ( $menu_order as $item ) { 79 80 // Position bbPress menus above appearance 81 if ( $second_sep == $item ) { 82 83 // Add our custom menus 84 foreach( $custom_menus as $custom_menu ) { 85 if ( array_search( $custom_menu, $menu_order ) ) { 86 $bbp_menu_order[] = $custom_menu; 87 } 88 } 89 90 // Add the appearance separator 91 $bbp_menu_order[] = $second_sep; 92 93 // Skip our menu items 94 } elseif ( ! in_array( $item, $custom_menus ) ) { 95 95 $bbp_menu_order[] = $item; 96 96 } -
branches/plugin/bbpress.php
r4043 r4046 513 513 'capabilities' => bbp_get_forum_caps(), 514 514 'capability_type' => array( 'forum', 'forums' ), 515 'menu_position' => 5 6,515 'menu_position' => 555555, 516 516 'has_archive' => bbp_get_root_slug(), 517 517 'exclude_from_search' => true, … … 570 570 'capabilities' => bbp_get_topic_caps(), 571 571 'capability_type' => array( 'topic', 'topics' ), 572 'menu_position' => 5 7,572 'menu_position' => 555555, 573 573 'has_archive' => bbp_get_topic_archive_slug(), 574 574 'exclude_from_search' => true, … … 627 627 'capabilities' => bbp_get_reply_caps(), 628 628 'capability_type' => array( 'reply', 'replies' ), 629 'menu_position' => 5 8,629 'menu_position' => 555555, 630 630 'exclude_from_search' => true, 631 631 'has_archive' => false,
Note: See TracChangeset
for help on using the changeset viewer.