Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
1.4k views
in Q2A Core by

hi,

i can manage a redirect to a differentpage after login by changing

$topath=qa_get('to');
to:
$topath='redirectexamplepage';
 
in qa-page-lgin.php, line 75.
 
the problem with that is, that direct links in notification emails doesn't work anymore. the user will always be redirected to 'redirectexamplepage' after they login.
 
we have a restricted q&a page, so user have to login to see any content.
 
appreciating any help,
tomte
 
 

 

Q2A version: 1.5.4

2 Answers

0 votes
by
I don't know how you have setup your restricted page but from my suggestion what you can do create a page for non logged in user and redirect them instead of redirecting logged in user.

This will become more easy by checking if user not logged in than redirect with header location and when logged in it will not in condition so they wil have access.
+1 vote
by

I have closed Q2A site too.

Although conservativeness is not so good, I redirect by theme. If it is made as follows, redirection feature of qa-login.php will process correctly direct link of notification e-mails. Keep in mind that it may not move correctly depending on the reconstruction state of core program. 

Exp code)  qa-theme/YourTheme/qa-theme.php

function doctype() {
  if (qa_get_logged_in_userid()===null) {
    $req = qa_request();
    if ($req != 'login'
      && $req != 'register'
      && $req != 'forgot'
      && $req != 'reset'
      && $req != 'feedback') {
         if ($req != '')
           qa_redirect_raw(qa_path_to_root().'login?to='.$req);
         else
           qa_redirect('login');
    }
  }
  qa_html_theme_base::doctype();
}
 
I am pleased if it becomes helpful. 

 

...