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.

CommentFileSizeAuthor
#5 user.module.patch395 bytesgopagoninarsing

Comments

gopagoninarsing’s picture

if 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.

pflame’s picture

I 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.

pflame’s picture

Version: 6.15 » 6.x-dev

I 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.

drupaul.z’s picture

hello gopagoninarsing,

where is the attachement?
could you pls upload your attachement again?

gopagoninarsing’s picture

StatusFileSize
new395 bytes

Sorry for late reply. Please check the attached patch file.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.