You are here

function _datereminder_current_reminder_or_link in Date Reminder 7

Returns either a reminder form or, for anonymous user and if so enabled, an invitation to log in or register. @global type $user

Parameters

type $n - The node being acessed:

type $acctype DATEREMINDER_AS_BLOCK or ..._NODE:

Return value

array() - Reminder block to display.

2 calls to _datereminder_current_reminder_or_link()
datereminder_block_view in ./datereminder.module
Implements hook_block_view().
_datereminder_node_output in ./datereminder.module
Add option to node allowing user to request a reminder.

File

./datereminder.module, line 947
Support for reminders for nodes with dates.

Code

function _datereminder_current_reminder_or_link($n, $acctype) {
  $content = NULL;
  global $user;
  if (!isset($user) || $user->uid == 0) {
    if (isset($n) && $n->datereminder_enabled == DATEREMINDER_TYPE_ON && variable_get('datereminder_anonymous_link', false) && variable_get('datereminder_display_loc', DATEREMINDER_IN_NODE) == $acctype) {
      $content = _datereminder_anonymous_link($n);
      $s = array(
        '#field_type' => 'text',
        '#markup' => $content,
      );
      $content = $s;
    }
  }
  elseif (datereminder_allowed_access_node($n, 'own', $acctype)) {
    $content = _datereminder_current_user_reminder($n, 'node');
  }
  return $content;
}