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.
Leave a Reply
You must be logged in to post a comment.
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 norestrict_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-*
oradmin_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
It’s possible by using jQuery to add the item to the drop down or adding another field and then use Ajax to intercept the click and perform your bulk action that way.