• Resolved longbuxu

    (@longbuxu)


    I’m using TranslatePress to translate my page to Spanish, I wonder if the conditional logic can be chosen depending on the language. One user case is: sending confirmation on the language being chosen from TranslatePress by the user. If they chose spanish, then Actions->Email will send them an email in spanish content.

    I can’t find a way to pull out the field from this plugin or on main site into the Conditional Logic of Megaform.

    Have no clue how to use Webhook, if possible.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ali Khallad

    (@alikhallad)

    Hello,

    If you are using a field to allow the user to select the language, then it’s possible to use that field for conditional logic.

    You can add multiple rules. If you expect the language field to have multiple values like “Spanish, Espagnol, Español” you can click “Add Rules Group” to add more possible variations. If any of these variations is a match, the email will be sent. Then you can create another email with different rules for the other languages.

    Let me know if that answers your question.

    Plugin Author Ali Khallad

    (@alikhallad)

    To add to the above so it makes more sense. If you’re relying on another plugin, you need to create a hidden “language” field and assign it a dynamic value ( from GET params for example ). For the time being, best option is to add a language parameter to the URL when the user visits the form page /?lang=es for example, and set it as default value using merge tags inside a hidden field, which in turn can be used for the conditional logic as outlined above. The other option is to use “user_meta” merge tags if the language is stored in the user meta.

    For your suggestion, we’ll try to add more options for default values in the future like cookies, or shortcode values to help you pull data stored by other plugins.

    Thank you very much

    Thread Starter longbuxu

    (@longbuxu)

    Thank you for the workaround idea.

    Plugin Author Ali Khallad

    (@alikhallad)

    No worries, happy to help.

    Feel free to open a new ticked if you face any challanges.

    Thanks,
    Ali

    Thread Starter longbuxu

    (@longbuxu)

    I can confirm it works! I’d like to write the steps here for anyone searching for this:

    My site is: http://www.examplesite1.com

    Plugins: megaform, translatePress with English, and Spanish activated.

    In Megaform, create a New Form:

    + Add Hidden field:

    Field Label: language

    Default value: click on 3 dots, choose WordPress, choose Site URL, this value will show as {mf:wp site_url}.

    + Then add a One Line Text field, for example:

    Field Label: Nombre

    Advanced: turn on Conditional Logic, Show this field if:

    language | Contains | /es

    Then embed this form into a page with shortcode [megaforms id=1].

    Browse to the site: http://www.examplesite1.com. Nombre field will not show, default language is English, the Site URL being “www.examplesite1.com”, which doesn’t contain “/es” in it.

    Choose language from switcher to Spanish, the site URL ow will be “www.examplesite1.com/es/”, which contains “/es” in it, then this Nombre field will show up.

    This will only work with a proper Permalinks which show /es in its URL.

    It can be confused if the Site URL contains another string /es which isn’t related to Spanish language. For example, it the site URL, in English, is “www.examplesite1.com/how-to20%-study-20%/espanol-in-free-time/”, this Nombre field will show up, because Site URL contains the string “/es”.

    • This reply was modified 8 months, 3 weeks ago by longbuxu.
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘suggestions: conditional logic with field or shortcode from another plugins.’ is closed to new replies.