You are here

function _signup_get_username in Signup 7

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

Get the name to use for a given signup.

Parameters

stdClass $signup: A fully-loaded signup object.

bool $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

string 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 1740
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);
    }
  }

  // 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', array(
      'form_data' => $signup_data,
      'email' => $signup->anon_mail,
    ));
  }
  elseif ($link) {
    $user_name = theme('username', array(
      'account' => $signup,
    ));
  }
  else {
    $user_name = $signup->name;
  }
  return $user_name;
}