drupal_set_message showing twice when called from hook_init Basically the issue is that drupal_set_message is showing the message twice on some pages when it is called from hook_init.

Can someone give some advice about this issue, please ?
It's likely that the first message you see is the left-over result of a previous AJAX call, and the second message is the one you're intending to see. 

To test that, open a different browser and browse to the page in question. First time round you should see the message once; when you refresh the page, and on subsequent requests, you should see it twice. 

It happens because hook_init() is also invoked for AJAX requests, but the messages added to the session are never printed-then-cleared - so there's an extra copy of the same message in the next normal page load.

For most (all?) modern browser/server combinations you can use something like this to detect whether or not the request is from an AJAX source, and react accordingly:

function is_ajax_request() {
  return !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &amp;&amp; strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
}