I've build a website in 3 languages (English, Dutch, French), now my client wants parts of the website to be for members only...

I've succesfully setup the Website Membership Plug-in (1-10) for the English part, but I'm having problems with the other language parts:

The login page is always directing to the English Login page, while I want it to show the French or Dutch login page respectively.

Like: http://www.mysite.be/fr/user-login.php?loginRequired=1 

and: http://www.mysite.be/nl/user-login.php?loginRequired=1

instead of: http://www.mysite.be/user-login.php?loginRequired=1

I can see this code in the WebsiteMembership.php: $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL']  = '/user-login.php';

How can I arrange this code so it will show a different page for each language please ??

Thanks for helping me out already !!


Hi Ross, thanks for the reply.

I can see what you mean, but it won't work well for me because the user-login.php page has a lot of other content ( that should be in the right language when redirected to...)   

I saw another topic in this forum, maybe I could do something like that also ? : http://www.interactivetools.com/forum/forum-posts.php?postNum=2207991#post2207991 

I don't know much about php so maybe you could direct me in this ? The code I'm thinking of :

On all French website pages:

$language = "french";

In websiteMembership.php:


$GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL']  = '/fr/user-login.php';




Does this make any sense at all ;-) ?



By ross - February 5, 2016 - edited: February 5, 2016

Hi Koen.

I get what you mean with all the other content on the page.

The problem here will be that there isn't enough information for the login page to know what language the current user wants.

What you could do is have a cookie called "language" set on every single page. On all the French pages, set the the language cookie to "French. On all the English pages, set the language cooke to "English". And so forth.

Then, when they get redirected to your login, you can check the cookie.  If the cookie is set to French, redirect to the French login page.

Does that make sense?

Let me know what you think.


Ross Fairbairn - Consulting

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Okay Ross,

I'm trying the solution with a cookie, but I'm getting a php error:

Notice: Undefined index: language in /home/ajkdirec/public_html/beheer/plugins/websiteMembership.php on line 14 setPrefixedCookie: Can't set cookie, headers already sent! Output started in /home/ajkdirec/public_html/beheer/plugins/websiteMembership.php line 14

Could you check what I'm doing wrong please ?

My code in the French webpages to set the cookie (at the top):

setcookie("language", "fr");
<?php header('Content-type: text/html; charset=utf-8'); ?>
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

// load viewer library
$libraryPath = 'beheer/lib/viewer_functions.php';
$dirsToCheck = array('/home/ajkdirec/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }


My code in websiteMembership.php to read the cookie:

Plugin Name: Website Membership
Description: Website membership functions for user sign-up, password reminder, login, user specific content, and login only content
Version: 1.10
Requires at least: 2.52
Required System Plugin: True


$cookie_var = $_COOKIE['language'];

if ($cookie_var == "fr"){

$GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] = '/fr/user-login.php';





Hi Kovali,

It looks like the issue is the language cookie isn't always set, so the $_COOKIE['language'] variable can only be found when setCookie('language', 'fr') is set before the website membership plugin loads. This might fix the issue:

Plugin Name: Website Membership
Description: Website membership functions for user sign-up, password reminder, login, user specific content, and login only content
Version: 1.10
Requires at least: 2.52
Required System Plugin: True


$cookie_var = @$_COOKIE['language'];

if ($cookie_var == "fr"){
  $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] = '/fr/user-login.php';
  $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] = '/user-login.php';

So the @ symbol tells the code that if there is an error, it should ignore it. In this case that stops an error appearing if it can't find anything set for the $_COOKIE['language'] variable. 

Let me know if you have any questions.



Greg Thomas
PHP Programmer - interactivetools.com

Seems to work fine now! Thanks !!