You are here

function party_user_party_acquisition_post_acquisition in Party 7

Implements hook_party_acquisition_post_acquisition().

Allow callers to indicate special user related behavior:

  • $context['party_user']['fallback']: Set to TRUE to re-run the acquire without the user conditions if we were unable to get a result.

File

modules/party_user/party_user.party_acquisition.inc, line 80

Code

function party_user_party_acquisition_post_acquisition(&$party, &$method, array &$values, array &$context) {

  // Check we failed to get a party and want to re-run.
  if (!$party && !empty($context['party_user']['fallback'])) {

    // We want to re-run the whole thing without the user settings. Clone our
    // values and context so we don't alter them.
    $new_values = $values;
    $new_context = $context;
    $new_context['behavior'] = $context['original_behavior'];

    // Clear out the user settings and set a specific name.
    unset($new_context['party_user']);
    $new_context['name'] = 'party_user_rerun';

    // Run our new process, overriding the values.
    $party = party_acquire($new_values, $new_context, $method);
  }
}