Is it possible to merge two views, one based on users and one on nodes?

The purpose of this is to create a directory of contacts, however some of the listings will be site users and some will not be - they will be created by admins.

It has crossed my mind to just use a content type that users can create; the downside of this is that if they update their details they'd have to update their node too...


Why not simply use a content type only?

You can for example add an optional user reference field to a content type, which points to the user to whom the contact belongs. Then you can embed the content type into the user profile, if you want that. For example by using the Panels project.

For normal users, you could write a few lines of custom code to automatically populate the user reference to the current user and hide the field from them. You could also add a check that they can only create a single contact, if you want that.

| improve this answer | |
  • I ended up going down this track. I had wanted to simplify the directory implementation but this was not possible. Rather than use a user reference field however, I just allowed users to edit based on the node author. Auto-updating the details is currently in the 'too hard basket'. – Sean Dec 22 '11 at 2:19

Checkout this article on "reusing fields":

There are two main reasons for reusing fields. First, reusing fields can save you time over defining new fields. Second, reusing fields also allows you to display, filter, group, and sort content together by field across content types. For example, the contributed Views module allows you to create lists and tables of content. So if you use the same field on multiple content types, you can create a View containing all of those content types together displaying that field, sorted by that field, and/or filtered by that field.

I'm not sure if it will work with the users content type. If not you could use profile2 which uses regular content types for user profiles.

| improve this answer | |
  • Re-using fields does not help here. Re-using field is about re-using field definitions, and not the data in them. Profile2 probably will not help either as they profiles directly belong to a user. – Berdir Nov 21 '11 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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