maha
maha

Reputation: 11

JomSocial - Registration Redirection

I am working on jomsocial. I have installed the "Redirect Registration for JomSocial" plugin for redirecting the registration page to jomsocial registration. I am getting the registration page but once the first step in registration in completed the page redirects to login page showing the message as "Please Login first".

This is happens only if I disables the menu "Jomsocial" that is created during jomsocial installation.

Is there any other way to redirect the registration page to jomsocial registration.

Upvotes: 1

Views: 2592

Answers (2)

Sulibrat
Sulibrat

Reputation: 151

It seems that you have menu item issue. probably you create some menu items outside JomSocial toolbar and you've set for one of this menu item (the one with highest menu item ID) privacy restriction.

So You get to registration page and when clicking next Joomla! is taking menu item ID from menu item I mentioned above... this cause redirection to "Please, login first". Just check your menu items ;)

Upvotes: 1

Riccardo Zorn
Riccardo Zorn

Reputation: 5615

You may not disable the jomsocial menu items, if you don't want to show them just put them in a new menu, which you won't create a module for (or create a module and don't assign it to any position). This is why it's failing now. The function requiring this is getMenuItem() in the redirect plugin.

What you will find next is that a visitor clicking on a link that requires login will be sent to the login page with a &return parameter with the encoded url it's supposed to go back to after login. This is not handled by jomsocial plugin, just change is like this:

file plugins/system/jomsocialredirect/jomsocialredirect.php

/**
 * Method to override Login / Logout redirect
 */
private function overrideRedirectLoginLogout() {

    $mainframe  =&  JFactory::getApplication();

    $task = JRequest::getVar ( 'task' );
    switch ($task) {
        case 'user.login' : //Joomla 1.6 and later
        case 'login' : /* on logging */
            /** 
             * krz This next line restores working status of login redirects.
             * (the purpose of jomsocialredirect plugin is to redirect after login, but some links for guests
             * point to com_login with a return url set; if this is the case, the next line makes the feature work,
             * otherwise it would be overridden;
             * note: redirect is to be avoided on logout.
             */
            if (JRequest::getVar('return','')!='') return;

            if ($this->login ()) { /* we do login by self */
                /* redirect if login success */
                $link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login', 1 ) );
                $mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_login_msg', 'LOGIN_SUCCESSFUL' ) ), 'message' );
            } else {
                /* redirect if login failed */
                $link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login_failed', 1 ) );
                $mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_login_failed_msg', 'LOGIN_FAILED' ) ), 'notice' );
            }
            break;
        case 'user.logout' : //Joomla 1.6 and later
        case 'logout' :
            $link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_logout', 1 ) );
            JFactory::getApplication ()->logout ();
            $mainframe->redirect ( $link, JText::_ ( $this->pluginParams->get ( 'redirect_logout_msg', 'YOU_HAVE_LOGGED_OUT' ) ), 'message' );
            break;

        default :
            /* override redirect after login / logout */
            $view = JRequest::getVar('view','');
            if ($view=='profile') {
                $link = $this->getMenuLink ( $this->pluginParams->get ( 'redirect_login', 1 ) );
                $mainframe->redirect ( $link);
            }

            break;
    }
}

Upvotes: 0

Related Questions