Popup message example

Description

Display popup message for users once per browser session.
Based on javascript code: http://yensdesign.com/2008/09/how-to-create-a-stunning-and-smooth-popup-...
Screenshot: http://i.imgur.com/4fi8T.png

Configuration

Go to admin/settings/popup_message and set message title and body.
Go to admin/user/permissions and set permissions.

Dependencies

For Drupal 6.x version download jquery.cookie.js file from https://github.com/carhartl/jquery-cookie and copy to directory: sites/all/libraries/jquery.cookie/

API

You can change paremeters of message using alter funcion in your module. Module allow to use 2 alter functions:
- popup_message_perameters
- popup_message_permission

popup_message_perameters_alter example:

function mymodule_popup_message_perameters_alter(&$elements) {
  if(arg(0) == 'user' && arg(1) == 'register') {
    $elements['title'] = t('Hello');
    $elements['body'] = t('Remember to set a difficult password');
    $elements['check_cookie'] = FALSE;
  }
}

popup_message_permission example:

function mymodule_popup_message_permission_alter(&$elements) {
  if(arg(0) == 'user' && arg(1) == 'register') {
   $elements = TRUE;
  }
}

You can also use function for display message in your custom theme or module, example:

$popup_message_parameters = array(
      'title' => t('Information'),
      'body' => t('You have completed the work'),
      'check_cookie' => FALSE,
);
popup_message_show_message($popup_message_parameters);

Javascript function (available from version 6.x-1.4 and 7.x-1.0):

<span onClick="popup_message_display_popup('Message title', 'Message body text', 600, 600);;" >CLICK ME</span>

Sponsorship

This project is sponsored by Droptica - Experts in Enterprise Drupal Development

Supporting organizations: 

Project Information

Downloads