0

I know the title is really bad and not descriptive at all, but here is the case :

On a Drupal 7 site, each user has a "profile" page, which is a node of a certain content type, created upon registration (Content Type A). So far , so good. I want to let each user create nodes of a Content Type B, and display their preview on their "profile" page.

For Example, let's say each user is a musician and each user has a profile page presenting themselves with several blocks and views. The purpose is to let them create content concerning their gigs, and display the resulting block with the list of the upcoming gigs.

The problem is, that trying to create a view achieving it, i cannot use as a filter the ideal, which would be something in the form [Content_Type_A][nid][authorid] = [Content_Type_B][nid][authorid], so as to display the nodes of content type B that are created only by the same author.. I tried with contextual filters (author id), but this refers only to the node that is displayed in the view (in this case Content_Type_B), so, it has no result. Maybe it is something really really simple, but i'm stuck, since i have to declare the two types of nodes in the view in order to compare their author's ids.

Any help would be very useful.

1

I can't comment, so I'll answer instead. If I read your question correctly, you want to show multiple specific views on a specific content type which you have associated as a profile page.

You could do the following in each view:

  • Create a relationship to the Author

  • create each view as a block, using a contextual filter

    • (author) User:Name
    • When filter value not available: provide default, Raw value from URL, Path component 2
    • path users/%/view-name
  • add it as a block in an appropriate place for your theme, and restrict it to show only on users/* pages

I have done this to show recent blog entries in a profile page.

  • Thanks for the reply. Didn't brought any result unfortunately, although i can understand the scenario behind it. Let me explain in detail my example again: – neu _ sturz _ ende Apr 30 '14 at 10:47
  • @Geoof I continue here: I want to display in his profile page (Content_Type_1 , /node/777) ONLY the concert (Content_Type_2, Concert B) that are created by him(he is the Author). In other words to create a view and to filter the output by comparing the Author_id of Content_Type_1 node to the Author_id of Content_Type_2, and display if equal. – neu _ sturz _ ende Apr 30 '14 at 11:02
  • Oh, I see - I didn't realise you were using independant nodes for the profile pages. I don't believe views will allow you to access the information from two different content types in one view - the only way I know is through contextual filters (since its an independant source of info) - but to do that, you would need to re-arrange your structure so that the content-type has a path of "profile/" or whatever, and that the node automatically follows with the user name - there may some path modules that can do this for you, and then the code above should work. – Geoff Apr 30 '14 at 13:33

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.