Jump to content

Customize Admin badges


zitu4life

Recommended Posts

Hello

These  days  I have learned   a little   regarding   Font Awesome,    so   now I   know   I can customize\replace   it  according to my desired on WHMCS . Admin   badges   has   4   Font Awesome icons,   I have   changed   it   for testing    purposes and  works   OK, but   I need   help   now   is  to   change  code badge to  count   all active  clients  I  have,  like   on   ClientActivity.   Perhaps    it could be just copy   and  paste code from   ClientActivity  to   badge, but   what to   copy exactly?

image.thumb.png.b11625a66955652a7a14841b5db0ce2e.png

I think   I have   to  edit   these    line s  on badges  

<div class="detail">
                <a href="orders.php?status=Pending">
                    <span class="count">{$pendingOrders}</span>
                    <span class="desc">Total Active Clients</span>
                </a>
            </div>

for   counting   active   clients   I need  to replace   this line

<span class="count">{$pendingOrders}</span>

replace $pendingOrders    with   something.   I am   testing   some   changes   technically  availability   for some  specific    business   needed.

Thanks   for   your help!

 

Edited by zitu4life
Link to comment
Share on other sites

14 hours ago, zitu4life said:

Perhaps    it could be just copy   and  paste code from   ClientActivity  to   badge, but   what to   copy exactly?

if you're going to do that, you would need to add...

use WHMCS\User\Client;

to the list of USE links at the top of the file...

and then change the formula for pendingorders...

'pendingOrders' => (int) Client::where('status', '=', 'Active')->count(),

to get a count of all active clients...

obviously, you could rename 'pendingOrders" to something else, but you'd have to change all the occurrences of it in the .php files.

Link to comment
Share on other sites

3 hours ago, brian! said:

if you're going to do that, you would need to add...


use WHMCS\User\Client;

to the list of USE links at the top of the file...

and then change the formula for pendingorders...


'pendingOrders' => (int) Client::where('status', '=', 'Active')->count(),

to get a count of all active clients...

obviously, you could rename 'pendingOrders" to something else, but you'd have to change all the occurrences of it in the .php files.

Many Thanks  Brian.    it works!   It is   great to have at the   top  badges total  active    clients, so I   know    instantly    when will  be  need  take some decisions   on time. 🏋️‍♂️ I will  all try  to override   Pending   Modules  Actions   too   on my dev with others  important  inputs  according to the  WHMCS  installations  idea.

Edited by zitu4life
Link to comment
Share on other sites

32 minutes ago, zitu4life said:

Many Thanks  Brian.    it works!   It is   great to have at the   top  badges total  active    clients, so I   know    instantly    when will  be   take some decisions   on time. 🏋️‍♂️ I will  all try  to override   Pending   Modules  Actions   too   on my dev with others  important  inputs  according to the  WHMCS  installations  idea.

one other thing that I should have mentioned, though you may probably be aware of it already, but if you've modified the badges.php widget, the automatic updater will probably replace it during an update - so keep a backup copy of it just in case.

the other way would be to duplicate the file, give it a filename of badges2.php; call the class in the code Badges2 instead of Badges; optionally rename the Title in the code and disable the default Badges widget in the Show/Hide Widgets menu...

hLfZK3x.png

the other weird thing with these widgets is that they are all seemingly hardcoded with English output. 🙄

I would have thought that they should be using language strings by now... it wouldn't be difficult to do that (especially if those strings already exist in the language files).

Edited by brian!
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.

×
×
  • 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