Support » Plugin: Subscribe2 » Compatibility with WPML

  • Resolved MercedesWPML


    Hi there,
    My name is Mercedes from WPML. We are working on the compatibility with your plugin and found that it works ok, except for one thing: a notifications feature doesn’t send emails based on the subscribers language. Can you please drop me a line to fix this?

Viewing 15 replies - 1 through 15 (of 19 total)
  • mattyrob



    I looked at this a few years ago and at that time I needed an API in WPML to get users preferred language, preferably in groups. Does that now exist?



    Hi Matty,

    WPML API exists. We can help you with the technical issues.




    I know an API exists but it didn’t offer what I needed when I last checked:

    Has this now been added?

    hi again,
    excuse the delay. We have checked another issue with Subscribe2 and found the following:
    There’s a problem with separating the emails according to the subscribers language.
    Our suggestion:
    1) In the wp_subscribe2 table add one more column e.g ‘value’ and there store the language code for each subscriber
    2) In publish() function check the post language code and filter out the recipients according the language code
    $language_information = wpml_get_language_information($post_id);
    $locale = $language_information[‘locale’];
    3) Send an email notification of a new post
    Does this make sense?

    Can you let me know please?


    Thanks for the suggestion. There are another few issues that I need to know how to handle:

    1. Subscribe2 supports 2 subscribe types. Public and Registered. The wp_subscribe2 table is for Public and the core user and usermeta tables are used for Registered. How can I retrieve the preferred language for Registered users?

    2. The email is created by switching some dynamic content into an email template using keywords. Can WPML translate the database stored variables – like the templates at execution time? My concern is that local changes from default may get lost as translation files may be used in preference.

    I just discovered this plugin, and I’m thrilled to see this active discussion on getting it WPML-compatible.

    I’m not sure what all this might involve, but a multilingual version might be more involved. Here are a few other needs I can think of (these are real use cases in my website, not hypothetical ones):

    * The e-mail notification templates would need a version of each template in each language. The WPML String Translation module can handle translations of some plugin strings, but I don’t know if it could handle Subscribe2’s template keywords. Perhaps Mercedes could shed light on this.

    * Some users want multilingual notifications–that is, they want to receive posts from multiple languages, not just one language. Whereas it might make sense to use the current site language for public subscribers, registered subscribers should be given the choice of languages. Even in the digest setting, registered subscribers should be given choice of languages to receive. Thus, I suggest to revise Mercedes’ suggestion above: rather than storing just one language code per subscriber, multiple codes should be stored. However, the subscriber should pick one language as the default (for receiving e-mails).

    I know this is a lot to ask from a free plugin. Regardless of whether you can implement this multilingual functionality, thanks for providing such a great plugin.

    @mattyrob, our developer replied:
    1. I would suggest to use the wp_usermeta table and store the language code there. WPML plugin does not keep any preferred language for registered users, so I think it should be handled by Subscribe2 plugin.
    2. Yes, WPML can translate all texts from the database. You should use icl_translate( context, name, value ) or icl_register_string( context, name, value ) function. More information about these functions is here:…

    Feel free to e-mail me directly if you want to interact with him directly


    @ochado, checking with the team…


    Is there a way to produce a language selector from WPML that uses HTML input tags?

    Hi Matty,

    I don’t know if these links answer your question, but here’s WPML’s documentation on their language selector options and how to customize the selector:




    I had seen those and tried the do_action() approach. It creates an unordered list. (UL and LI). I need a SELECT and OPTION approach. It looks like I may need to create from scratch if I attempt this.


    Of course, I’m just a user, so I don’t understand the inner workings of WPML. However, I am curious why the format of the Language Switcher (a front-end, site-specific decision) has anything to do with how Subscribe2 multilingual functionality might work.

    WPML has a pseudo-SELECT/OPTION approach; you can see it in function on this website that I run: (top-right corner). Actually, it is a UL/LI list, apparently formatted as a dropdown box in CSS: I don’t know if that helps you in mapping WPML’s UL/LI format to what you would expect in a SELECT/OPTION output.


    The issues is that the current UL/LI apporach does not pass any selected data through the browser to the server so I cannot capture it in Subscribe2 and process it. I suspect WPML is using some client side javascript or even coding direct links to translated content into that dropdown menu. Although it works fine for WPML I need something different to start making Subscribe2 work well with WPML.

    @mattyrob, what kind of data are you looking for? Language codes? WPML stores all that in cookies:

    Anyway, hopefully @mercedeswpml can provide authoritative answers.

    I am getting all the messages. I am checking with the tech team and will let you know sson

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Compatibility with WPML’ is closed to new replies.