Shop Forums WordPress Plugins Add column to All Users page Reply To: Add column to All Users page

#19010
vinny
Keymaster

This is what it should look like. Note that I haven’t tested it, so please run it in your dev site first.

/*this will add column in user list table*/

function add_column( $column ) {
    $column['text_checkbox'] = 'Immediate Notifications';
    return $column;
}
add_filter( 'manage_users_columns', 'add_column' );

/*this will add column value in user list table*/
function add_column_value( $val, $column_name, $user_id ) {
    switch($column_name) {
        
        case 'text_checkbox' :

            $obj = new jamies_digest_override();
            $rec_dao = $obj->load_lib( 'dal/recipients_dao' );
            return $rec_dao->get_user_force_notif_pref(null, $user_id);
            
            break;
            
        default:
    }
}
add_filter( 'manage_users_custom_column', 'add_column_value', 10, 3 );

class jamies_digest_override extends BbpnnsDigest {
    public function __construct(){ /* NOOP */ }
    
    public function load_lib( $name, $params = array(), $force_reload = false ){
        return parent::load_lib( $name, $params, $force_reload );
    }
}