• Is Teaching Sells for You?


    I've taken the Teaching Sells Course and I think it's an amazing investment in your future.

    Not sure if it's for you? Get the inside scoop on Teaching Sells before you enroll...
  •  

Subscribe to this blog

Subscribe to full feed RSS
What is RSS?

Subscribe Via Email

We respect your privacy.

Joomla Login Lost Password aMember Redirect Fix

By Chris On July 24, 2009 Under Membership Sites

The Problem:

When a public user clicks on the “Register to Read More…” link on your Joomla+aMember site and they are redirected to a Joomla Login page.

That login page’s ‘Forgot your password’ link redirects in a confusing way when it should redirect them to aMember instead.

Here is the php code for fixing this.

Thanks to David Moskowitz at Membership Academy for the heart of the code and to Derek Barber for tweaking it:

The file you want to edit is: amember.php in joomla/plugins/system

This is the code BEFORE the location where you’ll insert the new code :

if (strstr($_SERVER['REQUEST_URI'],'/logout') || (@$option == 'com_user' && @$task == 'logout'))
// if (strstr($_SERVER['REQUEST_URI'],'/logout') || @$task == 'logout')
{
if (!$return)
$return = $_SERVER['PHP_SELF'];
$return = preg_replace('/[\n\r]/', ' ', $return);
$url = "$amemberRoot/logout.php";
header("Location: $url");
exit();
}

This is the actual new code you want to insert:

if (strstr($_SERVER['REQUEST_URI'],'/component/user') || @$option == 'com_user')
{
if (@in_array(@$task, array('requestreset', 'remindusername')) || strstr($_SERVER['REQUEST_URI'],'/reset') || strstr($_SERVER['REQUEST_URI'],'/remind') || @in_array(@$view, array('reset','remind')) || @$task == 'lostPassword')
{
header("Location: $amemberRoot/login.php?amember_redirect_url=".$_SERVER['PHP_SELF']);
exit();
}

This is the code that follows your newly inserted code:

if (@in_array(@$task, array('register','register_save','activate,login')))
{
header("Location: $amemberRoot/signup.php");
exit();
}

if (@in_array(@$view, array('register','register_save','activate,login')))
{
header("Location: $amemberRoot/signup.php");
exit();
}
}

The Result

Assuming you’re aMember+Joomla integration is set up correctly.

When a user clicks on the “Register to Read More..” link to view your registered (protected) Joomla content the Login page will appear.

In the Login page, if they user clicks on the “Lost Your Password” link, they will be redirected to your aMember members page – not to some weird nonsense page.

Related Posts

  • No Related Posts
SimplWeb
Teaching Sells