You are here

ajax_logintoboggan.module in Ajax 6

File

plugins/loggintoboggan/ajax_logintoboggan.module
View source
<?php

/**
 * AJAX LoginToboggan Plugin
 *
 * @see http://drupal.org/project/ajax
 * @see irc://freenode.net/#drupy
 * @depends Drupal 6
 * @author brendoncrawford
 * @note This file uses a 79 character width limit.
 *
 */

/**
 * Gets ajax types
 *
 * @param $types Assoc
 * @return Bool
 *
 */
function ajax_logintoboggan_ajax_types(&$types) {
  $types['logintoboggan_user_register'] = t('Loggin Toboggan User Register');
  return TRUE;
}

/**
 * Handles a special case for Login Toboggan redirection
 *
 * @param $form Assoc
 * @return Bool
 */
function ajax_logintoboggan_ajax_alter(&$form, &$form_state, $form_id) {
  global $logintoboggan_denied;
  if (isset($logintoboggan_denied) && $logintoboggan_denied) {
    $q = ajax_path_info($form['#action']);
    if (!array_key_exists('destination', $q['query'])) {
      $p = ajax_drupal_path($form['#action']);
      $q['query']['destination'] = $p;
      $form['#action'] = url($p, array(
        'query' => $q['query'],
        'fragment' => $q['fragment'],
        'absolute' => FALSE,
      ));
    }
  }
  else {
    return FALSE;
  }
}

Functions

Namesort descending Description
ajax_logintoboggan_ajax_alter Handles a special case for Login Toboggan redirection
ajax_logintoboggan_ajax_types Gets ajax types