Jump to content

How does the Notifications in top-right in Six Template work?


Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"
       );
   }
});

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • 1 month later...

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 by stormy
modified the code to not display resolved network issues
Link to comment
Share on other sites

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"
       );
   }
});

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated