array( 'arguments' => array(), ), 'modalframe_register_login_link' => array( 'arguments' => array('attributes' => array(), 'query' => NULL), ), 'modalframe_register_register_link' => array( 'arguments' => array('attributes' => array(), 'query' => NULL), ), 'modalframe_register_logout_link' => array( 'arguments' => array('attributes' => array()), ), 'modalframe_register_my_account_link' => array( 'arguments' => array('attributes' => array()), ), ); } /** * Implementation of hook_menu(). */ function modalframe_register_menu() { $items = array(); $items['modal/login'] = array( 'title' => 'Login', 'page callback' => 'modalframe_register_page_login_form', 'access callback' => 'user_is_anonymous', 'type' => MENU_CALLBACK, ); $items['modal/register'] = array( 'title' => 'Register', 'page callback' => 'modalframe_register_page_register_form', 'access callback' => 'user_register_access', 'type' => MENU_CALLBACK, ); $items['modal/register/welcome'] = array( 'title' => 'Registration details', 'page callback' => 'modalframe_register_page_welcome', 'access callback' => 'user_is_logged_in', 'type' => MENU_CALLBACK, ); return $items; } /** * Implementation of hook_init(). */ function modalframe_register_init() { if ($_GET['q'] == 'modal/register' || $_GET['q'] == 'modal/login' || $_GET['q'] == 'modal/register/welcome') { modalframe_child_js(); } } /** * Implementation of hook_block(). */ function modalframe_register_block($op = 'list', $delta = 0, $edit = array()) { global $user; if ($op == 'list') { $blocks[0] = array( 'info' => t('Modal Frame Login/Register'), ); return $blocks; } elseif ($op == 'view') { if ($delta == 0) { $block['subject'] = user_is_anonymous() ? t('Modal Frame Login/Register') : theme('username', $user); $block['content'] = theme('modalframe_register_login_block'); return $block; } } } /** * Implementation of hook_form_alter(). */ function modalframe_register_form_alter(&$form, $form_state, $form_id) { // Append our submit handler. This is required if we want a chance to // close the modal frame dialog. $form['#submit'][] = 'modalframe_register_form_submit'; if ($form_id == 'user_register') { $form['#redirect'] = 'modal/register/welcome'; } } /** * Submit handler for our node edit form example. */ function modalframe_register_form_submit($form, &$form_state) { if ($form_state['values']['op'] == t('Log in')) { modalframe_close_dialog(array( 'message' => t('Processing the form...'), )); } } /** * Menu callback; login form in child window. */ function modalframe_register_page_login_form() { // Send the Modal Frame javascript for child windows to the page. modalframe_child_js(); // Get the forms from the user module. module_load_include('inc', 'user', 'user.pages'); // Render the page contents. $output = drupal_get_form('user_login'); $output .= '