I’m trying to add code to my themes functions.php to display fields created with the Cimy user extra fields plugin in the dashboard users.php. I know that I need to use manage_users_columns, but beyond that I’m stuck. Anyone familiar enough with the plugin to help me get the proper fields to display?
Leave a Reply
You must be logged in to post a comment.
A couple thoughts that might help you or others reading this…
FWIW, the priority parameter doesn’t have an effect unless you have multiple functions that you’re attaching to the hook. So, 15 or 1 or 9999 is irrelevant. In case you might be thinking the priority has anything to do with column order, it doesn’t.
Also, you can attach the ‘theme_column_userfield’ function to the manage_users_columns hook with add_action…it works the same either way. ie.,
works the same.
Lastly, the code block doesn’t include any sort of ordering. Done this way, the column will be added to the right side of the table. If you need to insert the column somewhere you’ll need to use a little bit or a lot of array_slice and array_merge depending on how simple/complex/reusable you need to be.
For example, if you used this…
…the ‘New User Column’ would appear right after the checkbox in the Users list, followed by all of the rest of the default columns.
I hacked my way into figuring this out. Here’s the code for reference: