-
Notifications
You must be signed in to change notification settings - Fork 382
Fix deprecation warnings #7614
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 deprecation warnings #7614
Changes from 8 commits
1bd40ef
2c43d0d
020eaaa
6e9f2cf
308e17c
1e8de9a
14b70d7
41b2ff6
091fdfd
6d8a722
e8f73c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,7 +283,9 @@ public static function register() { | |
| 'manage_terms' => AMP_Validation_Manager::VALIDATE_CAPABILITY, // Needed to give access to the term list table. | ||
| 'delete_terms' => AMP_Validation_Manager::VALIDATE_CAPABILITY, // Needed so the checkbox (cb) table column will work. | ||
| 'assign_terms' => 'do_not_allow', // Block assign_terms since associating terms with posts is done programmatically. | ||
| 'edit_terms' => 'do_not_allow', // Terms are created (and updated) programmatically. | ||
| // Terms are created (and updated) programmatically, but we still need to assign capabilities while generating edit link for term. | ||
| // @see <https://github.com/ampproject/amp-wp/issues/7604#issuecomment-1704244763>. | ||
| 'edit_terms' => AMP_Validation_Manager::VALIDATE_CAPABILITY, | ||
| ], | ||
| ] | ||
| ); | ||
|
|
@@ -2923,10 +2925,19 @@ public static function handle_validation_error_update( $redirect_to, $action, $t | |
| } | ||
| } | ||
|
|
||
| if ( $updated_count ) { | ||
| delete_transient( AMP_Validated_URL_Post_Type::NEW_VALIDATION_ERROR_URLS_COUNT_TRANSIENT ); | ||
| } | ||
|
|
||
| if ( false !== $has_pre_term_description_filter ) { | ||
| add_filter( 'pre_term_description', 'wp_filter_kses', $has_pre_term_description_filter ); | ||
| } | ||
|
|
||
| // Bail if redirect_is passed as null. | ||
|
||
| if ( null === $redirect_to ) { | ||
| return $redirect_to; | ||
| } | ||
|
|
||
| $term_ids_count = count( $term_ids ); | ||
| if ( 'edit.php' === $pagenow && 1 === $updated_count ) { | ||
| // Redirect to error index screen if deleting an validation error with no associated validated URLs. | ||
|
|
@@ -2947,10 +2958,6 @@ public static function handle_validation_error_update( $redirect_to, $action, $t | |
| ); | ||
| } | ||
|
|
||
| if ( $updated_count ) { | ||
| delete_transient( AMP_Validated_URL_Post_Type::NEW_VALIDATION_ERROR_URLS_COUNT_TRANSIENT ); | ||
| } | ||
|
|
||
| return $redirect_to; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ public static function get_registration_action() { | |
| */ | ||
| public function register() { | ||
| add_submenu_page( | ||
| '', | ||
| 'options.php', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Linking your pervious #7614 (comment) here. This was made an empty string in e30168c. You say:
Can you clarify further what this is doing? Is it that there is no menu item for
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. It won't be accessible from a submenu item but rather only accessible via the URL which is
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or if we want to hook it to |
||
| __( 'AMP Onboarding Wizard', 'amp' ), | ||
| __( 'AMP Onboarding Wizard', 'amp' ), | ||
| 'manage_options', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -290,6 +290,13 @@ public function test_render_screen_for_admin_user() { | |
| ) | ||
| ); | ||
|
|
||
| // Set current screen to be the options menu. | ||
| set_current_screen( $this->instance->screen_handle() ); | ||
|
|
||
| // Set title to be used in the screen. | ||
| global $title; | ||
| $title = 'Test Title'; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see this is coming from 1e8de9a. It was needed due to a PHP warning during tests?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, while rendering the screen it requires the title, but the title is not being set anywhere. |
||
|
|
||
| ob_start(); | ||
| $this->instance->render_screen(); | ||
| $this->assertStringContainsString( '<div class="wrap">', ob_get_clean() ); | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this commit needed to work around the issue in tests which you're fixing in core?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which commit? I am unable to see any diff with this comment.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I meant 2c43d0d
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's different from that one.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the deprecation warning?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those were the same as passing null to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this then allow users to access the edit term page when they shouldn't be able to access it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the very least we'll also need to
unset($actions['edit'])in:amp-wp/includes/validation/class-amp-validation-error-taxonomy.php
Lines 1679 to 1738 in 828f229
Then there's the question of the REST API. I suppose they can't access it because it's not
publicandshow_in_restis nottrue.On the other hand, is this actually a bug that should rather be fixed in core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not providing an edit link so it will be hard to generate the link with the correct
tag_ID.I think it will do it.
amp-wp/includes/validation/class-amp-validation-error-taxonomy.php
Line 1733 in 828f229
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and I have filed a ticket for that - https://core.trac.wordpress.org/ticket/59336