Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions includes/admin/settings/class-ur-members-list-table.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

Check failure on line 1 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Class file names should be based on the class name with "class-" prepended. Expected class-user-registration-members-list-table.php, but found class-ur-members-list-table.php.
/**
* UserRegistration Members ListTable class.
*
* @package UserRegistration/Admin
* @author WPEverest

Check failure on line 6 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

@author tags are prohibited
*
* @since 4.5.0
*/
Expand All @@ -25,7 +25,7 @@
class User_Registration_Members_List_Table extends WP_Users_List_Table {


public function __construct() {

Check failure on line 28 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Missing doc comment for function __construct()
parent::__construct();

add_filter( 'ur_manage_users_custom_column', array( $this, 'output_custom_column_data' ), 10, 3 );
Expand All @@ -43,9 +43,9 @@
public function prepare_items() {
global $role, $usersearch, $wpdb;

$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';

Check failure on line 46 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Detected usage of a non-sanitized input variable: $_REQUEST['s']

Check failure on line 46 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

$_REQUEST data not unslashed before sanitization. Use wp_unslash() or similar

Check warning on line 46 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

Check warning on line 46 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

Check failure on line 46 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Overriding WordPress globals is prohibited. Found assignment to $usersearch

$role = isset( $_REQUEST['role'] ) ? sanitize_text_field( $_REQUEST['role'] ) : '';

Check failure on line 48 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

$_REQUEST data not unslashed before sanitization. Use wp_unslash() or similar

Check warning on line 48 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

Check warning on line 48 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

Check failure on line 48 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Overriding WordPress globals is prohibited. Found assignment to $role

$users_per_page = $this->get_items_per_page( 'user_registration-membership_page_user_registration_users_per_page' );

Expand All @@ -58,15 +58,15 @@
'fields' => 'all_with_meta',
);

if ( $role !== 'all' ) {

Check failure on line 61 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Use Yoda Condition checks, you must.
$args['role'] = $role;
}

if ( ! empty( $_REQUEST['form_filter'] ) ) {

Check warning on line 65 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.
$form_filter = sanitize_text_field( wp_unslash( $_REQUEST['form_filter'] ) );

Check warning on line 66 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

if ( array_key_exists( $form_filter, $this->get_all_registration_forms() ) ) {
$args['meta_query'] = array(

Check warning on line 69 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Detected usage of meta_query, possible slow query.
array(
'key' => 'ur_form_id',
'value' => (string) $form_filter,
Expand All @@ -76,8 +76,8 @@
}
}

if ( ! empty( $_REQUEST['user_status'] ) ) {

Check warning on line 79 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.
$status_filter = sanitize_text_field( wp_unslash( $_REQUEST['user_status'] ) );

Check warning on line 80 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

if ( in_array( $status_filter, array( 'approved', 'pending', 'denied', 'pending_email' ) ) ) {
$args['meta_query'][] = $this->get_user_meta_query_by_user_status( $status_filter );
Expand All @@ -90,11 +90,11 @@
$end_date = gmdate( 'Y-m-d' );

if ( ! empty( $_REQUEST['date_range'] ) ) { //phpcs:ignore WordPress.Security.NonceVerification
$date_range = sanitize_text_field( wp_unslash( $_REQUEST['date_range'] ) );

Check warning on line 93 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

Processing form data without nonce verification.

switch ( $date_range ) {
case 'day':
$start_date = strtotime( date( 'm/d/Y' ) . '00:00:00' );

Check failure on line 97 in includes/admin/settings/class-ur-members-list-table.php

View workflow job for this annotation

GitHub Actions / Code sniff (PHP 7.4, WP Latest)

date() is affected by runtime timezone changes which can cause date/time to be incorrectly displayed. Use gmdate() instead.
$start_date = date( 'Y-m-d H:i:s', $start_date );
break;

Expand Down Expand Up @@ -1494,6 +1494,26 @@
$search_like
);

// Also match the full name (e.g. "John Smith") when first/last name are stored
// as separate usermeta rather than combined into a single field like display_name.
$search_conditions[] = $wpdb->prepare(
"EXISTS (
SELECT 1
FROM {$wpdb->usermeta} umfn
JOIN {$wpdb->usermeta} umln
ON umln.user_id = umfn.user_id
AND umln.meta_key = 'last_name'
WHERE umfn.user_id = {$wpdb->users}.ID
AND umfn.meta_key = 'first_name'
AND (
CONCAT( umfn.meta_value, ' ', umln.meta_value ) LIKE %s
OR CONCAT( umln.meta_value, ' ', umfn.meta_value ) LIKE %s
)
)",
$search_like,
$search_like
);

$search_conditions[] = $wpdb->prepare(
"EXISTS (
SELECT 1
Expand Down
Loading