Jump to content

Can Not Get Support PIN Hook Working - Can Someone Please Help?


ATSLarry

Recommended Posts

Hello,

 

I'm trying to add a 'Support PIN' that changes daily that is generated using Smarty Tags, but I can't seem to get it working and it's causing a 500 error everywhere on my WHMCS installation and I can't access anything unless I remove the hook.

 

Can you please help me with this?

 

I have added a hook called SupportPIN.php and here is the content of that file:

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
   // The Support PIN will be generated automatically and will change daily.
   // The Support PIN will have the format of: Day (1st and 2nd numbers), Month (3rd and 4th numbers), Client ID (5th, 6 or 7th number) and then the last 2 digits is the current year.

$SupportPIN =<b>Support PIN:</b> {$smarty.now|date_format:"%d"}{$smarty.now|date_format:"%m"}{$clientsdetails.userid}{$smarty.now|date_format:"%y"};

    // Add a first panel's body HTML. It will render above the panel's menu item list.
   $firstSidebar = $primarySidebar->getFirstChild();
   if ($firstSidebar) {
   	$firstSidebar->setBodyHtml($SupportPIN);
   }
});

Link to comment
Share on other sites

first you are trying to use Smarty where it is not available in this hook to use, also there was syntax error, try the modified version below:

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
   // The Support PIN will be generated automatically and will change daily.
   // The Support PIN will have the format of: Day (1st and 2nd numbers), Month (3rd and 4th numbers), Client ID (5th, 6 or 7th number) and then the last 2 digits is the current year.

   $clientID = intval($_SESSION['uid']);
   $SupportPIN = date("dm".$clientID."y");
   // Add a first panel's body HTML. It will render above the panel's menu item list.
   $firstSidebar = $primarySidebar->getFirstChild();
   if ($firstSidebar) {
    $firstSidebar->setBodyHtml($SupportPIN);
   }
});

Link to comment
Share on other sites

in the same line where pin code is :)

 

<?php

use WHMCS\View\Menu\Item as MenuItem;

add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar)
{
   // The Support PIN will be generated automatically and will change daily.
   // The Support PIN will have the format of: Day (1st and 2nd numbers), Month (3rd and 4th numbers), Client ID (5th, 6 or 7th number) and then the last 2 digits is the current year.

   $clientID = intval($_SESSION['uid']);
   $SupportPIN = "Security PIN: ". date("dm".$clientID."y");
   // Add a first panel's body HTML. It will render above the panel's menu item list.
   $firstSidebar = $primarySidebar->getFirstChild();
   if ($firstSidebar) {
    $firstSidebar->setBodyHtml($SupportPIN);
   }
});

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