Jump to content

Required Some Design Help On Custom Hook


natanray

Recommended Posts

Hello,

I am using a custom support pin hook in WHMCS. The code is below: 

<?php

use WHMCS\View\Menu\Item as MenuItem;



add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{

  $client = Menu::context('client');
  if (!is_null($client)) {
$SupportPIN = generatePinCode($_SESSION['uid'], 5);
  $primarySidebar->addChild('Support-Pin', array(
        'label' => "Support Pin",
        'uri' => '#',
        'order' => '1',
        'icon' => 'fa-key'
    ));
  $primarySidebar->getChild('Support-Pin')->setBodyHtml($SupportPIN);
  }
});

add_hook('AdminAreaClientSummaryPage', 1, function($vars) {
    return 'Support Pin: ' . generatePinCode($vars['userid'], 5);
});

function generatePinCode($clientid = 0, $length = 6){
    $clientid = intval($clientid);
    preg_match_all('!\d+!', md5(date("y" . $clientid)), $matches);
    $numbers = join("", $matches[0]);
    return substr($numbers, 0, $length);
}

This code is giving below UI in our WHMCS clientarea. (Pic: Screenshot (292).png)

But I would like to show the Support Numbers in the another screenshot format. Like some boxes around the numbers and just a copy option right side.

 

Screenshot (292).png

15954-892-1e2f58e0a7ebae0ec74b485e6f8f98c1.png

Link to comment
Share on other sites

16 hours ago, natanray said:

But I would like to show the Support Numbers in the another screenshot format. Like some boxes around the numbers and just a copy option right side.

then you could always buy the addon module that generates that screenshot from Marketplace  - it's only $15 and i'm sure @string would appreciate it! 🎁

visually, it's just restyling the PIN content of the body with CSS or images; and then adding a footer that contains clipboard copy, recycle and help button functionality.

technically, that's not complicated to do, but I see no point in reinventing the wheel and potentially damaging income to a developer, when they have already spent time coding what you want to do.

just because I know how to do what you want, doesn't mean that I need to or, more importantly, should tell you.... buy the addon! headshake.gif

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