• Resolved schlimpf

    (@schlimpf)


    There may be a bug when assigning multiple pages from one blog to a single page of another blog.
    When removing one assignment the Multiple Language Switcher Widget in the wp-admin is “out of sync” and shows inconsistent data.
    I think that the best solution would be to prevent assigning single pages to multiple of a second blog, or is this behaviour meant to be like this?

    Regards
    Mario

    https://www.ads-software.com/plugins/multisite-language-switcher/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Dennis Ploetner

    (@realloc)

    Sorry but I don’t understand this right away. How do you assign multiple pages to one page? The normal behaviour is that the plugin tries every time to sync when you click on the save-button.

    Cheers,
    Dennis.

    Thread Starter schlimpf

    (@schlimpf)

    Lets say your have two blogs:
    Blog A and Blog B

    Blog A has two Pages:
    Page A1
    Page A2

    Blog B has one Page:
    Page B1

    Go to Blog A and choose for A1 and A2 the translation B1.
    Now B1 has two translation in Blog A. I think that should be prevented.

    Regards

    Plugin Author Dennis Ploetner

    (@realloc)

    OK, thanks.

    The value stored in B1 – if you save first A1 and then A2 – is the ID of A2. So A1 is out of sync but A2 and B1 are OK.

    To resolve this problem quickly and clean just the value of A1 seems maybe quite easy but I’m not sure. What about clones, revisions and so on?

    To resolve this it wants in my opinion something like a batch which checks all connections.

    Thread Starter schlimpf

    (@schlimpf)

    Yes, I think that there is a check needed that deletes all other existing connections on post save/revision recover etc.

    Plugin Author Dennis Ploetner

    (@realloc)

    No. This is not just a simple check especially when you have a larger website. This is more something like the functionality when you optimize a database.

    Thread Starter schlimpf

    (@schlimpf)

    I dont see where this is a complicated check.
    I checked the code and saw how the connections are saved.

    My suggestion:

    Imagine this scenario:
    – Save connections from Blog A, lets say you have chosen postID1 from Blog B and postID2 from Blog C
    – Get connected post IDs from the other blogs (read msls_postID1, msls_postID2)
    – Get the postIDs that are in their option entries (at most BlogCount2 entries)
    – Update these antries and remove the postID1 and postID2 from these connections
    – Save msls_postID1, msls_postID2

    That should preserve the database integrity.
    Correct me if I am wrong ??

    Plugin Author Dennis Ploetner

    (@realloc)

    All this can be true if you can fully control the configuration which is in my opinion just the case if you run a site with a single user.

    An example:

    I have a client here which has a large website and they use a plugin called “Clone & Replace” so they can schedule posts (clones or new ones) for replacing an already published post.

    It is not so that I don’t want add new functionalities like yours but there is always a high chance to break something and then … anyway, I will add a filter in the save-method so everyone who is interested in can change the current functionality.

    Cheers,
    Dennis.

    Thread Starter schlimpf

    (@schlimpf)

    Ah I think I see your point here.
    Clone & Replace yould mean that the post_meta would also be copied and you would not have a (easy) way to prevent that the connections are duplicated as well, right?

    Thats true, I think this is a little bit more complicated. Although I think this is solvable, the work on this may not be worth it.
    I am thinking about customizing your plugin and adding dedicated tables for the connections between the posts. This may have some disadvatages that have to be solved (caching etc.), but for my purpose I think it would be a good solution.

    I will mark this topic as resolved, although I would like to see the filter you were talking about in future releases.
    Thanks for your great work! ??

    Plugin Author Dennis Ploetner

    (@realloc)

    I added a filter to MslsMain.php so you can completly override the save-method:

    function my_main_save( $object_id, $class ) {
    }
    add_filter( 'msls_main_save', 'my_main_save', 10, 2 );

    You’re welcome. ?? Cheers,
    Dennis.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Bug when assigning multiple pages of one blog to one page of another’ is closed to new replies.