change membership plugin text?

I want to change the displayed text strings. I noticed the plugin uses a .po file; is it possible to override the .po file in my theme directory so I can avoid modifying the plugin core?

  • ghc
    • Site Builder, Child of Zeus

    Oof! That’s a long read that went way deeper than I expected it to.

    If I simply place a modified translation into plugin/languages, I assume it will be lost when the plugin updates. Is there some way to put elsewhere?

    I’m not even trying to localize! This is just the first hack I thought of for changing the plugin text. Is there a better practice?

  • ghc
    • Site Builder, Child of Zeus

    I’m back on it.

    @tom.eagles: that plugin looks awesomely powerful… more than I need.

    I made my edits to the .po and generated a new .mo and everything’s fine.

    I still want to keep my localization file in a safer place.

    in membershipincludes/classes/membershippublic.php:28 I want to remove this action so I can rewrite it with my unique .mo path

    add_action('plugins_loaded', array(&$this, 'load_textdomain'));

    but my code isn’t working

    global $membershippublic;
    remove_action( 'plugins_loaded', array( $membershippublic, 'load_textdomain' ) );

    Is this just not going to work given the scope of class membershippublic?

  • ghc
    • Site Builder, Child of Zeus

    Since I made a mountain of this molehill before I figured it out, here’s the basic procedure that I used so far. I had SSH access and msgfmt was already on my server. If you’re doing this via FTP, you’ll need a program that generates .mo files from .po files.

    1) Go to wp-content/plugins/membership/membershipincludes/languages/

    2) Open membership.po, which contains the strings that were marked translatable in the plugin code

    3) Search the file for the string you want to change, which will be prefixed ‘msgid’

    4) Don’t change the string. On the following line, enter the translated/modified text between the quotes after ‘msgstr’

    5) type msgfmt -o membership.po to generate the localized .mo file, from which WordPress actually reads the translations.

    6) Reload page to see changes

  • Barry
    • DEV MAN’s Mascot

    I am still hoping to hear from Barry about the original topic; of moving the .mo outside of the plugin folder.

    You could basically copy the function that loads the language file into another plugin / functions.php and load the language file again – that should override the original.

  • ghc
    • Site Builder, Child of Zeus

    Thanks @Barry for the response. The function I’m thinking I’d need to override is on membershippublic.php:68

    function load_textdomain() {

    $locale = apply_filters( 'membership_locale', get_locale() );
    $mofile = membership_dir( "membershipincludes/languages/membership-$" );

    if ( file_exists( $mofile ) )
    load_textdomain( 'membership', $mofile );


    My experimentation and research hasn’t gotten this working yet. Simply adding and modifying that load_textdomain() seems to clash with a core function:

    Fatal error: Cannot redeclare load_textdomain() (previously declared in /home/user/ in /home/user/ on line 128

    As suggested in the codex, I attempted to remove that action it’s hooked to on line 28 with:

    global $membershippublic;
    remove_action('plugins_loaded', array($membershippublic, 'load_textdomain') );

    I’m not sure what to do next. What do you suggest?

  • PC
    • WPMU DEV Initiate


    Greetings of the day.

    I was doing a regular followup today and found that we missed your last post on this one.

    Are you still seeking support on this one ? Please let us know so that we can take it further and assist you on the same :slight_smile:

    Thanks for being a great community member !



  • Barry
    • DEV MAN’s Mascot

    When are you running your remove action? It has to be after the membership plugin has added it otherwise your code will do nothing.

    You, technically, don’t need to remove the action though – just add another mo file for the membership text domain and it should override.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.