I'm not a technical person and am trying to set up this website using question2answer template.
The site is up and I can post questions and answer them, and I've also made changes necessary to qa-external-users.php as specified.
But I'm unable to log in as the log in, register and logout URLs that need to be specified in the file are being done incorrectly. From that particular section I've commented out the default sections and un-commented "Example 1". Yet I'm unable to get the log in page to show up.
Please guide me in how to get the log in and register pages to show up.
I'm not even able to get to the admin panel without these settings!
The code after my modifications for the get-links sections is as below:
function qa_get_login_links($relative_url_prefix, $redirect_back_to_url)
YOU MUST MODIFY THIS FUNCTION, BUT CAN DO SO AFTER Q2A CREATES ITS DATABASE
You should return an array containing URLs for the login, register and logout pages on
your site. These URLs will be used as appropriate within the Q2A site.
You may return absolute or relative URLs for each page. If you do not want one of the links
to show, omit it from the array, or use null or an empty string.
If you use absolute URLs, then return an array with the URLs in full (see example 1 below).
If you use relative URLs, the URLs should start with $relative_url_prefix, followed by the
relative path from the root of the Q2A site to your login page. Like in example 2 below, if
the Q2A site is in a subdirectory, $relative_url_prefix.'../' refers to your site root.
Now, about $redirect_back_to_url. Let's say a user is viewing a page on the Q2A site, and
clicks a link to the login URL that you returned from this function. After they log in using
the form on your main site, they want to automatically go back to the page on the Q2A site
where they came from. This can be done with an HTTP redirect, but how does your login page
know where to redirect the user to? The solution is $redirect_back_to_url, which is the URL
of the page on the Q2A site where you should send the user once they've successfully logged
in. To implement this, you can add $redirect_back_to_url as a parameter to the login URL
that you return from this function. Your login page can then read it in from this parameter,
and redirect the user back to the page after they've logged in. The same applies for your
register and logout pages. Note that the URL you are given in $redirect_back_to_url is
relative to the root of the Q2A site, so you may need to add something.
// Until you edit this function, don't show login, register or logout links
'login' => null,
'register' => null,
'logout' => null
Example 1 - using absolute URLs, suitable if:
Example 2 - using relative URLs, suitable if:
'login' => $relative_url_prefix.'../login.php',
'register' => $relative_url_prefix.'../register.php',
'logout' => $relative_url_prefix.'../logout.php',
Example 3 - using relative URLs, and implementing $redirect_back_to_url
In this example, your pages login.php, register.php and logout.php should read in the
parameter $_GET['redirect'], and redirect the user to the page specified by that
parameter once they have successfully logged in, registered or logged out.
'login' => $relative_url_prefix.'../login.php?redirect='.urlencode('qa/'.$redirect_back_to_url),
'register' => $relative_url_prefix.'../register.php?redirect='.urlencode('qa/'.$redirect_back_to_url),
'logout' => $relative_url_prefix.'../logout.php?redirect='.urlencode('qa/'.$redirect_back_to_url),