By Eniram on
I think I saw a module for drupal 6 that was what I needed but I can't figure out how to do it in drupal 7. Any help would be appreciated.
I think I saw a module for drupal 6 that was what I needed but I can't figure out how to do it in drupal 7. Any help would be appreciated.
Comments
I would like to know this as well.
Subscribe to thread
Chris Pergantis
Founder/Chairman/President
Accelerated Design Inc
Hey man, someone helped me
Hey man, someone helped me figure it out. I thought I'd let you know.
http://www.reddit.com/r/drupal/comments/jf3ev/how_do_i_create_a_list_of_...
_
I haven't tried it, but I guess it would be possible with the Viewfield module.
It allows you to add a user field referencing a view. You could then configure that view to take the uid of the user as a contextual filter (argument) only showing nodes which has that user as author.
_
A better option might be this brand new module: EVA: Entity Views Attachment.
Taken from its project page:
My Content View
This view (for use with the Views module) will create a list of all of a user's submitted content on his/her My Account page: http://drupal.org/node/1108312.
Wow cool. A couple of
Wow cool. A couple of questions. Where do I put that php to create the view? Explain it to me like I'm 5. Also, is it much different than what I came up with (outlined in my other comment in this thread)?
EDIT: Nevermind, I see that you just paste it into the import page in views. Thanks a lot man you're awesome.
Just Import the code into
Just Import the code into Views.
works beautifully thanks
Exactly what we wanted. We have modified the original with some content type filters to separate different types into different tabs.
I tried to use it in Drupal 7 (a different site) it did not work for us. It seems as though Views 7 does not have a similar user relationship. Will work on the solution for that in the next few weeks.
Chris Pergantis
Founder/Chairman/President
Accelerated Design Inc
I kind of sort of figured it
I kind of sort of figured it out. I created a view block and used the contextual filter "Content: User posted or commented." I used the settings to grab the raw username from the url. Then I just put the block on their page. The reason I say kind of sort of is because although the block seems to be working just fine I am getting this error in Views:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'structure' in 'where clause'
I have no idea what that means.
EDIT: THIS DOESN'T WORK. DON'T USE THE ABOVE.
in 7
Eniram, I used the technique you mentioned as a starting point. My page tab behind the user profile page is now working just fine. I went to the contextual filters added the "Content: User posted or commented" field into the filter then made no changes in the editor for the field (defaults). Works like a charm! Whichever user profile I now go to I only see the content related to that user.
BTW I did not use a block! I used Page Settings.
Path: /user/%/requests
Menu: Tab: Requests
Access: Permission | View published content
This is from the example above for 6 which I imported to the other project mentioned above.
I hope this post may help others make this transition from 6 to 7
Chris Pergantis
Founder/Chairman/President
Accelerated Design Inc
Figured out how to do it right in D 7
A lot of people suggest a lot of things. The problem is you have to figure out how to ask the right questions. Here is the proper way to do this in Drupal 7.12:
1 - Learn how to use Contextual Filters and Display types (Block, Page, etc) in Views.
2 - Create a new view with a Block Display.
3 - Set up your filters however you want.
4 - Create a Contextual Filter of Author User ID.
5 - This is the part that isn't clear if you don't know what to look for. In the settings for the Contextual Filter User ID, you have to select the right option for What to do "When the filter value is NOT available". The right option is Provide Default Value. Then you choose Type User ID from URL. It is totally NOT intuitive because you wouldn't think "Default Value" is going to be something changeable. But it can be in this case!
The reason you have to do it this way is because a Block Display DOES NOT AUTOMATICALLY ACCESS URL VARIABLES LIKE A PAGE DISPLAY. By using the Provide Default Value option, you can tell it to grab the variable from the URL.
Here's a wonderful page where I find the instructions explaining this:
http://drupal.stackexchange.com/questions/13868/drupal-7-views-contextual-filters-with-page-blocks
6 - After you've got your block view set up, go to the Administer Blocks page for your site structure. Find the block for the block view you created and move it to the Content section (assuming you want to show it in the content section). If the block doesn't appear, you've done something wrong and you'll need to do a few tests to verify the problem. One test you can do is changing Provide Default Value option to type Fixed Value and entering a fixed value. If the fixed value is working in the preview of the view at the bottom, then it should also cause the block to display. If the block still isn't displaying, you've got something else really misconfigured.