Scott P

Forum Replies Created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Scott P
    Participant

    Thanks, Cristián. That solves the membership options side of my question. When a member logs in they are taken to the English login welcome page. How does one override that based on conditionals?

    Cheers,
    Scott

    Scott P
    Participant

    Cristián,

    This goes into the MU plugin, of course but do I need to place it in a function and add it as an action to anything?

    Cheers,
    Scott

    Scott P
    Participant

    Cristián,

    That helps immensely! Many thanks! I will test it.

    if ( !empty($_REQUEST['_s2member_vars'] && ( ICL_LANGUAGE_CODE=='fr' ) ) ) {
       header('Location: http://mysite.org/'.strtolower(ICL_LANGUAGE_NAME_EN).'-member-options-page/?lang='.ICL_LANGUAGE_CODE);
       exit;
    }

    In my OP I also was interested in the Login Welcome page redirection. What signals that?

    Cheers,
    Scott

    Scott P
    Participant

    Hello Cristián,

    That one is easy. I can just query ICL_LANGUAGE_CODE for the single letter language code. So, for example, if I want to test if the user is in the French site I would just test if (ICL_LANGUAGE_CODE == ‘fr’). My challenge is in understanding how s2member fires the triggers that redirects the user to the members option page and how I can step in and and replace the default url if the user is in, for example, the French context. Ditto for the login welcome page. So my focus is on the s2member side and not WPML. I can see this being generally useful to anyone who needs to redirect based on any conditional that interests them.

    Your code example tests for a specific CCAP and then redirects if found. How would I change that to redirect if a specific condition is met? I guess I am trying to better understand the variable _s2member_vars.

    if (!empty($_REQUEST['_s2member_vars']) && strpos($_REQUEST['_s2member_vars'], 'ccap..ccap..element') !== false) {
       header('Location: http://mysite.org/french-member-options-page//?lang=fr');
       exit;
    }

    Many thanks,
    Scott

    Scott P
    Participant

    Hello Cristián,
    Many thanks for your code sample. I see you base it on CCAP which is cool and this has given me ideas for another s2m project.

    For the current site I have a lot of custom capabilities for the different courses but I’m actually using WPML to convert the English only site to multi-lingual and need to direct members in one language, say French or Spanish, to the login welcome page in their language rather than the English page. Likewise for the members option page there will be only one page for each language. In both cases I would like to direct language-specific users to their respective pages using conditionals such as:

    if ( ICL_LANGUAGE_CODE=='en' ) {  
    	// direct to English Login Welcome page url
    }
    if ( ICL_LANGUAGE_CODE=='fr' ) { 
    	// direct to French Login Welcome page url
    }

    Cheers,
    Scott

Viewing 5 posts - 1 through 5 (of 5 total)