Do I need to use hook_views_data like a custom table?

closed as unclear what you're asking by Pierre.Vriens, Adrian Cid Almaguer, DRUPWAY, kiamlaluno May 4 '17 at 11:44

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • not sure what you mean by $user->data. Anyhow, have you tried creating a User view? – No Sssweat May 2 '17 at 23:28
  • FYI I want a table of users with their topic of preference that is stored in the users table with $user->data['topic']. – Tabestan May 2 '17 at 23:29
  • The data property on the user object is a serialized field. It's not great to store things there, but it would be possible to code a views field handler that gets that data and outputs it in a meaningful way. There may already be one in contrib. – mradcliffe May 3 '17 at 1:52

Actually, this can be done within the Views UI by selecting the user:data field and then choosing a key.


You need to first add relationship with 'author' in the view and accordingly you will get the user data fields which you can use in your fields as well as in filters.

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