Custom Fields
Re-Envisioned
Support MB Relationships Drag and drop order reset without consent

This topic contains 21 replies, has 4 voices, and was last updated by  Anh Tran 6 months ago.

  • Creator
    Topic
  • #11679
    Resolved
    Clayton Collie
    Participant

    I used the drag and drop functionality to arrange the relationships in the exact order I needed them to show on the front-end. Now they have reverted back to where when they were added to the database. Where is the order stored in the db? Why would it revert back? Frontend and backend match up so I know that there is not a sort order on the frontend.

Viewing 10 replies - 11 through 20 (of 21 total)
  • Author
    Replies
  • #12608

    Clayton Collie
    Participant

    Nice one Doug. I am seeing the same thing.

    Looks like the storage interface doesn’t have the db param.

    I think Anh removed the parameter in favor of the direct reference of `global wpdb’.

    The storage handler should do the same global reference probably.

    #12667

    Anh Tran
    Keymaster

    Hey guys,

    Thanks a lot for testing! I’ve fixed the bug that Doug pointed out. This bug prevents the data from saving. Can you please try the latest version on Github?

    https://github.com/wpmetabox/mb-relationships

    It’s the dev version and not the same as 1.4.1 version on .org. I will release version 1.5.0 if this works 🙂

    #12669

    Doug
    Participant

    Ahn – I just installed the dev version from GitHub. I can load, view, and save relationships again. But the original issue Clayton pointed out at the beginning of this thread is still happening.

    For example, and to be clear what’s happening… I have an EVENT post type and a relationship specified with a SPEAKER post type. Each EVENT typically has multiple SPEAKERs associated with it, and I have arranged those SPEAKERS in a specific order in the Relationship metabox on the relevant EVENT post admin page, and I want that order maintained.

    Assume those speakers are arranged like this:

    SPEAKER 1
    SPEAKER 2
    SPEAKER 3

    If I open up the SPEAKER 1 post and Update it, then go back to the relevant Event admin page, the new order in the Speaker metabox will now be:

    SPEAKER 2
    SPEAKER 3
    SPEAKER 1

    Sure, I can drag them back to the correct order. But I have to remember to do this. Seems like a specified order of posts should be maintained, regardless of whether any of them have been modified since the original relationships were created and order was specified.

    Sorry, long-winded. But hopefully clear what we see happening that is unexpected.

    #12670

    Anh Tran
    Keymaster

    Hi Doug,

    I’ve just made the video to check the problem. So far it works for me: http://recordit.co/mRNyr8h4f2. Can you try again?

    I also recorded another video to demonstrate more complex actions: http://recordit.co/MrHGxyfzAM

    It seems to work well on my side.

    #12680

    Doug
    Participant

    Thanks for the video, Anh.

    I created a fresh install of WP just for this, installed Meta Box, MB Custom Post Type, MB Relationships, and the Twenty Seventeen theme, and duplicated the steps you took in your first video. And yes, it’s working for me right now — order is preserved after updating a speaker post.

    But our staging and production servers are still bumping the last updated post to the bottom of the list. I’m going to slowly add back in pieces of our staging environment (plugins, theme files) to see if I can pinpoint what it is that causes the posts to reorder. If I find what it is, I’ll report back here.

    #12681

    Clayton Collie
    Participant

    Ahn,

    These videos look great. Looks like you have the defaults ort order in the admin set to use the new database columns? I like this being the default. Once it is set, they should not change.

    I can’t seem to find the github repo for the dev branch. All I see is master and check_relationship.

    #12682

    Clayton Collie
    Participant

    Doug, where are you finding the new package?

    #12684

    Doug
    Participant

    Update: Actually, scratch my report above. I think it’s working on our staging server now too.

    Just went back to test one more time, and related post order is preserved on our staging server too. Not sure why I saw it move yesterday, since I haven’t changed any of the plugins. But this issue seems to be fixed from what I can see. Thank you!

    @Clayton – I don’t think there is a separate dev branch on GitHub. Since I don’t see any dev branches either, I’m betting GitHub is dev for the MB team. I just grabbed master of MB Relationships and installed from that.

    #12685

    Clayton Collie
    Participant

    Thanks Doug. I did the same.

    Ahn, ran similar tests and it looks great. Please push the updates.

    Thanks for everything! This is a huge lifesaver for my clients.

    #12686

    Doug
    Participant

    Ok, one more update from me. I just updated MB Relationships on our production server too. Tested by updating one of our speakers, and then checking the event, and that speaker was bumped to the bottom of the list.

    However, after dragging the speaker back to the correct position on the event page, updating, then updating the same speaker again, the order was preserved. And it’s preserved every time now for that event.

    I tested our other events, here’s what I found (that mirrors what Clayton notes above)…

    Any new relationships that get created with the updated plugin code should preserve order, because of the way index order is getting set now. But for any existing posts that had relationships defined before updating the plugin, you must go into each of those posts, and update each post once to establish an index order for its related posts. Then specified post order will be preserved from that point forward.

Viewing 10 replies - 11 through 20 (of 21 total)

You must be logged in to reply to this topic.