Extending wordpress-notification-bar to hide notification bar if user is logged in

So I needed a notification bar to warn users that they were not logged in. This plugin was useful but it didnt have an option to hide the bar for logged-in users. So I edited it to add this functionality:

diff -rupN wordpress-notification-bar/inc/class-plugin.php wordpress-notification-bar-patched/inc/class-plugin.php
--- wordpress-notification-bar/inc/class-plugin.php 2016-08-20 20:44:25.000000000 +0530
+++ wordpress-notification-bar-patched/inc/class-plugin.php 2016-08-20 20:42:23.000000000 +0530
@@ -30,6 +30,15 @@ class SeedProd_WordPress_Notification_Ba
}

function render_notification_bar($hook){
+ /* Code added by Joel G Mathew, to disable notification bar if user is logged in\
+
+ // We need to disable in this function.
+ // Dont show bar if user is logged in
+ if ( is_user_logged_in() ) {
+ return false;
+ }
+ */
+
global $seed_wnb;
$options = $seed_wnb->get_options();

You can patch with patch -1


You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.