From b61e3a02555077ac2204c70af6185e32688fe74e Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 28 Dec 2017 08:44:14 -0500 Subject: [PATCH] Check if user can edit posts first. For showing ticketing system link in admin. --- lib/Ticketing.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/Ticketing.php b/lib/Ticketing.php index 34d6a95..fb4d2fc 100644 --- a/lib/Ticketing.php +++ b/lib/Ticketing.php @@ -1,14 +1,16 @@ 'eventmanagement', - 'title' => 'Ticketing System', - 'href' => 'https://tickets.saultstemarie.com/admin/', - 'meta' => array( - 'class' => 'eventmanagement', - 'title' => 'Ticketing System', - 'target' => '_blank' - ) - ); - $wp_admin_bar->add_node( $args ); + if ( current_user_can( 'edit_posts' ) ) { + $args = array( + 'id' => 'eventmanagement', + 'title' => 'Ticketing System', + 'href' => 'https://tickets.saultstemarie.com/admin/', + 'meta' => array( + 'class' => 'eventmanagement', + 'title' => 'Ticketing System', + 'target' => '_blank' + ) + ); + $wp_admin_bar->add_node( $args ); + } }, 999 ); -- 2.17.1