Signup and Language Option

Discussion in 'Customization & add-ons' started by mumser101, Oct 13, 2009.

  1. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    Right now we have two parallel websites - one in English, one in Italian. If someone clicks on a membership link then we can pass the correct parameters to the signup page such as lang=it and price_group=-1 and this works perfectly.

    However, if a non-member tries to access a restricted area they get the login page and then must click to sign-up as a new user. When that happens, the page is always signup.php and no parameters are passed. It seems to me that some logic could be added to determine the current language (or if the user changes the language) and send the correct parameters to signup.php.

    I mean something like.

    If lang=it then signup$=signup.php?lang=it&price_group=-1.

    Changing the language by itself only changes the descriptors in the left column but does not change the product descriptions.

    Would appreciate any insights as to where/how to add the logic.

    Thanks!
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Try to add this at the top of signup.php and member.php pages:
    Code:
    session_start();
    if($_SESSION[amember_lang] == 'it'){
    $_REQUEST[price_group] = $_GET[price_group] = -1;
    }
    

    let me know if this will not help.
  3. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    This does work as far as changing the price group to -1, however a language change back to English still passes the price_group = -1 parameter. I tried adding

    if($_SESSION[amember_lang] == 'en'){
    $_REQUEST[price_group] = $_GET[price_group] = 0;

    but it generated an error (also tried adding ELSE instead of IF but it still generated an error). I don't know the syntax of PHP but we need to test for the language and send the appropriate price_group.

    This would be a useful option to add to the next release of aMember. I think an option in the Language section where you can link a language to a price_group would be helpful.
    The way it is now, the price_group always defaults to the 0 group regardless of the language setting. So, we are getting English product descriptions with Italian explanatory text.
  4. thehpmc

    thehpmc Member

    Joined:
    Aug 24, 2006
    Messages:
    901
    Your code:
    PHP:
    if($_SESSION[amember_lang] == 'en'){
    $_REQUEST[price_group] = $_GET[price_group] = 0;
    will throw up an error as there is no closing '}'
  5. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    Thanks...I had the closing brace, but what it needed was ELSEIF rather than IF or ELSE. It works perfectly now.

    PHP:
    session_start();
    if(
    $_SESSION[amember_lang] == 'it'){
    $_REQUEST[price_group] = $_GET[price_group] = -1;
    }
    elseif(
    $_SESSION[amember_lang] == 'en'){
    $_REQUEST[price_group] = $_GET[price_group] = 0;
    }
  6. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    As a followup to this issue:

    The Italian language signup is displaying perfectly with Italian translation. But what is happening now is that the error messages are coming up in English. I checked the language file and all the error messages are translated. I think this is a program logic issue.

    Alex: Any suggestions on how to add logic to make the error messages match the selected language?
  7. erwinvdb

    erwinvdb aMember Pro Customer

    Joined:
    Aug 30, 2007
    Messages:
    264
  8. mumser101

    mumser101 New Member

    Joined:
    Oct 1, 2009
    Messages:
    26
    The jquery file is only part of the story. There are a number of error responses in the language file that pertain to the signup process. At least, there should be a way to get the right language to display.

Share This Page