I set up a message through the UI, which worked as expected. But, unless I've missed something, the only way to to turn the message off is to disable the module entirely. That seems inefficient.

CommentFileSizeAuthor
#2 popup_message_with_enable.patch755 bytespdumais42

Comments

grzegorz.bartman’s picture

Hi,
Try to disable permissions "display popup message" for all roles. Message will be still displayed for administrator (because he always has permissions set to TRUE), but not for other users.
In next version i will add option to disable message.

pdumais42’s picture

StatusFileSize
new755 bytes

Easy enough to add a switch in the admin and check at runtime.

I'm running the 6.14 version - so appologies for posting in a 7.x issue.

Here is my simple patch:

Index: popup_message.admin.inc
===================================================================
43a44,52
>   $form['popup_message_enable'] = array(
>     '#type' => 'radios',
>     '#title' => t('Enable Popup'),
>     '#default_value' => variable_get('popup_message_enable', 1),
>     '#options' => array(
>       TRUE => t('Enabled'),
>       FALSE => t('Disabled'),
>     ),
>   );
Index: popup_message.module
===================================================================
59c59,60
<   if ($permission) {
---
>   $enabled = variable_get('popup_message_enable', 1);
>   if ($enabled && $permission) {
Index: popup_message.install
===================================================================
40a41
>   variable_del('popup_message_enable');
grzegorz.bartman’s picture

Status: Active » Fixed

Option added to versions 7.x-1.1 and 6.x-1.5.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.