Jump to content

Hook Question


Tom Wilson

Recommended Posts

Hi peeps,

Trying out the hooks and would like the following, for some reason it just is not working!

I am using tawk.to and have a script:

 

<script>
    Tawk_API.onStatusChange = function(status){
    if (status === 'online') {
        <?php
         add_hook('ClientAreaHomepagePanels', 1, function($homePagePanels) {
    $newPanel = $homePagePanels->addChild(
        'unique-css-name',
        array(
            'name' => 'Friendly Name',
            'label' => 'Translated Language String',
            'icon' => 'fas fa-calendar-alt', //see http://fortawesome.github.io/Font-Awesome/icons/
            'order' => '99',
            'extras' => array(
                'color' => 'pomegranate', //see Panel Accents in template styles.css
                'btn-link' => 'https://www.whmcs.com',
                'btn-text' => Lang::trans('go'),
                'btn-icon' => 'fas fa-arrow-right',
            ),
        )
    );
// Repeat as needed to add enough children
    $newPanel->addChild(
        'unique-css-name-id1',
        array(
            'label' => 'Panel Row Text Goes Here',
            'uri' => 'index.php?m=yourmodule',
      
      
            'order' => 10,
        )
    );
});?>
    } else if(status === 'away') {
         <?php
         add_hook('ClientAreaHomepagePanels', 1, function($homePagePanels) {
    $newPanel = $homePagePanels->addChild(
        'unique-css-name',
        array(
            'name' => 'Friendly Name',
            'label' => 'Translated Language String',
            'icon' => 'fas fa-calendar-alt', //see http://fortawesome.github.io/Font-Awesome/icons/
            'order' => '99',
            'extras' => array(
                'color' => 'pomegranate', //see Panel Accents in template styles.css
                'btn-link' => 'https://www.whmcs.com',
                'btn-text' => Lang::trans('go'),
                'btn-icon' => 'fas fa-arrow-right',
            ),
        )
    );
// Repeat as needed to add enough children
    $newPanel->addChild(
        'unique-css-name-id1',
        array(
            'label' => 'Panel Row Text Goes Here - away',
            'uri' => 'index.php?m=yourmodule',
      
      
            'order' => 10,
        )
    );
});?>

    } else {
    
    }
};
</script>

That however, is only showing the 'away' section - even if it is online.

Any ideas?

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