Support » Plugin: WP-Members Membership Plugin » wpmem_gettext returning default values

  • Resolved joshc4


    Hi, Chad

    I’m trying to use wpmem_gettext( 'restricted_msg' ), as in your example, and it’s returning the default dialog text, rather than what’s currently in the admin UI and (confirmed) in my database. Is this the expected behavior, or am I possibly missing something about how to use this method?


    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chad Butler


    The wpmem_gettext() function retreives default strings for all of the user-facing (front end) strings. It is not used to retrieve any custom values (such as those dialogs that are customizable in the admin panel).

    Sorry if that wasn’t clear from the documentation. I actually change the example in the docs to use one that is not a customizable dialog so that it may hopefully be less confusing.

    The function is primarily used for two scenarios – multilingual sites, and for instances of customizing messages that are not customizable in the admin.

    Thanks, Chad. So, I guess by your response I may be out of luck, but is there a similar method for getting the current strings, as set in the admin, to populate sections of a custom template?



    Plugin Author Chad Butler


    The answer really depends on the application. I would recommend that if you’re doing something more custom (and it sounds like you are), then pulling the message from the settings is probably unnecessary when you could just apply something in the custom process.

    Obviously you can use the wpmem_gettext() to get the default value.

    If you want the custom/customizable value (which would be whatever is in the Dialogs tab), you could do:

    $dialogs = get_option( 'wpmembers_dialogs' );
    echo $dialogs['restricted_msg'];

    Sorry, I’m not a seasoned WP dev (although, yeah, this is a very custom project), and if I were, I suppose that would have been obvious. Works perfectly, thanks.



    Plugin Author Chad Butler


    Sorry – just meant “obvious” only as in we’d already mentioned it in the thread. Since I was mentioning two possibilities in that answer, one of which we’d already talked about, that was the obvious one. The other, not so much.

    By “obvious,” I meant that the solution would have been obvious to me if I’d done more (any) custom WP work before. There’s a lot of fundamental WP API that I don’t know off the top of my head. Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wpmem_gettext returning default values’ is closed to new replies.