Redirecting the login or registration page

 

On this page we’ll explain how to integrate your GeoDirectory with some other plugins that use the WordPress user accounts.

Introduction

  1. By default GD will add its own registration and login page.
  2. But you may want to redirect either the login and/or registration links to other pages, for example because you are using a membershipp plugin.
  3. You can add the following code snippets to your child theme’s functions.php or use the code snippets plugin.

1. Redirecting your login

add_filter('geodir_login_url','change_geodir_login_url',10,3);
function change_geodir_login_url($login_url,$args,$gd_page_id){
//change the url to whatever you want.
$login_url = 'http://your-site.com/my-login-page';
return $login_url;
}

2. Redirecting your registration

add_filter('geodir_login_url','_my_geodir_login_url',10,3);
function _my_geodir_login_url($login_url,$args,$gd_page_id){
 if(isset($args['signup'])){
//change the url to whatever you want.
 $login_url = 'http://your-site.com/my-rego-page';
 }
return $login_url;
}

3. Adjust for your particular integration

In the code above you’ll see we are redirecting geodir_signup to /wp-login.php

The page it is redirecting to might have to be adjusted for your situation.

WooCommerce

A standard installation of WooCommerce creates a shopper’s account page at /my-account.

You would change the above code to

$login_url = 'http://your-site.com/my-account';

bbPress, s2Member etc

The code above will work to by-pass GD’s registration and login process for all plugins that use the standard WP login, like:

  • bbPress
  • s2Member