Skip to content

Commit 20e777d

Browse files
committed
#1408 Fix - Match the meta auth_callback to WP's 6-arg filter signature and dedupe the redirect host
1 parent 6e71d1e commit 20e777d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

includes/frontend/class-ur-frontend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function allow_custom_redirect_host( $hosts ) {
262262

263263
$host = wp_parse_url( $external_url, PHP_URL_HOST );
264264

265-
if ( ! empty( $host ) ) {
265+
if ( ! empty( $host ) && ! in_array( $host, $hosts, true ) ) {
266266
$hosts[] = $host;
267267
}
268268

modules/membership/includes/Admin.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -995,20 +995,22 @@ public function protect_membership_post_meta() {
995995
/**
996996
* Whether the current user may write membership post meta.
997997
*
998-
* Registered as a register_post_meta() auth_callback, which WordPress invokes with the
999-
* filter arguments below. AND-ing with $allowed means this can only ever narrow a core
1000-
* decision, never widen one.
998+
* Registered as a register_post_meta() auth_callback. WordPress invokes it through the
999+
* auth_{$object_type}_meta_{$meta_key} filter with the six arguments below; only the write
1000+
* decision it returns is used. Write access is limited to users who can manage options.
10011001
*
10021002
* @since 5.2.8
10031003
*
10041004
* @param bool $allowed Whether the write is allowed so far.
10051005
* @param string $meta_key Meta key being written.
10061006
* @param int $object_id Post ID.
10071007
* @param int $user_id User attempting the write.
1008+
* @param string $cap Capability being checked.
1009+
* @param array $caps Primitive capabilities required.
10081010
* @return bool True when the user can manage the site's options.
10091011
*/
1010-
public function can_manage_membership_meta( $allowed = false, $meta_key = '', $object_id = 0, $user_id = 0 ) {
1011-
return $allowed && current_user_can( 'manage_options' );
1012+
public function can_manage_membership_meta( $allowed = false, $meta_key = '', $object_id = 0, $user_id = 0, $cap = '', $caps = array() ) {
1013+
return current_user_can( 'manage_options' );
10121014
}
10131015

10141016
/**

0 commit comments

Comments
 (0)