Hi, I have absolutely no knowledge on php and im creating a site using joomla. Im trying to edit a php file in my joomla template to open a new window and redirect the user to a new page. Here is the piece of coding im trying to edit. $this->setRedirect('index.php', $message); Right now whmen a user registers in my site they get redirected to the home page (index.php) but i need to open a new window and redirect the to some other url. Replacing the index.php worked but still in the same old window. cheers
well i guess you are asking for the coding of the signup form. When a user registers through this form they get redirected to index.php. so im trying to change it. cheers. heres the code of the sign up form. <script type="text/javascript"> <!-- Window.onDomReady(function(){ document.formvalidator.setHandler('passverify', function (value) { return ($('password').value == value); } ); }); // --> </script> <?php if(isset($this->message)){ $this->display('message'); } ?> <form action="<?php echo JRoute::_( 'index.php?option=com_user' ); ?>" method="post" id="josForm" name="josForm" class="form-validate"> <?php if ( $this->params->def( 'show_page_title', 1 ) ) : ?> <div class="componentheading<?php echo $this->params->get( 'pageclass_sfx' ); ?>"><?php echo $this->escape($this->params->get('page_title')); ?></div> <?php endif; ?> <table cellpadding="0" cellspacing="0" border="0" width="100%" class="contentpane"> <tr> <td width="30%" height="40"> <label id="namemsg" for="name"> <?php echo JText::_( 'Name' ); ?>: </label> </td> <td> <input type="text" name="name" id="name" size="40" value="<?php echo $this->user->get( 'name' );?>" class="inputbox required" maxlength="50" /> * </td> </tr> <tr> <td height="40"> <label id="usernamemsg" for="username"> <?php echo JText::_( 'Username' ); ?>: </label> </td> <td> <input type="text" id="username" name="username" size="40" value="<?php echo $this->user->get( 'username' );?>" class="inputbox required validate-username" maxlength="25" /> * </td> </tr> <tr> <td height="40"> <label id="emailmsg" for="email"> <?php echo JText::_( 'Email' ); ?>: </label> </td> <td> <input type="text" id="email" name="email" size="40" value="<?php echo $this->user->get( 'email' );?>" class="inputbox required validate-email" maxlength="100" /> * </td> </tr> <tr> <td height="40"> <label id="pwmsg" for="password"> <?php echo JText::_( 'Password' ); ?>: </label> </td> <td> <input class="inputbox required validate-password" type="password" id="password" name="password" size="40" value="" /> * </td> </tr> <tr> <td height="40"> <label id="pw2msg" for="password2"> <?php echo JText::_( 'Verify Password' ); ?>: </label> </td> <td> <input class="inputbox required validate-passverify" type="password" id="password2" name="password2" size="40" value="" /> * </td> </tr> <tr> <td colspan="2" height="40"> <?php echo JText::_( 'REGISTER_REQUIRED' ); ?> </td> </tr> </table> <button class="button validate" type="submit"><?php echo JText::_('Register'); ?></button> <input type="hidden" name="task" value="register_save" /> <input type="hidden" name="id" value="0" /> <input type="hidden" name="gid" value="0" /> <?php echo JHTML::_( 'form.token' ); ?> </form>
He'd like to see the whole function. Somewhere in all the files, you'll see the code for the whole shebang. function setRedirect($page, $message) { // lotsa code } PHP: Without knowing what the function does or wants, we can't help, since the function call (what you provided) is just a place-holder for all the code. By itself, it means nothing.
Hi, WEll i think i found the correct function here (registration function), the code where it deals with the registration process. function register() { $usersConfig = &JComponentHelper::getParams( 'com_users' ); if (!$usersConfig->get( 'allowUserRegistration' )) { JError::raiseError( 403, JText::_( 'Access Forbidden' )); return; } $user =& JFactory::getUser(); if ( $user->get('guest')) { JRequest::setVar('view', 'register'); } else { $this->setredirect('index.php?option=com_user&task=edit',JText::_('You are already registered.')); } parent::display(); } /** * Save user registration and notify users and admins if required * @return void */ function register_save() { global $mainframe; // Check for request forgeries JRequest::checkToken() or jexit( 'Invalid Token' ); // Get required system objects $user = clone(JFactory::getUser()); $pathway =& $mainframe->getPathway(); $config =& JFactory::getConfig(); $authorize =& JFactory::getACL(); $document =& JFactory::getDocument(); // If user registration is not allowed, show 403 not authorized. $usersConfig = &JComponentHelper::getParams( 'com_users' ); if ($usersConfig->get('allowUserRegistration') == '0') { JError::raiseError( 403, JText::_( 'Access Forbidden' )); return; } // Initialize new usertype setting $newUsertype = $usersConfig->get( 'new_usertype' ); if (!$newUsertype) { $newUsertype = 'Registered'; } // Bind the post array to the user object if (!$user->bind( JRequest::get('post'), 'usertype' )) { JError::raiseError( 500, $user->getError()); } // Set some initial user values $user->set('id', 0); $user->set('usertype', ''); $user->set('gid', $authorize->get_group_id( '', $newUsertype, 'ARO' )); $date =& JFactory::getDate(); $user->set('registerDate', $date->toMySQL()); // If user activation is turned on, we need to set the activation information $useractivation = $usersConfig->get( 'useractivation' ); if ($useractivation == '1') { jimport('joomla.user.helper'); $user->set('activation', JUtility::getHash( JUserHelper::genRandomPassword()) ); $user->set('block', '1'); } // If there was an error with registration, set the message and display form if ( !$user->save() ) { JError::raiseWarning('', JText::_( $user->getError())); $this->register(); return false; } // Send registration confirmation mail $password = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); $password = preg_replace('/[\x00-\x1F\x7F]/', '', $password); //Disallow control chars in the email UserController::_sendMail($user, $password); // Everything went fine, set relevant message depending upon user activation state and display message if ( $useractivation == 1 ) { $message = JText::_( 'REG_COMPLETE_ACTIVATE' ); } else { $message = JText::_( 'REG_COMPLETE' ); } $this->setRedirect('index.php', $message); } function activate() { global $mainframe; // Initialize some variables $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $document =& JFactory::getDocument(); $pathway =& $mainframe->getPathWay();
It is a Joomla template function. It won't open into a new window. The parameters are: url = the url you want to redirect to msg = the message you want to display type = the type of message it is, (error, message, etc.) There is nothing in the function that allows you to open a new window. My recommendation is to use a different functionality. Maybe JavaScript or PHP would work for you. I hope this helps.