WordPress.org

Ready to get started?Download WordPress

Forums

Paid Memberships Pro
[resolved] Control order that memberships are displayed on levels page (8 posts)

  1. Lisa
    Member
    Posted 1 year ago #

    How can I control the order that my memberships are displayed on my levels page?

    I entered my new membership ID's in order from 4-10, because that is the order that I wanted them displayed on the page.

    They do not display in that order, nor in order by price or alphabetically

    http://www.qpractice.com/membership-account/membership-levels/

    They should be displayed in this order according to the order of the ID's in the admin:

    ID 4 IDFX
    ID 5 IDPX
    ID 6 Practicum
    ID 7 Multiple Choice
    ID 8 Triple Play
    ID 9 Pass the Practicum
    ID 10 All Access Pass

    http://wordpress.org/extend/plugins/paid-memberships-pro/

  2. strangerstudios
    Member
    Plugin Author

    Posted 1 year ago #

    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

  3. Lisa
    Member
    Posted 1 year ago #

    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.

  4. mbenatar
    Member
    Posted 1 year ago #

    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

  5. strangerstudios
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  6. mbenatar
    Member
    Posted 1 year ago #

    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

  7. rdkelsey
    Member
    Posted 1 year ago #

    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.

  8. inator
    Member
    Posted 1 year ago #

    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 http://wordpress.org/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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic