Remitur Posted August 1, 2018 Share Posted August 1, 2018 Many users are basically stupid, and the only way to make them not to do stupid things is force them not to do it ... 😄 It happens quite often that a user, regularly logged in, instead of opening a ticket use the contact form. I guess the best fix would be redirect the logged-in user from the contact page /contact.php to the /supporttickets.php , directly in contact.php but... how to do it? php code of contact.php is encrypted, and i know no way to do it in Smarty... 😞 (The idea of modifyng the menu and links around does not work: lot of work, lot of points to crrect, and if the user get an email with a link to /contact.php it does not work..)     0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 2, 2018 Share Posted August 2, 2018 19 hours ago, Remitur said: Many users are basically stupid, and the only way to make them not to do stupid things is force them not to do it ... 😄 😃 19 hours ago, Remitur said: It happens quite often that a user, regularly logged in, instead of opening a ticket use the contact form. I assume you have a customised template then because when a user is logged in using "Six", the contact link is removed from the navbar and replaced with a link to open a ticket.... it's linked to once in the cart, but by default, I can't think of any other links once logged in. 19 hours ago, Remitur said: I guess the best fix would be redirect the logged-in user from the contact page /contact.php to the /supporttickets.php , directly in contact.php but... how to do it? <?php /** * Client Contact Form Redirection Hook * @author brian! */ function client_contact_form_redirect_hook($vars) { global $CONFIG; $client = Menu::context('client'); $url = $CONFIG['SystemURL'].'/submitticket.php'; if ($client){ header( 'Location: '.$url ); } } add_hook('ClientAreaPageContact', 1, "client_contact_form_redirect_hook"); the above hook would redirect logged in clients visiting the contact.php page to submitticket.php (to open a new ticket) - you could equally redirect them to supporttickets.php if you wanted them instead to view their existing tickets first... users that are not logged in will just see the usual contact form... I suppose it wouldn't work with links in emails, because they wouldn't be logged in, but no simple way around that. 19 hours ago, Remitur said: php code of contact.php is encrypted, and i know no way to do it in Smarty... 😞 you could get a similar, but slower, result by editing the contact.tpl template and adding the code below to the beginning of it... {if $loggedin} <script>window.location='submitticket.php';</script> {/if} all things being equal, the hook would be the faster and better solution. 1 Quote Link to comment Share on other sites More sharing options...
Remitur Posted August 3, 2018 Author Share Posted August 3, 2018 16 hours ago, brian! said: I assume you have a customised template You hit the target!!!! 😄 16 hours ago, brian! said: you could get a similar, but slower, result by editing the contact.tpl template and adding the code below to the beginning of it... Your php script doesn't work for me (I guess: an issue on hook priority... that's to say, there's "somewhere else" another hooks of the same kind, with same priority, which is executed instead of this one... I wonder what's the  usefulness of priority, being that every developer put it always to "1"  😄 ) The second one (on .tpl) works perfectly (and even if it may be slower, I think it will be no such an issue for a page that will be accessed a dozen of times in a day... 😉 Thanks again for your precious collaboration. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 3, 2018 Share Posted August 3, 2018 5 hours ago, Remitur said: Your php script doesn't work for me (I guess: an issue on hook priority... that's to say, there's "somewhere else" another hooks of the same kind, with same priority, which is executed instead of this one... I wonder what's the  usefulness of priority, being that every developer put it always to "1"  😄 ) interesting - in isolation, it worked fine locally in the v7.6 dev... but as you say, if other hooks are running before it, then all bets are off... even if you had two hooks with the same priority, they should still both run... but their effectiveness might depend on that running order, so it's easier when posting code to solve 1 problem to just use 1 in the hope that it runs first! 😀 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.