Popup message showing content from a block I have a block, and I want to display the content of that block into a popup message. This is my code.

function darksite_menu() {
  $items['admin/config/media/darksite'] = array(
    'title' =&gt; 'Pop up screen configuration',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('darksite_config_page'),
    'access arguments' =&gt; array('adminster pop up dark screen'),
    'type' =&gt; MENU_NORMAL_ITEM
  );

  return $items;
}

function darksite_config_page() {
  $form['darksite_status'] = array(
    '#title' =&gt; t('Enable pop up screen'),
    '#description' =&gt; t('When enabled, a pop up screen will be displayed on the home page.'),
    '#type' =&gt; 'checkbox',
    '#default_value' =&gt; variable_get('darksite_status', 0)
  );

  return system_settings_form($form);
}

function darksite_block_info() {
  $blocks['popup_dark_screen'] = array(
    'info' =&gt; t('Pop up Dark Screen')
  );

  return $blocks;
}

function darksite_block_view($delta = '') {
  switch ($delta) {
    case 'popup_dark_screen':
      $block['subject'] = t('Pop up Dark Screen');
      $block['content'] = get_darksite_popup();
  }

  return $block;
}

function get_darksite_popup() {
  $popup_message_parameters = array(
    'title' =&gt; t('Information'),
    'body' =&gt; t('You have completed the work'),
    'check_cookie' =&gt; TRUE,
  );
  if (variable_get('darksite_status', 0))
   {
  // if the check box is checked.
   popup_message_show_message($popup_message_parameters);
    } 
}


The code does not work. I have installed the model of popup message, but it still doesn't work.
You should not be printing popup_message_show_message(); it just includes all the necessary files and show your message. Just remove the print part and try that way.

function popup_message_show_message($popup_message_parameters) {
  drupal_add_js(array(
      'popup_message' =&gt; $popup_message_parameters
    ), 'setting');
  drupal_add_js('misc/jquery.cookie.js');
  drupal_add_js(drupal_get_path('module', 'popup_message') . '/js/popup.js');
  $default_style = drupal_get_path('module', 'popup_message') . '/styles/default/' . POPUP_MESSAGE_CSS_NAME;
  $style = variable_get('popup_message_style', $default_style);
  if (!file_exists($style)) {
    $style = $default_style;
  }
  drupal_add_css($style);
}


Also, never use print_r() directly. Either use this:

drupal_set_message('&lt;pre&gt;' . print_r($variable, TRUE) . '&lt;/pre&gt;');


Or install Devel module and call the dpm() function this way: dpm($variable). It will use Krumo to display all attributes / elements, which is times better for debugging and will not cause any errors as print_r().