Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm heavelly modified my Wordpress, it's amazing what you can do with wordpress hooks, actions.. But i'm not able to find how can i add mass action for users. Let's say i select 5 users and i want to asign them some user_meta value.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Unfortunately this isn't possible. Custom actions cannot be added to the bulk actions dropdown (see trac tickets: http://core.trac.wordpress.org/ticket/12732 and http://core.trac.wordpress.org/ticket/16031).

For posts you can use the restrict_manage_posts hook to create another drop-down / add buttons to trigger your custom action. But there is no restrict_manage_* hook available for the user table.

So the only (and not particularly pretty) workaround is to use javascript to insert extra options into the drop-down menu.

However, there is no (supported) way of handling the action - so this would also have to be handled yourself by hooking into the load-* or admin_action_* hook. (See the core files here).

You would then need to check the posted data (the user IDs, the action identifier, nonce, etc) inside that hook and then you would need to check the nonce and the current user's capability to perform that action.

See related question: Custom bulk_action

share|improve this answer
    
Thanks for bad news.. :D –  Tommixoft Jun 4 '12 at 12:35
    
Another alternative, albeit also time consuming to implement, would be a custom built (secondary) user table in a custom admin menu, @Tommix. | +1 for sharing the tickets –  Johannes Pille Jun 4 '12 at 13:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.