I need to provide another filter on the admin users list page. I altered user_filter_form and specified my required filter options and added submit handler which stores the required sessions. But when I submit the form, I am getting the following sql error.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND' at line 1 query: SELECT COUNT(DISTINCT u.uid) FROM users u LEFT JOIN users_roles ur ON u.uid = ur.uid WHERE u.uid != 0 AND AND in /var/www/html/HZD-Enhancements/modules/user/user.admin.inc on line 145
I found that this query is depend on the filters returned by user_filters functions. To make it work I need to add my filter details to the array returned by user_filters function. It will be better to provide option to alter this array using drupal_alter function.
I added drupal_alter('admin_user_filters', $filters); statement in the user_filters function and wrote hook_admin_user_filters_alter function in my custom module to make it work.
I hope this is a required feature, so attaching a patch about the fix.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | user.module.patch | 395 bytes | gopagoninarsing |
Comments
Comment #1
gopagoninarsing commentedif we are using the above mentioned patch, it is not required to use form alter.
We can use hook_admin_user_filters_alter to add required filters to the form.
Comment #2
pflame commentedI think this feature is important feature. I did not check whether it is available in version 7, but I feel is important to be available in drupal 7 as well.
Comment #3
pflame commentedI think this feature is important feature. I did not check whether it is available in version 7, but I feel is important to be available in drupal 7 as well.
Comment #4
drupaul.z commentedhello gopagoninarsing,
where is the attachement?
could you pls upload your attachement again?
Comment #5
gopagoninarsing commentedSorry for late reply. Please check the attached patch file.