comments w/membership login redirect

By squeazel - July 12, 2012

I've set up comments and membership. (The only way to sign up or sign in is via comments on a page.) If the user signs in to comment, they are not being returned to the page they were previously on. For the most part, everything is still in its default demo settings.

It looks like this problem was discussed in post 89950, but it's unclear if there was a solution.

Re: [charnushka] comments w/membership login redirect

By Jason - July 13, 2012

Hi,

If you open up your website membership plugin file, you'll probably see this line near the top:

$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = '/';

This tells the plugin where to redirect the user after they have successfully logged in. To keep them on the same page, remove the slash:

$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = '';

Give that a try and let me know if you run into any problems.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] comments w/membership login redirect

By squeazel - July 14, 2012

I tried that change. Here is what happened:

(1) Go to page with user comments when not logged in. Click login in order to comment.
(2) Taken to user-login page.
(3) Submit username and password.
(4) User login page now says "You are already logged in. Click here to continue, or Logoff." (This seems a little odd... I was hoping for an immediate redirect back to the original page.)
(5) Clicking on "click here to continue" now doesn't take me anywhere. (Before removing the slash it would take me to the root.

thanks!

Re: [charnushka] comments w/membership login redirect

I'm having this same issue - when changing this:
$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = '/';
to this:
$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL'] = '';

and running through the sames steps as charnuska (minus the comments plugin which I'm not using) the link now directs nowhere, essentially 'working' as you've described - it 'keeps them on the same page' which in this example is the login page.

I'm looking for an immediate redirect back to the original page - the one the user initially clicked on to login. Is this possible? I also couldn't tell if there was ever a solution posted.

Thanks,
Cricket7475

Re: [greg] comments w/membership login redirect

Hi Greg,

Thanks for the response. So you know what I'm working with: CMS Builder 2.14 and Website Membership Plugin 1.07.

I'm not using the comments plugin, and so attempted to add the code to a test page I've been working on. Got an error message when trying to find the best placement for the snippet you provided. Eventually tried placing it at the very end of my page just before the closing body tag and no more visible errors on the page, but in the source I get the same error (minus actual DB info):

Warning: Cannot modify header information - headers already sent by (output started at /home/.../support-test.php:41) in /home/.../support-test.php on line 348

The line number is the line where the snippet has been inserted and as I moved it up and down in the code that line number would change accordingly. And since the cookie isn't being added my redirect isn't working.

Any ideas?

Thanks!
Cricket7475

Re: [cricket7475] comments w/membership login redirect

Hi,

I think the most likely problem in this case is the cookie needs to be set before any HTML is displayed, as it needs to modify the header information. Have you tried setting the cookie right at the top of the page?

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com