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

Fix: Image Generation & Edit triggering from WP media library [ED-15079] #27688

Merged
merged 1 commit into from
Jun 16, 2024

Conversation

netanelavr
Copy link
Member

@netanelavr netanelavr commented Jun 16, 2024

PR Checklist

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Summary

This PR can be summarized in the following changelog entry:

Ensure that Elementor AI will work on the Media Library only in the Admin Dashboard

Description

Some plugins seem to be doing something wrong, and they are running the WP media library popup on the visitors side (the website, instead of the admin dashboard).
It caused Elementor AI to run too, but Elementor AI was not designed to work on the visitors side.
So, we added a condition to ensure that Elementor AI will work on the Media Library only in the Admin Dashboard, even when a plugin runs it on the visitors side.

Test instructions

This PR can be tested by following these steps:

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended
  • Docs have been added / updated (for bug fixes / features)

Fixes #

@netanelavr netanelavr merged commit 9788a7d into elementor:main Jun 16, 2024
47 of 51 checks passed
netanelavr added a commit to netanelavr/elementor that referenced this pull request Jun 16, 2024
@toineenzo
Copy link
Contributor

toineenzo commented Jun 17, 2024

If for any reason this may be helpful (in the future): this is the error log I got when having the Real Media Library plugin enabled. Disabling it would fix the error 500 with the editor. Please see error log and system info attached.


Fatal error: Uncaught Error: Call to a member function get_component() on null in /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php:442 Stack trace: #0 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php(301): Elementor\Modules\Ai\Module->get_ai_app() #1 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php(182): Elementor\Modules\Ai\Module->get_ai_connect_url() #2 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): Elementor\Modules\Ai\Module->enqueue_ai_media_library() #3 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #4 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action() #5 /home/u52543p64574/domains/toine.zip/dev/wp-includes/media.php(4957): do_action() #6 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/real-media-library-lite/inc/Assets.php(87): wp_enqueue_media() #7 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/real-media-library-lite/vendor/devowl-wp/utils/src/Assets.php(546): MatthiasWeb\RealMediaLibrary\Assets->enqueue_scripts_and_styles() #8 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): MatthiasWeb\RealMediaLibrary\Assets->wp_enqueue_scripts() #9 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #10 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action() #11 /home/u52543p64574/domains/toine.zip/dev/wp-includes/script-loader.php(2265): do_action() #12 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): wp_enqueue_scripts() #13 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #14 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action() #15 /home/u52543p64574/domains/toine.zip/dev/wp-includes/general-template.php(3050): do_action() #16 /home/u52543p64574/domains/toine.zip/dev/wp-content/themes/hello-elementor/header.php(24): wp_head() #17 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template.php(810): require_once('/home/u52543p64...') #18 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template.php(745): load_template() #19 /home/u52543p64574/domains/toine.zip/dev/wp-includes/general-template.php(48): locate_template() #20 /home/u52543p64574/domains/toine.zip/dev/wp-content/themes/hello-elementor/index.php(15): get_header() #21 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template-loader.php(106): include('/home/u52543p64...') #22 /home/u52543p64574/domains/toine.zip/dev/wp-blog-header.php(19): require_once('/home/u52543p64...') #23 /home/u52543p64574/domains/toine.zip/dev/index.php(17): require('/home/u52543p64...') #24 {main} thrown in /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.phpon line 442
Er heeft zich een kritieke fout voorgedaan op deze site.
Meer informatie over probleemoplossing in WordPress.
Uncaught Error: Call to a member function get_component() on null in /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php:442
Stack trace:
#0 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php(301): Elementor\Modules\Ai\Module->get_ai_app()
#1 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php(182): Elementor\Modules\Ai\Module->get_ai_connect_url()
#2 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): Elementor\Modules\Ai\Module->enqueue_ai_media_library()
#3 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#4 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action()
#5 /home/u52543p64574/domains/toine.zip/dev/wp-includes/media.php(4957): do_action()
#6 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/real-media-library-lite/inc/Assets.php(87): wp_enqueue_media()
#7 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/real-media-library-lite/vendor/devowl-wp/utils/src/Assets.php(546): MatthiasWeb\RealMediaLibrary\Assets->enqueue_scripts_and_styles()
#8 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): MatthiasWeb\RealMediaLibrary\Assets->wp_enqueue_scripts()
#9 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#10 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action()
#11 /home/u52543p64574/domains/toine.zip/dev/wp-includes/script-loader.php(2265): do_action()
#12 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): wp_enqueue_scripts()
#13 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#14 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action()
#15 /home/u52543p64574/domains/toine.zip/dev/wp-includes/general-template.php(3050): do_action()
#16 /home/u52543p64574/domains/toine.zip/dev/wp-content/themes/hello-elementor/header.php(24): wp_head()
#17 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template.php(810): require_once('/home/u52543p64...')
#18 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template.php(745): load_template()
#19 /home/u52543p64574/domains/toine.zip/dev/wp-includes/general-template.php(48): locate_template()
#20 /home/u52543p64574/domains/toine.zip/dev/wp-content/themes/hello-elementor/index.php(15): get_header()
#21 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template-loader.php(106): include('/home/u52543p64...')
#22 /home/u52543p64574/domains/toine.zip/dev/wp-blog-header.php(19): require_once('/home/u52543p64...')
#23 /home/u52543p64574/domains/toine.zip/dev/index.php(17): require('/home/u52543p64...')
#24 {main}
  thrown

