paperweight Posted June 21, 2016 Share Posted June 21, 2016 What info is supposed to show in the Notifications area in the top-right of the Six Template? For example, when the admin responds to a client support ticket, is there supposed to be a notice there? I tested it and there shows nothing. How do we engage the Notifications to make use of it to show info to users? 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 21, 2016 Share Posted June 21, 2016 A notification will show I believe if an invoice is unpaid a notification will show if the client has any credit 0 Quote Link to comment Share on other sites More sharing options...
paperweight Posted June 21, 2016 Author Share Posted June 21, 2016 Thank you for your feedback. So only for invoice and credit... is there any way to hook in Support Ticket responses or Network Announcements? I searched google and on WHMCS but I cannot find the page that lists more details about the notifications area. Is there a dedicated information location for this that I can read more about? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 21, 2016 Share Posted June 21, 2016 Thank you for your feedback. So only for invoice and credit... is there any way to hook in Support Ticket responses or Network Announcements? I searched google and on WHMCS but I cannot find the page that lists more details about the notifications area. Is there a dedicated information location for this that I can read more about? you can add your own customized notifications messages using ActionHook function as always 0 Quote Link to comment Share on other sites More sharing options...
paperweight Posted June 21, 2016 Author Share Posted June 21, 2016 you can add your own customized notifications messages using ActionHook function as always Ok I created a hook like this and it showed fine: use WHMCS\User\Alert; add_hook('ClientAlert', 1, function($client) { $firstName = $client->firstName; $lastName = $client->lastName; return new Alert( "This is a test notification for you!!", 'info' //see http://getbootstrap.com/components/#alerts ); }); But then how do I check if there is a network announcement and then link to that announcement? Or how would I check if there is a support ticket reply and link to that reply? I see function($client) and tried some variables on that but they generated errors. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted June 21, 2016 Share Posted June 21, 2016 This function will query database and get the latest announcement added in notification <?php use WHMCS\User\Alert; use Illuminate\Database\Capsule\Manager as Capsule; add_hook('ClientAlert', 1, function($client) { $getLatestAnnouncement = Capsule::table('tblannouncements')->orderBy('id', "desc")->take(1)->get(); foreach ($getLatestAnnouncement as $item){ return new Alert( "<a href='announcements.php?id=".$item->id."'>".$item->title."</a>", "info" ); } }); 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 21, 2016 Share Posted June 21, 2016 Hmm, not so sure you want to put a network announcement in there. The 'notifications' area isn't really terribly 'noticable' . It's good for things likecredit, invoices, etc, but if you want something like a network announcement, or downtime, etc, you probably want to use bootstrap's 'alert' which would stand out a good deal more instead of the notification dropdown. I mean, this will get your attention far better than a number would! 0 Quote Link to comment Share on other sites More sharing options...
paperweight Posted June 22, 2016 Author Share Posted June 22, 2016 Hmm, not so sure you want to put a network announcement in there. The 'notifications' area isn't really terribly 'noticable' . It's good for things likecredit, invoices, etc, but if you want something like a network announcement, or downtime, etc, you probably want to use bootstrap's 'alert' which would stand out a good deal more instead of the notification dropdown. I mean, this will get your attention far better than a number would! Agreed~ @sentq thank you for the code! I am tweaking it and it's a good start! 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted August 17, 2016 Share Posted August 17, 2016 (edited) Thanks for the code! I've been able to hack it to show network issues as well, adding this code below: <?php use WHMCS\User\Alert; use Illuminate\Database\Capsule\Manager as Capsule; add_hook('ClientAlert', 1, function($client) { $getLatestNetworkIssue = Capsule::table('tblnetworkissues')->orderBy('id', "desc")->take(1)->get(); foreach ($getLatestNetworkIssue as $item){ if ($item->status !="Resolved") { return new Alert( "<a href='serverstatus.php'>".$item->title."</a>", "danger" ); } } }); However, the support is very limited, I haven't been able to make the "severity" work, and the link and link text can't be supplied. Anyway, what I would really like to do is to show alerts on the homepage, and not notifications. I can't find a way to do it, nor a commercial addon that does it. Edited August 17, 2016 by stormy modified the code to not display resolved network issues 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 17, 2016 Share Posted August 17, 2016 when you say 'alerts on the homepage', do you mean inside a homepage panel, or some other way ? 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted August 17, 2016 Share Posted August 17, 2016 when you say 'alerts on the homepage', do you mean inside a homepage panel, or some other way ? Plain old bootstrap alert box in the top of clientareahome. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 17, 2016 Share Posted August 17, 2016 http://forum.whmcs.com/showthread.php?117106-Hooks-to-display-Announcements-and-Network-Issues 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 17, 2016 Share Posted August 17, 2016 stormy, Last edited by stormy; Today at 12:49 PM. Reason: modified the code to not display resolved network issues it may come up with nothing this way, you need to modify the SQL query it self: <?php use WHMCS\User\Alert; use Illuminate\Database\Capsule\Manager as Capsule; add_hook('ClientAlert', 1, function($client) { $getLatestNetworkIssue = Capsule::table('tblnetworkissues')->where("status", "!=", "Resolved")->orderBy('id', "desc")->take(1)->get(); foreach ($getLatestNetworkIssue as $item){ return new Alert( "<a href='serverstatus.php'>".$item->title."</a>", "danger" ); } }); 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted August 17, 2016 Share Posted August 17, 2016 stormy,it may come up with nothing this way, you need to modify the SQL query it self: Thanks a lot! Yes, that code was a bit too much of a hack! One question: I see that it only takes the latest network issue. Is it possible to create a notification for each open network issue? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 17, 2016 Share Posted August 17, 2016 this part "->take(1)" tel how many records should be selected from Database, you can increase that number or remove it to get all matched records network issues has the following statuses (Reported, Investigating, In Progress, Outage, Scheduled, Resolved) we only exclude "Resolved" from our query, if there is more you need to exclude, add another ->where("status", "!=", "Status-To-Exclude") line 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted August 17, 2016 Share Posted August 17, 2016 this part "->take(1)" tel how many records should be selected from Database, you can increase that number or remove it to get all matched records Yes, I had already tried that, but for some reason it only picks the most recent alert. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted August 17, 2016 Share Posted August 17, 2016 Yes, I had already tried that, but for some reason it only picks the most recent alert. may I see how your final code looks like? 0 Quote Link to comment Share on other sites More sharing options...
stormy Posted August 18, 2016 Share Posted August 18, 2016 It's your exact code, with ->take(4). 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.