inpsyde / multilingual-press

The multisite-based free open source plugin for your multilingual WordPress websites.
https://multilingualpress.org/
GNU General Public License v3.0
233 stars 38 forks source link

More thant 10 results in Relationship Metabox #245

Open asadowski10 opened 7 years ago

asadowski10 commented 7 years ago

Hi team,

We use your plugin for one of our clients ( http://www.dassault-aviation.com/ ) and we have a linking problem in the Relationship Metabox.

More explanations :

I have one page with title "Falcon" on site 1 and we have an other page with the same title "Falcon" on site 2. When I want to create the link between the two pages using "Select Existing post...", the desired page does not go up in AJAX Response ...

In this case, how can i link the two pages ? Is it possible to you, to add a load more results ?

edit page dassault aviation wordpress

Thanks a lot !

Version Information

tfrommen commented 7 years ago

Hi there!

The logic behind the AJAX search is a simple get_posts() call with the s argument, triggering a search.

The only explanation I have for a post that matches your search query (even more: in its title!) not showing up is that the post has already been connected to some other post on the site you are currently on.

Can you verify on site 2 that the Falcon post is not yet connected to any post (on site 1)?

Maybe (if something really is off here) you might want to check directly in your database. To do so, try the following SQL query (that you have to adapt to your table prefix and site as well as post IDs, of course):

SELECT
    *
FROM
    wp_multilingual_linked
WHERE
    ml_type = 'post' AND ml_source_blogid != ml_blogid
    AND (
        (
            ml_source_blogid = 2 AND ml_source_elementid = 42
        ) OR (
            ml_blogid = 2 AND ml_elementid = 42
        )
    )

Just change the site ID (2 in the above code) and the post ID (42) to what your Falcon post is, and paste the result here, if any.

Best regards, Thorsten

By the way: any particular reason you are using WordPress 4.4.5? :)

tfrommen commented 7 years ago

Hi @asadowski10,

any news here? Did you investigate this any further?

I will close this sometime soon, unless there is still any problem here...

asadowski10 commented 7 years ago

Hi @tfrommen,

I'm back ! Sorry for the response time. I just made some new tests with real URL.

I have 2 contents but the linking doesn't work.

http://www.dassault-aviation.com/fr/passion/espace-decouverte/realite-augmentee/visuels-dassaultair3d/ blog_id 1 and post_id 42996 http://www.dassault-aviation.com/en/passion/discovery/augmented-reality/dassaultair3d-images/ blog_id 2 and post_id 43949

SELECT * FROM wp_multilingual_linked WHERE ml_type = 'post' AND ml_source_blogid != ml_blogid AND ( ( ml_source_blogid = 2 AND ml_source_elementid = 43949 ) OR ( ml_blogid = 2 AND ml_elementid = 43949 ) )

The SQL response is : ml_id : 6085 | ml_source_blogid : 43602 | ml_blogid : 2 | ml_elementid : 43949 | ml_type : post

ID : 43602 is a draf post on blog_id 1 the French Website.

I deleted the relationship from the back office between the draft post 43602 and post_id 43949 ( en ) then I redone my new relationship but that's the same problem :(

Can you help me solve the problem?

Best , Alex

NB : We are currently migrating to the 4.7.2 ;)

tfrommen commented 7 years ago

Hi,

so, to sum that up, the post you wanted to select actually had a relationship - which is why it didn't show up in the list. You then deleted the relationship (i.e., the according entry in the wp_multilingual_linked table). After that you ... could or could not select that post from the other site?

Cheers, Thorsten

asadowski10 commented 7 years ago

Hi @tfrommen,

Even when the content already has a relationship, it goes back up in the list and the relationship is not done with the right content.

In fact, i have 2 problems :

Best, Alex

asadowski10 commented 7 years ago

Hey @tfrommen, I hope you are well ?

Do you have some news about my problems ?

Thanks a lot ! Alex

tfrommen commented 7 years ago

Hi there!

Content that is already related should not be displayed in the (AJAX search) results. If this is the case then something is pretty broken (in your installation). Can you check (in your dev tools) if this really is the case by looking at the value of the radio input? It contains the post ID. Maybe you just have (for whatever reason) a duplicate with the same name (but different IDs)?

I also have a few questions:

Thanks in advance, Thorsten

asadowski10 commented 7 years ago

Hi @tfrommen !

If you want, to go faster, I can provide you by mail FTP / back office / phpmyadmin access on our dev env ? What is your mail ?

Thanks a lot !

tfrommen commented 7 years ago

Hi,

that might speed up things quite a bit, yes. You can send any credentials to support@multilingualpress.org.

Thanks in advance, Thorsten

asadowski10 commented 7 years ago

Hi @tfrommen Credentials sent !

Thanks !

asadowski10 commented 7 years ago

Hi @tfrommen Did you receive my email ? Best,

tfrommen commented 7 years ago

Hi @asadowski10,

well, the problem is that you have an ... let's call it unusual way of naming posts. 😛 You have 30 pages with "Falcon" in the title, and the page you are looking for (with the exact title "Falcon") ranks as 28th search result.

A post with a title that is exactly like your search phrase should rank higher than a page with the search phrase only being part of its title. But for some reason this is not the case. No idea if you have plugins running that modify the query (e.g., by hooking into pre_get_posts), or if there's something wrong in WordPress core...

Anyway, I'm afraid the only thing you can do now is to set up relations for posts not displaying in the search results manually in the DB. Sorry.

For a future version of MultilingualPress, we will include some sort of pagination or "show more" functionality.

Cheers, Thorsten

asadowski10 commented 7 years ago

Hi @tfrommen

Thanks a lot for your answer ! We look forward to this future development.

Best, Alex

tyrann0us commented 7 years ago

Workaround: Change numberposts to -1 in inc/relationship-control/Mlp_Relationship_Control_Data.php#102 until there will be a official solution.

Hube2 commented 6 years ago

I was just having a similar issue and found this. My first thought on starting to read this and seeing the results on the site I am working on is that the number of posts is being limited . Setting this to -1 could cause issues with an extremely large site, like the one that I'm dealing with. Perhaps a paged approach to allow getting more results.