Membership2 - editing/customizing page templates

Is it possible to edit some of the page templates?

For example:
- for our site all users will be existing clients - so on the "Account" page there's no need for an "Invoices" section
- all of our memberships will be free, but we don't want clients to be able to switch between memberships - so we would want to get rid of the "Change" link for memberships (and probably change the table contents for that section)
- and a few other changes

I know that with some plugins we could add a folder to our theme folder and put in the custom pages, but I can't even find the default pages to copy as my starting point.

Thanks,
Scott

  • Vinod Dalvi

    Hi Scott,

    I hope you are well today and thank you for your questions.

    In Membership 2 Pro plugin the Membership pages views are generated through shortcodes output. Every Membership page contains some type of shortcode like the Account page contains the ms-membership-account shortcode so you can just alter these shortcodes by removing existing function attached to this shortcode and attaching new one using the following functions.

    https://codex.wordpress.org/Function_Reference/remove_shortcode
    https://codex.wordpress.org/Function_Reference/add_shortcode

    You will find all these shortcodes are declared in the following Membership file on line number 100

    /wp-content/plugins/membership/app/controller/class-ms-controller-shortcode.php

    - for our site all users will be existing clients - so on the "Account" page there's no need for an "Invoices" section

    To remove the "Invoices" section from the account page, just try setting the show_invoices argument to false of ms-membership-account shortcode in the "Account" page as following.

    [ms-membership-account show_invoices="false"]

    You will find more information about these shortcodes on the following path.

    Admin Area -> Membership 2 -> Help -> shortcodes

    - all of our memberships will be free, but we don't want clients to be able to switch between memberships - so we would want to get rid of the "Change" link for memberships (and probably change the table contents for that section)

    To get rid of the "Change" link for memberships on the account page try using the show_membership_change argument of ms-membership-account shortcode as following.

    [ms-membership-account show_invoices="false" show_membership_change="no"]

    What table content do you want to change on that page?

    Best Regards,
    Vinod Dalvi

  • scottmcculloch

    Thanks for the info Vinod - I'll dig in... looks like just what I needed to know.

    Regarding the table content in the "Your Membership" area of the account page... I was thinking we might not need the "Expire date", but that's probably fine now that I think about it. What I will want to do is change formatting and language (i.e., add some additional classes to the table/rows/etc; and change the word "Memberships" - which would be throughout the front-end)

    Thanks,
    Scott

  • Vinod Dalvi

    Hi Scott,

    Thank you for your reply.

    Why do you want to add some additional classes to the table/rows/etc?

    If you want to add it to format the content then please tell me how you want it to format so that that i can help you to achieve it.

    change the word "Memberships" - which would be throughout the front-end)

    You can change/translate the text either by using "Network Wide Text Change" text change module of following Ultimate Branding plugin

    https://premium.wpmudev.org/project/ultimate-branding/#usage

    Or by adding the following code in the functions.php file of your child theme or using the attached small plugin which contains the following code.

    function wpmu_gettext_with_context( $translated_text, $untranslated_text, $domain ) {
    
            if (strpos($untranslated_text,'Membership') !== false) {
                $translated_text = str_replace("Membership","Custom Membership", $untranslated_text);
            }
    
        return $translated_text;
    }
    add_filter( 'gettext', 'wpmu_gettext_with_context', 10, 3 );

    In the above code change the text "Custom Membership" with the text that you want to use in place of the word "Memberships".

    Regards,
    Vinod Dalvi

  • Ash

    Hello @Scott

    I hope you are well today.

    Please add the following in your theme's footer.php after wp_footer():

    <script type="text/javascript">
    jQuery(function($) {
        var obj = $('.ms-account-wrapper table');
        if( obj.hasClass('uk-table') )
            obj.addClass('uk-table').addClass('uk-table-striped');
    
        var btn = $('button');
        if( btn.hasClass('uk-button') )
            btn.addClass('uk-button');
    });
    </script>

    This highly recommended to use a child theme in this case, as the changes will be lost when you will update the theme. You can learn more about child theme here: http://codex.wordpress.org/Child_Themes

    Hope it helps :slight_smile: Please feel free to ask more question if you have any.

    Cheers
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.