Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jason Coleman

    (@strangerstudios)

    The “pmpro_levels_array” filter passes the array of levels and you can then sort it how you need to.

    It is funny that our pmpro_getAllLevels() function doesn’t specify an order in the SQL query. So it would return the levels in random (but weighted toward ordering by ids) order. I’ll fix that in the next update to order by id. Here’s that function in GitHub:
    https://github.com/strangerstudios/paid-memberships-pro/blob/master/includes/functions.php#L1278

    Thread Starter lisaleague

    (@lisaleague)

    Hi!

    Thanks Jason,

    I eventually removed some of my levels as it was overwhelming anyway, but it would be great to be able to sort, or at least know they would be presented in order by id.

    Hello,
    Not sure if I understand this correctly AND I have seven membership levels that need to be in a specific order.
    \I am not a coder> Could you help me with the function? I went to the link that you posted but it’s a little confusing to me as to how to implement the code.

    Thank You,
    Marten

    Plugin Author Jason Coleman

    (@strangerstudios)

    mbenatar, if you can wait, the next version of PMPro will have this update included.

    Otherwise, you should be able to safely overwrite your copy of paid-memberships-pro/includes/functions.php with the “raw” version of that file at the GitHub link.

    Hello,
    I tried to copy the code directly into my paid-memberships-pro/includes/functions.php via FTP with my webhost. I came up with a blank screen and could not log backin to my wordpress admin screen.

    What am I doing wrong?

    Thanks,
    Marten

    I’m confused here also, and need to re-order the levels as they were originally set up.

    I have Level 1, Level 2 and Level 3, each as a different membership level. They are ID 1, 2 and 3 respectively.

    Now the boss wants to add another level that is a Free Trial and wants it listed first, rather than how ID 4 puts it at the end.

    How can I re-order the membership levels to be ID 4, ID 1, ID2 and ID 3?

    Thanks in advance for any help with this.

    I solved this in my levels.php page template by adding:

    <?php
    global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $pmpro_currency_symbol;
    
    //fix for level order issue
    //see https://www.ads-software.com/support/topic/control-order-that-memberships-are-displayed-on-levels-page
    ksort($pmpro_levels);

    Just add it right after the globals declaration (as shown above) and all will be right with your world.

    As an alternative, the functions.php could be modified to do the same, but I didn’t want to mess with modifying the plugin source. I created my own custom template pages so I’m good!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Control order that memberships are displayed on levels page’ is closed to new replies.