== Server Environment ==
	Operating System: Linux
	Software: Apache/2
	MySQL version: MariaDB Server v10.4.27
	PHP Version: 8.1.28
	PHP Memory Limit: 2048M
	PHP Max Input Vars: 3000
	PHP Max Post Size: 128M
	GD Installed: Yes
	ZIP Installed: Yes
	Write Permissions: All right
	Elementor Library: Connected

== WordPress Environment ==
	Version: 6.5.4
	Site URL: https://dev.toine.zip
	Home URL: https://dev.toine.zip
	WP Multisite: No
	Max Upload Size: 128 MB
	Memory limit: 40M
	Max Memory limit: 2048M
	Permalink Structure: /%postname%/
	Language: nl_NL
	Timezone: Europe/Amsterdam
	Admin Email: [email protected]
	Debug Mode: Active

== Theme ==
	Name: Hello Elementor
	Version: 3.0.2
	Author: Elementor Team
	Child Theme: No

== User ==
	Role: administrator
	WP Profile lang: nl-NL
	User Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1

== Active Plugins ==
	Advanced Custom Fields PRO
		Version: 6.3.1.2
		Author: WP Engine

	Elementor
		Version: 3.22.0
		Author: Elementor.com

	Elementor Pro
		Version: 3.22.0
		Author: Elementor.com

	Real Media Library (Free)
		Version: 4.22.15
		Author: devowl.io

	WooCommerce
		Version: 8.9.3
		Author: Automattic


== Eigenschappen ==
	Custom Fonts: 0
	Custom Icons: 0

== Integraties ==
	
	woocommerce: Actief


== Elementor experimenten ==
	Verbeterd laden van assets: Standaard actief
	Verbeterd laden van CSS: Actief
	Iconen inline lettertype: Actief
	Extra aangepaste breakpoints: Actief
	Flexbox container: Actief
	Raster container: Actief
	Upgrade Swiper bibliotheek: Actief
	Geneste elementen prestaties: Actief
	Geoptimaliseerde laden van besturing: Actief
	Geoptimaliseerde markup: Actief
	Plugin onboarding: Actief
	Standaard naar nieuwe Thema bouwer: Actief
	Hello Theme header & footer: Actief
	Elementor home scherm: Standaard actief
	Editor top balk: Actief
	Bouwen met AI: Actief
	Landingspagina's: Actief
	Geneste elementen: Actief
	Lazy-load achtergrondafbeeldingen: Actief
	Pagina's paneel: Actief
	Element caching: Inactief
	Conversiecentrum: Actief
	Weergave voorwaarden: Actief
	Formulierinzendingen: Actief
	Menu: Actief
	Taxonomiefilter: Actief


== Log ==
	
