You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2012-08-07 18:50:06

Anthony Gaudino
Member
Registered: 2012-02-10
Posts: 16

Hook based on URL

I'm creating a small plugin to force users to add their information (phone, email, etc) before creating a ticket.

The problem is that I don't have a hook to use to redirect users to the Preferences screen as soon as they try to create a ticket.

I already used these hooks:

  • $PLUGIN_HOOKS['item_empty']['userinfo']     = array('Ticket' => 'plugin_item_empty_userinfo');

  • $PLUGIN_HOOKS['pre_item_add']['userinfo']     = array('Ticket' => 'plugin_pre_item_add_userinfo');

to force the redirect. But the first only works as admin by opening the Helpdesk (search tickets screen) and the other only work when the user submit the the Ticket (so the user will waste its time and the ticket content).

It would be much better if I could make the plugin always check the URL the user is and them redirect them every time it detects the user is at a ticket creation URL. Is this possible using plugins?

Another question... Is there any hook for the preferences screen so that when a user is redirect to it I can display a message?

Offline

#2 2012-08-07 19:01:16

remi
GLPI-DEV
From: Champagne
Registered: 2007-04-28
Posts: 7,127
Website

Re: Hook based on URL

> I'm creating a small plugin to force users to add their information (phone, email, etc) before creating a ticket.

See : https://forge.indepnet.net/issues/3637

You will notice there is a backport patch for 0.83.x available.


Dév. Fedora 29 - PHP 5.6/7.0/7.1/7.2/7.3/7.4 - MariaDB 10.3 - GLPI master
Certifié ITILv3 - RPM pour Fedora, RHEL et CentOS sur https://blog.remirepo.net/

Offline

#3 2012-08-07 21:28:08

Anthony Gaudino
Member
Registered: 2012-02-10
Posts: 16

Re: Hook based on URL

Thanks for the answer but it was not exactly what I was looking for.

I solve the problem by just using the PHP $_SERVER['REQUEST_URI'] inside the plugin setup.php to get the requested URL and if it contains ticket and the user has no Phone, email... registered I redirect him to the Preferences page.

If anyone has a better solution I would be happy to know about.

Offline

Board footer

Powered by FluxBB