Jump to content

Add script if user is logged in


Tom Wilson

Recommended Posts

Hi guys 

I want to be able to add the below to any customer that is logged in:

<!-- Start of magicwebdesignshelp Zendesk Widget script -->
<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=7f9fba61-cc12-4564-a455-853beb469132"> </script>
<!-- End of magicwebdesignshelp Zendesk Widget script -->

 

How would I do this?

 

Thanks 

Tom

Link to comment
Share on other sites

Tom,

18 hours ago, Tom Wilson said:

How would I do this?

you could try modifying the hook I posted in the thread below...

<?php

# Tom's Widget Footer Hook
# Written by brian!

function tom_widget_footer_hook($vars) {
	
	$client = Menu::context('client');
	if ($client) {
		return <<<HTML
<!-- Start of magicwebdesignshelp Zendesk Widget script -->
<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=7f9fba61-cc12-4564-a455-853beb469132"> </script>
<!-- End of magicwebdesignshelp Zendesk Widget script --> 
HTML;
	}
}
add_hook("ClientAreaFooterOutput", 1, "tom_widget_footer_hook");

what that hook does is add your widget code to the footer template if the client is logged in... now whether the widget code works in WHMCS, I don't know - but no doubt, you'll mention if it doesn't. 🙂

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