PHP: showing 4 of 4PHP: 2024-05-22 01:38:50 [notice X 30][/home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/includes/base/controls-stack.php::229] hexdec(): Passing null to parameter #1 ($hex_string) of type string is deprecated [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2024-05-22 23:39:09 [warning X 4][/home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/includes/managers/image.php::113] Trying to access array offset on value of type bool [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]
PHP: 2024-06-11 04:23:53 [warning X 7][/home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor-pro/modules/loop-filter/query/taxonomy-manager.php::150] Undefined array key "logicalJoin" [array (
  'trace' => '
#0: /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor-pro/modules/loop-filter/query/taxonomy-manager.php(150): Elementor\Core\Logger\Manager -> rest_error_handler()
#1: /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor-pro/modules/loop-filter/query/taxonomy-query-builder.php(33): ElementorPro\Modules\LoopFilter\Query\Taxonomy_Manager -> get_hierarchy_of_selected_terms()
#2: /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor-pro/modules/loop-filter/module.php(124): ElementorPro\Modules\LoopFilter\Query\Taxonomy_Query_Builder -> get_merged_queries()
#3: /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): ElementorPro\Modules\LoopFilter\Module -> filter_loop_query()
#4: /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(205): WP_Hook -> apply_filters()
',
)]
PHP: 2024-06-16 23:52:22 [error X 7][/home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php::442] Uncaught Error: Call to a member function get_component() on null in /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php:442
Stack trace:
#0 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php(301): Elementor\Modules\Ai\Module->get_ai_app()
#1 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/elementor/modules/ai/module.php(182): Elementor\Modules\Ai\Module->get_ai_connect_url()
#2 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): Elementor\Modules\Ai\Module->enqueue_ai_media_library()
#3 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#4 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action()
#5 /home/u52543p64574/domains/toine.zip/dev/wp-includes/media.php(4957): do_action()
#6 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/real-media-library-lite/inc/Assets.php(87): wp_enqueue_media()
#7 /home/u52543p64574/domains/toine.zip/dev/wp-content/plugins/real-media-library-lite/vendor/devowl-wp/utils/src/Assets.php(546): MatthiasWeb\RealMediaLibrary\Assets->enqueue_scripts_and_styles()
#8 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): MatthiasWeb\RealMediaLibrary\Assets->wp_enqueue_scripts()
#9 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#10 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action()
#11 /home/u52543p64574/domains/toine.zip/dev/wp-includes/script-loader.php(2265): do_action()
#12 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(324): wp_enqueue_scripts()
#13 /home/u52543p64574/domains/toine.zip/dev/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#14 /home/u52543p64574/domains/toine.zip/dev/wp-includes/plugin.php(517): WP_Hook->do_action()
#15 /home/u52543p64574/domains/toine.zip/dev/wp-includes/general-template.php(3050): do_action()
#16 /home/u52543p64574/domains/toine.zip/dev/wp-content/themes/hello-elementor/header.php(24): wp_head()
#17 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template.php(810): require_once('/home/u52543p64...')
#18 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template.php(745): load_template()
#19 /home/u52543p64574/domains/toine.zip/dev/wp-includes/general-template.php(48): locate_template()
#20 /home/u52543p64574/domains/toine.zip/dev/wp-content/themes/hello-elementor/index.php(15): get_header()
#21 /home/u52543p64574/domains/toine.zip/dev/wp-includes/template-loader.php(106): include('/home/u52543p64...')
#22 /home/u52543p64574/domains/toine.zip/dev/wp-blog-header.php(19): require_once('/home/u52543p64...')
#23 /home/u52543p64574/domains/toine.zip/dev/index.php(17): require('/home/u52543p64...')
#24 {main}
  thrown [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]

Log: showing 20 of 272024-05-23 00:05:25 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta2',
  'to' => '3.22.0-beta3',
)]
2024-05-23 00:05:25 [info] elementor-pro::elementor_pro_updater Started 
2024-05-23 00:05:25 [info] Elementor Pro/Upgrades - _on_each_version Start  
2024-05-23 00:05:25 [info] Elementor Pro/Upgrades - _on_each_version Finished 
2024-05-23 00:05:25 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta2',
  'to' => '3.22.0-beta3',
)]
2024-05-28 23:16:48 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta3',
  'to' => '3.22.0-beta4',
)]
2024-05-28 23:16:48 [info] elementor-pro::elementor_pro_updater Started 
2024-05-28 23:16:48 [info] Elementor Pro/Upgrades - _on_each_version Start  
2024-05-28 23:16:48 [info] Elementor Pro/Upgrades - _on_each_version Finished 
2024-05-28 23:16:48 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta3',
  'to' => '3.22.0-beta4',
)]
2024-05-28 23:16:50 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta3',
  'to' => '3.22.0-beta4',
)]
2024-06-11 04:26:50 [info] elementor-pro::elementor_pro_updater Started 
2024-06-11 04:26:50 [info] Elementor Pro/Upgrades - _on_each_version Start  
2024-06-11 04:26:50 [info] Elementor Pro/Upgrades - _on_each_version Finished 
2024-06-11 04:26:50 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta4',
  'to' => '3.22.0-beta5',
)]
2024-06-16 23:11:32 [info] Elementor data updater process has been queued. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta5',
  'to' => '3.22.0',
)]
2024-06-16 23:11:32 [info] elementor-pro::elementor_pro_updater Started 
2024-06-16 23:11:32 [info] Elementor Pro/Upgrades - _on_each_version Start  
2024-06-16 23:11:32 [info] Elementor Pro/Upgrades - _on_each_version Finished 
2024-06-16 23:11:32 [info] Elementor data updater process has been completed. [array (
  'plugin' => 'Elementor Pro',
  'from' => '3.22.0-beta5',
  'to' => '3.22.0',
)]

JS: showing 2 of 2JS: 2024-06-11 02:11:55 [error X 8][https://dev.toine.zip/wp-content/plugins/elementor/assets/js/web-cli.min.js?ver=3.22.0-beta6:3:108040] Routes: `panel/editor/advanced-tab-links-in-bio` not found. 
JS: 2024-06-11 02:12:55 [error X 4][https://dev.toine.zip/wp-content/plugins/elementor/assets/js/editor.min.js?ver=3.22.0-beta6:3:640967] undefined is not an object (evaluating 'V.isVisible=!1') 



== Elementor - Compatibility Tag ==
	
	Elementor Pro: Niet compatibel

== Elementor Pro - Compatibility Tag ==

@DennisNerush DennisNerush changed the title Fix: Image Generation & Edit triggering from WP media library [ED-14705] Fix: Image Generation & Edit triggering from WP media library [ED-15079] Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants