• Resolved tomaszraczek

    (@tomaszraczek)


    I am writing about this ticket https://www.ads-software.com/support/topic/users-filtering-not-working-on-multisite/ as it has not been resolved and the problem persists.

    I fixed it myself, but after updating the plugin, my fix is removed. Can you replace the following code into the plugin in the path new-user-approve/includes/user-list.php(line 225)?

    $query->query_from .= " INNER JOIN {$wpdb->usermeta} ON ( {$wpdb->users}.ID = $wpdb->usermeta.user_id )";
    
    			if ( 'approved' == $filter ) {
    				$query->query_fields = "DISTINCT SQL_CALC_FOUND_ROWS {$wpdb->users}.ID";
    				$query->query_from .= " LEFT JOIN {$wpdb->usermeta} AS mt1 ON ({$wpdb->users}.ID = mt1.user_id AND mt1.meta_key = 'pw_user_status')";
    				$query->query_where .= " AND ( ( $wpdb->usermeta.meta_key = 'pw_user_status' AND CAST($wpdb->usermeta.meta_value AS CHAR) = 'approved' ) OR mt1.user_id IS NULL )";
    			} else {
    				$query->query_where .= " AND ( ($wpdb->usermeta.meta_key = 'pw_user_status' AND CAST($wpdb->usermeta.meta_value AS CHAR) = '{$filter}') )";
    			}

    to this:

    if (is_multisite() && is_user_logged_in()) {
    
                    if ('approved' === $filter) {
                        $query->query_from = "FROM wp_users LEFT JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id )
    				    LEFT JOIN $wpdb->usermeta AS mt1 ON ( wp_users.ID = mt1.user_id AND mt1.meta_key = 'pw_user_status' )
    				    LEFT JOIN $wpdb->usermeta AS mt2 ON ( wp_users.ID = mt2.user_id )";
                        $query->query_where = '';
                        $query->query_where .= "
                            WHERE 1=1 AND (
                            (
                                (
                                    ($wpdb->usermeta.meta_key = 'pw_user_status' AND CAST($wpdb->usermeta.meta_value AS CHAR) = '{$filter}')
                                    OR
                                    mt1.user_id IS NULL
                                )
                                AND
                                (
                                    mt2.meta_key = '{$wpdb->prefix}capabilities'
                                )
                            )
                            ) GROUP BY wp_users.ID
                        ";
                    } else {
                        $query->query_where = '';
                        $query->query_where .= "
                            AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities'
                            INNER JOIN wp_usermeta as wp_usermeta1 ON ( wp_users.ID = wp_usermeta1.user_id )
                            AND (
                                (
                                    wp_usermeta1.meta_key = 'pw_user_status'
                                    AND CAST(wp_usermeta1.meta_value AS CHAR) = '{$filter}'
                                )
                            )
                        ";
                    }
    
                } else {
                    $query->query_from .= " INNER JOIN {$wpdb->usermeta} ON ( {$wpdb->users}.ID = $wpdb->usermeta.user_id )";
    
                    if ('approved' == $filter) {
                        $query->query_fields = "DISTINCT SQL_CALC_FOUND_ROWS {$wpdb->users}.ID";
                        $query->query_from .= " LEFT JOIN {$wpdb->usermeta} AS mt1 ON ({$wpdb->users}.ID = mt1.user_id AND mt1.meta_key = 'pw_user_status')";
                        $query->query_where .= " AND ( ( $wpdb->usermeta.meta_key = 'pw_user_status' AND CAST($wpdb->usermeta.meta_value AS CHAR) = 'approved' ) OR mt1.user_id IS NULL )";
                    } else {
                        $query->query_where .= " AND ( ($wpdb->usermeta.meta_key = 'pw_user_status' AND CAST($wpdb->usermeta.meta_value AS CHAR) = '{$filter}') )";
                    }
                }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Mirza Hamza

    (@hamza1010)

    Hi @tomaszraczek,

    Thanks for contacting us,

    I hope you are doing well, We will release the changes after version 2.5.

    Thanks & Regards

    WP Experts Support Team

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hi @tomaszraczek,

    This is an updated version of the New User Approve and the user status filter issue on multi-site has been resolved. Please check and let me know if any issue occurs.

    Here is an updated plugin: ( link ).

    Thank you

    Thread Starter tomaszraczek

    (@tomaszraczek)

    Hi @hamza1010

    I checked the new version and it works as expected.

    Please implement it as soon as possible or let me know when I can expect a new version.

    Thanks

    Plugin Support Mirza Hamza

    (@hamza1010)

    Hi @tomaszraczek.

    The new version will release once the QA is done.

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Users filtering not working on multisite’ is closed to new replies.