Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display "Pages that use the shortcode" is faulty #575

Open
fredericalpers opened this issue Jun 20, 2023 Discussed in #530 · 14 comments
Open

Display "Pages that use the shortcode" is faulty #575

fredericalpers opened this issue Jun 20, 2023 Discussed in #530 · 14 comments
Assignees
Labels
up for discussion Issues and Pull Requests which will be discussed

Comments

@fredericalpers
Copy link
Member

Discussed in #530

Originally posted by fredericalpers May 24, 2023

Current state

At the moment it seems that the form & list shortcodes are permanently displayed for all languages. For example, if there is a form in DE and EN on the home page, "Home" is displayed 2 times.

anzeige-shortcode1

Desired state

Only the pages for the currently selected / relevant language should be displayed.

@fredericalpers fredericalpers added this to the v4.16 milestone Jun 20, 2023
@fredericalpers fredericalpers modified the milestones: v4.16, v4.17 Aug 11, 2023
@fredericalpers fredericalpers modified the milestone: v4.17 Sep 18, 2023
@dai-eastgate
Copy link
Contributor

dai-eastgate commented Sep 25, 2023

@fredericalpers

  1. Did you create two "Home" pages that follow the steps I did in the video below?
cmt_home_page.mp4
  1. We will have 2 cases that can happen:
  • Case 1: If you use "Site Language" to create two "Home" pages as mentioned in the video above. This is my solution:
    Desired state: Only the pages for the currently selected / relevant language should be displayed.
    Now, WordPress core does not support detecting the "language of page" when adding a new page.

=>We need to add a new table(table: see detail table below) to the database to detect the "language of page" when adding a new page.

Note: table wp_oo_plugin_detect_language_page
detect_language_page_id (PRIMARY KEY),
embed_shortcode_form_page_id (page id with embedded shortcode),
locale

=> Do you agree with my solutions?

  • Case 2: If you use a Multilingual Plugin (like WPML, or Polylang...) => we will have to detect the "language of page" depending on "The language switcher" of that plugin.
    => Please let me know which Multilingual Plugins you need to support.

@fredericalpers
Copy link
Member Author

@dai-eastgate I will be able to give you feedback tomorrow, thank you :)

@fredericalpers
Copy link
Member Author

fredericalpers commented Sep 26, 2023

@dai-eastgate Please implement case 1 as suggested.

For case 2 we definitely want to support the most used multilingual plugins. Would it be easier for you to implement WPML first (WPML has priority since this is the plugin we are mostly using) and have a second issue for Polylang and maybe others later on/in the next milestones rather then implementing all at once?

@dai-eastgate
Copy link
Contributor

@fredericalpers I will check and let you know soon.

@dai-eastgate
Copy link
Contributor

dai-eastgate commented Oct 3, 2023

@fredericalpers It will take me 5 days to implement and test for case 1 and the WPML plugin. Thanks!

@dai-eastgate
Copy link
Contributor

dai-eastgate commented Oct 4, 2023

@fredericalpers We have two solutions for "detecting language for page" Which Pages using the shortcode:
Solution 1: We can add an option in the "onoffice > settings" as in the image below

image

=> detect language based on the "General settings of WordPress" or multilingual plugins (WPML, Polylang).

Solution 2: Detecting language allowed by prioritizing as follows: we will prioritize based on the multilingual plugin that the client installed. If no multilingual plugin is installed, we will detect by "Site Language" of "General Settings of Wordpress"
image

@dai-eastgate
Copy link
Contributor

@fredericalpers Which solution do you prefer us to implement?

@fredericalpers
Copy link
Member Author

@dai-eastgate sorry for the late reply. We prefer solution 2.

Solution 2: Detecting language allowed by prioritizing as follows: we will prioritize based on the multilingual plugin that the client installed. If no multilingual plugin is installed, we will detect by "Site Language" of "General Settings of Wordpress"

Please go ahead and implement the suggested solution. Thank you :)

@dai-eastgate
Copy link
Contributor

@dai-eastgate sorry for the late reply. We prefer solution 2.

Thanks! I will implement solution 2.

@dai-eastgate
Copy link
Contributor

@fredericalpers Currently, I am checking issue #491 , which needs to be resolved before I can continue working on issue #575. Based on my estimation before, it is necessary to move the issue to the ramp-up week. Thanks!

@dai-eastgate
Copy link
Contributor

dai-eastgate commented Oct 17, 2023

@fredericalpers During implementation, I noticed the following problems:
Problem 1:
If no multilingual plugin is installed, we will detect by "Site Language" of "General Settings of WordPress"
=> Pages which are added by old users in different languages will only be detected as the current language
ex:
The current language which is set in "Site Language" of "General Settings of WordPress": English
old users added "page English" in English
old customers added "page Deutsch" in Deutsch
=> "page English", and "page Deutsch" will only be detected as pages added in "English language"

video_1.mp4

Because we can only handle the "add new a page" action and save it to the current language "wp_oo_plugin_detect_language_page" table in the database.

image

You can see the code.
image

=> There is no solution to this problem

Problem 2:
Please provide me with the correct "Path to the plugin file relative to the plugins directory." of wpml. Currently, I am checking it like this "sitepress-multilingual-cms/sitepress.php". Is this correct?

Currently, we have completed 80% of this feature and are blocking the above 2 issues.

video_2.mp4
video_3.mp4

Please test the branch we are working on (35073-display-pages-that-use-the-shortcode-is-faulty) and give me your feedback.
=> We need 3 more days to be able to check this issue more specifically.

@dai-eastgate
Copy link
Contributor

@fredericalpers When I tested on the master branch, I had the following states:
I perform the following steps:
Step 1: I create a new page, named as "list" and embed the [oo_estate view="list estate"] shortcode into the content of this page.
=> This page(named as "list") will be displayed in the "Pages using the shortcode" admin part of the estate list
image

Step 2: I delete that shortcode in content of this page(named as "list") => This page(named as "list") still be displayed in the "Pages using the shortcode" admin part of the estate list.
image

Please confirm:
what attributes of a page will be displayed in the "Pages using the shortcode" admin part of the estate list?

According to my understanding:
That page must have 2 attributes:

  • embedded shortcode "[oo_estate view="list estate"] in content of this page.

image

  • This page has "public" status

image

@dai-eastgate
Copy link
Contributor

@fredericalpers Please confirm it for me so I can continue with the implementation. Thanks

@fredericalpers
Copy link
Member Author

@fredericalpers Please confirm it for me so I can continue with the implementation. Thanks

@dai-eastgate sorry, I will get back to you asap

@dai-eastgate dai-eastgate self-assigned this Oct 25, 2023
@fredericalpers fredericalpers added the up for discussion Issues and Pull Requests which will be discussed label Nov 9, 2023
@fredericalpers fredericalpers removed this from the v4.17 milestone Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
up for discussion Issues and Pull Requests which will be discussed
Projects
None yet
Development

No branches or pull requests

2 participants