Skip to content

Commit 6e71d1e

Browse files
committed
#1408 Fix - Address Copilot review: document meta auth_callback signature and drop dead AJAX-login code
1 parent 4156adc commit 6e71d1e

2 files changed

Lines changed: 10 additions & 7 deletions

File tree

includes/functions-ur-core.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5406,15 +5406,10 @@ function ur_process_login( $nonce_value ) {
54065406

54075407
if ( ur_is_ajax_login_enabled() && empty( $_POST['resubmitted'] ) ) { // phpcs:ignore
54085408
wp_send_json_success( array( 'message' => $redirect ) );
5409-
wp_send_json( $user );
54105409
} else {
54115410
wp_safe_redirect( $redirect );
54125411
exit;
54135412
}
5414-
5415-
if ( ur_is_ajax_login_enabled() && empty( $_POST['resubmitted'] ) ) { // phpcs:ignore
5416-
wp_send_json( $user );
5417-
}
54185413
}
54195414
} catch ( Exception $e ) {
54205415
$status_code = $e->getCode();

modules/membership/includes/Admin.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,12 +995,20 @@ 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.
1001+
*
9981002
* @since 5.2.8
9991003
*
1004+
* @param bool $allowed Whether the write is allowed so far.
1005+
* @param string $meta_key Meta key being written.
1006+
* @param int $object_id Post ID.
1007+
* @param int $user_id User attempting the write.
10001008
* @return bool True when the user can manage the site's options.
10011009
*/
1002-
public function can_manage_membership_meta() {
1003-
return current_user_can( 'manage_options' );
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' );
10041012
}
10051013

10061014
/**

0 commit comments

Comments
 (0)