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.
Thread Starter
joshc4
(@joshc4)
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?
Regards,
Josh
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.
Cheers,
Josh
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