Hide Upgrade Text When Only One Subscription

I'm currently using Membership for a new site that I'm working on. The site only contains one subscription option. What I would like to do is hide the upgrade prompt when viewing the subscriptions page for a user who is already subscribed. Is there a way to do this without hacking core files?

I realize I could do it using CSS, but am wondering if there's a way to just not have it output the content period.

Thanks!

  • aecnu
    • WP Unicorn

    Greetings plumwd,

    Thank you for this great question.

    To the best of my knowledge this can only be accomplished by way of hacking the core files and there is no option I am aware of that allows one to "disable upgrades" so to speak.

    I am 99% sure that this would involve either hacking the core files or possibly a manual database entry which in both cases would probably result in being overwritten on the first update.

    However, have you tried setting the single subscription to indefinite or serial?

    This may indeed accomplish this mission without the need of further coding action.

    Please advise.

    Cheers, Joe

  • plumwd
    • New Recruit

    I had it set to serial already, so I made the change to indefinite this morning and it didn't change anything. CSS it is!

    Might I suggest that become a feature? Doesn't make sense to offer an upgrade if here is only one subscription.

  • aecnu
    • WP Unicorn

    Greetings plumwd,

    Might I suggest that become a feature? Doesn't make sense to offer an upgrade if here is only one subscription.

    Absolutely agree and I shall start the process now by moving this ticket to feature suggestions and notifying the lead developer of the suggestion.

    It would help further to put your feature request here:
    http://wpmudev.uservoice.com/

    The more popular a request is and the more votes it gets, the more likely it will be considered.

    It might have already been suggested. It is worth a quick search to add your votes before submitting a new suggestion.

    Thank you for being a WPMU Dev member!

    If we can be of further assistance please let us know.

    Cheers, Joe :slight_smile:

  • Emanaku
    • The Incredible Code Injector

    Hi plumwd,

    if you are not comfortable with the CSS solution you can also use the filter 'membership_override_renew_form' (I am not sure what is better :wink: ).

    You would do it like this:

    1. In your themes functions.php you include these lines:

    add_filter('membership_override_renew_form','other_renew_form');
    
    function other_renew_form($file) {
    	return locate_template('my-own-renew-form.php', false);
    }

    2. In your theme directory you create a new file 'my-own-renew-form.php' by copying the membership/includes/renew.form.php

    3. The fastest way to get rid of the "Upgrade to ..." is by replacing the if in line 294
    if( $upgradedat <= strtotime('-' . $period . ' days') ) {
    by
    if( false ) { // prevents display of upgrades
    This prevents the upgrade options to be shown.

    Additional bonus: In this new file you can also change the text "Your Subscriptions" into "Your Subscription" :wink:

    Have fun!!

  • Emanaku
    • The Incredible Code Injector

    I think the plugin could be easily changed to provide two shortcodes instead of the one [renewform]:

    One shortcode could just show the subscription the user has,
    and another one could show the available upgrade options.

    With that we could simply choose where we would like to show the subscriptions of a user only without also showing the upgrades.

    That would also solve plumwd's problem.

  • Barry
    • DEV MAN’s Mascot

    One shortcode could just show the subscription the user has,
    and another one could show the available upgrade options.

    With that we could simply choose where we would like to show the subscriptions of a user only without also showing the upgrades.

    Could add one shortcode to just show the subscriptions and one to show the subscriptions and the upgrades.

    The way the plugin is currently written, means that the upgrade paths are displayed underneath each subscription.

    E.G. It goes:
    Subscription one

    Upgrade from one
    Upgrade from one
    Upgrade from one

    Subscription two
    Upgrade from two
    upgrade from two
    upgrade from two

    etc...

    So the other method wouldn't be possible.

  • Emanaku
    • The Incredible Code Injector

    @Barry: I see now that it would be better to have one shortcode for just the subscriptions and one shortcode for the subscriptions plus upgrade options.

    Is there a place here in the forum to make a proposal for extending/changing plugins?

    The above mentioned link wpmudev.uservoice.com is only for proposing new plugins and themes ...

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.