Skip to content

Commit

Permalink
Version 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dartiss committed Feb 3, 2020
1 parent 4dfe777 commit b25fc54
Show file tree
Hide file tree
Showing 7 changed files with 238 additions and 198 deletions.
24 changes: 16 additions & 8 deletions includes/admin-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@

function adl_set_plugin_meta( $links, $file ) {

if ( strpos( $file, 'simple-draft-list.php' ) !== false ) { $links = array_merge( $links, array( '<a href="http://wordpress.org/support/plugin/simple-draft-list">' . __( 'Support', 'simple-draft-list' ) . '</a>' ) ); }
if ( strpos( $file, 'simple-draft-list.php' ) !== false ) {

$links = array_merge( $links, array( '<a href="https://github.com/dartiss/draft-list">' . __( 'Github', 'simple-draft-list' ) . '</a>' ) );

$links = array_merge( $links, array( '<a href="http://wordpress.org/support/plugin/simple-draft-list">' . __( 'Support', 'simple-draft-list' ) . '</a>' ) );

$links = array_merge( $links, array( '<a href="https://artiss.blog/donate">' . __( 'Donate', 'simple-draft-list' ) . '</a>' ) );

$links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/simple-draft-list/reviews/#new-post">' . __( 'Write a Review', 'simple-draft-list' ) . '&nbsp;⭐️⭐️⭐️⭐️⭐️</a>' ) );
}

return $links;
}
Expand All @@ -46,13 +55,13 @@ function adl_menu_initialise() {
$all_posts = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft'" );
if ( $all_posts > 0 ) {

add_submenu_page( 'edit.php', '', __( 'All Drafts <span class=\'update-plugins count-' . $all_posts . '\'><span class=\'plugin-count\'>' . $all_posts . '</span></span>', 'simple-draft-list' ), 'edit_posts', esc_url( 'edit.php?post_status=draft&post_type=post' ) );
add_submenu_page( 'edit.php', '', __( 'All Drafts <span class=\'update-plugins\'><span class=\'update-count\'>' . $all_posts . '</span></span>', 'simple-draft-list' ), 'edit_posts', esc_url( 'edit.php?post_status=draft&post_type=post' ) );

// Get total number of draft posts for current user. If more than zero add a sub-menu option

$your_posts = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author=" . $author );
if ( $your_posts > 0 && $your_posts != $all_posts ) {
add_submenu_page( 'edit.php', '', __( 'Your Drafts <span class=\'update-plugins count-' . $your_posts . '\'><span class=\'plugin-count\'>' . $your_posts . '</span></span>', 'simple-draft-list' ), 'edit_posts', esc_url( 'edit.php?post_status=draft&post_type=post&author=' . $author . '' ) );
if ( $your_posts > 0 && $your_posts !== $all_posts ) {
add_submenu_page( 'edit.php', '', __( 'My Drafts <span class=\'update-plugins\'><span class=\'update-count\'>' . $your_posts . '</span></span>', 'simple-draft-list' ), 'edit_posts', esc_url( 'edit.php?post_status=draft&post_type=post&author=' . $author . '' ) );
}
}

Expand All @@ -61,17 +70,16 @@ function adl_menu_initialise() {
$all_pages = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'draft'" );
if ( $all_pages > 0 ) {

add_submenu_page( 'edit.php?post_type=page', '', __( 'All Drafts <span class=\'update-plugins count-' . $all_page . '\'><span class=\'plugin-count\'>' . $all_pages . '</span></span>', 'simple-draft-list' ), 'edit_pages', esc_url( 'edit.php?post_status=draft&post_type=page' ) );
add_submenu_page( 'edit.php?post_type=page', '', __( 'All Drafts <span class=\'update-plugins\'><span class=\'update-count\'>' . $all_pages . '</span></span>', 'simple-draft-list' ), 'edit_pages', esc_url( 'edit.php?post_status=draft&post_type=page' ) );

// Get total number of draft pages for current user. If more than zero add a sub-menu option

$your_pages = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'draft' AND post_author=" . $author );
if ( $your_pages > 0 && $your_pages != $all_pages ) {
add_submenu_page( 'edit.php?post_type=page', '', __( 'Your Drafts <span class=\'update-plugins count-' . $your_pages . '\'><span class=\'plugin-count\'>' . $your_pages . '</span></span>', 'simple-draft-list' ), 'edit_pages', esc_url( 'edit.php?post_status=draft&post_type=page&author=' . $author . '' ) );
if ( $your_pages > 0 && $your_pages !== $all_pages ) {
add_submenu_page( 'edit.php?post_type=page', '', __( 'My Drafts <span class=\'update-plugins\'><span class=\'update-count\'>' . $your_pages . '</span></span>', 'simple-draft-list' ), 'edit_pages', esc_url( 'edit.php?post_status=draft&post_type=page&author=' . $author . '' ) );
}
}

}

add_action( 'admin_menu', 'adl_menu_initialise' );
?>
Loading

0 comments on commit b25fc54

Please sign in to comment.