You are here

function _signup_get_username in Signup 6.2

Same name and namespace in other branches
  1. 6 signup.module \_signup_get_username()
  2. 7 signup.module \_signup_get_username()

Get the name to use for a given signup.

Parameters

$signup: A fully-loaded signup object.

$link: Optional boolean indicating that the name should be rendered as a link to the user's profile (if it's an authenticated signup).

Return value

The appropriate name to use for the signed up user.

2 calls to _signup_get_username()
signup_edit_form in includes/signup_edit_form.inc
Build the form for editing existing signups.
_signup_get_email_tokens in ./signup.module
Helper function that returns an array of tokens for signup emails.

File

./signup.module, line 1616
The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…

Code

function _signup_get_username($signup, $link = FALSE) {

  // Get the array of custom signup data (if any).
  $signup_data = array();
  if (!empty($signup->form_data)) {
    if (is_array($signup->form_data)) {
      $signup_data = $signup->form_data;
    }
    else {
      $signup_data = unserialize($signup->form_data);
    }
  }

  // Allow other modules to add their data.
  drupal_alter('signup_form_data_display', $signup_data, $signup->nid, $signup->sid, $signup->uid);

  // Determine if this is an anon signup or not, and get the right info.
  if (!empty($signup->anon_mail)) {
    $user_name = theme('signup_anonymous_username', $signup_data, $signup->anon_mail);
  }
  elseif ($link) {
    $user_name = theme('username', $signup);
  }
  else {
    $user_name = $signup->name;
  }
  return $user_name;
}