You are here

function drush_party_user_login in Party 7

Displays a one time login link for the given party.

Parameters

$pid: The party we want to generate a link for.

$path: Optional path to redirect to after logging in.

1 string reference to 'drush_party_user_login'
party_user_drush_command in modules/party_user/party_user.drush.inc
Implements hook_drush_command().

File

modules/party_user/party_user.drush.inc, line 37

Code

function drush_party_user_login($pid, $path = NULL) {

  // Load the party.
  if (!($party = party_load($pid))) {
    drush_set_error('The party could not be loaded.');
    return;
  }
  if (!($user = $party
    ->getDataSetController('user')
    ->getEntity())) {
    drush_set_error('The given party has no associated user.');
    return;
  }

  // Pass onto drush_user_login.
  return drush_user_login($user->uid, $path);
}