Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login_overlay_menu() {
- $items['login-overlay'] = array(
- 'title' => t('Sign in'),
- 'page callback' => 'login_overlay_callback',
- 'page arguments' => array(),
- 'type' => MENU_CALLBACK,
- 'access callback' => TRUE,
- );
- return $items;
- }
- function login_overlay_callback($js = TRUE){
- ctools_include('modal');
- ctools_include('ajax');
- $form_state = array(
- 'ajax' => TRUE,
- );
- $output = ctools_modal_form_wrapper('login_overlay_form', $form_state);
- if (isset($_GET['destination'])) {
- $output[] = login_overlay_redirect($_GET['destination']);
- }
- else {
- $output[] = ctools_ajax_command_reload();
- }
- print ajax_render($output);
- }
- function login_overlay_redirect($path) {
- global $user;
- if (isset($languages[$user->language])) {
- $options = array('language' => $languages[$user->language]);
- }
- return ctools_ajax_command_redirect($path, 0, $options);
- }
- /**
- * Implements hook_user_login().
- */
- function my_module_user_login(&$edit, $account) {
- // $edit is empty with one time login
- if (!empty($edit)) {
- $_GET['destination'] = 'some-url';
- }
- // Or the form id is the password reset form
- if ($_POST['form_id'] != 'user_pass_reset') {
- $_GET['destination'] = 'some-url';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement