1

I am working on an Equipment Checkout system using Drupal 7, MERCI, views, panels, rules, and many other modules. I am working for a community college in Oregon. I am upgrading features on an already running system that was built by myself with the help of a few other people last year. The system is offline for the summer.

One of the features that I am trying to implement is that when we pull up a customer account, we also see content related to the customer blog posts, reservations, and some custom content types.

I have created a block called 'Customer History' on the customer view for the information to be displayed.

So now I need to figure out how to get the content into that block.

I'm thinking that I could somehow do a search for the customers name and display results in the block. What do you think? Is this a good way to go?

Any help would be great thank you.

0

1 Answer 1

0

Views is probably your best option, using a contextual filter, and various Views Blocks

If for example the url was www.mysite.com/user/12/profile, you could list all of any number of content types where the user id matches 12.

The specific answer depends on the structure however. If you include that information, I will update this answer with more specific direction.

EDIT 1:

  • create a separate view for each content type you want visible on the user's page

  • for each, set it as a BLOCK, not a page, and set the fields and order, etc as appropriate

  • set a contextual filter - this will depend on your structure, but I will show one as an example and you should be able to extrapolate. Contextual Filter->Content:Author uid

  • Contextual Filter, When not Available -> Provide Default Value, Raw Value from URL, Path Component 2 (for /user/12/*)

  • go to admin/structure/blocks and you should see the new views blocks. set them to only show on user/* for example to show in the profile pages, and place the blocks in the appropriate region

19
  • Yea! Thank you for your help Geoff :) A few additional pieces of information that might be useful. I am running Drupal on a local host server, If that matters and the customers are custom content types. The URL to our "Damaged Items" customer is codelocalhost:8082/node/2527code We use this account to temporarily remove items from inventory when they are getting repaired. Could you please tell me what structure you need from me? Thank you again
    – Maruska
    Commented Jul 14, 2014 at 16:33
  • I have been working through your instructions and have a few questions. I created 2 views and set them both as a block. The next instruction was to "set the fields and order, etc" Im not sure what fields to set. I would like to display a list of teasers, similar to a search engine result. The next instruction is to choose a contextual filter and I got lost. I did some looking around on the topic but i am still confused. Can you help me figure out what contextual filter I need to choose?
    – Maruska
    Commented Jul 24, 2014 at 16:38
  • Followed all your instructions, and from what I can gather the contextual filter is going to look in the url at position 1 for the author id. I'm assuming at some point I need to tell Drupal to put the author ID into the url at position 1? Also I'm not sure if this is relevant here but, Our checkout is run by an attendant that will be viewing multiple customer accounts in a shift. So the customer never has access to the system. Is Author ID still the best choice? Thank You again Geoff you are a life saver :)
    – Maruska
    Commented Jul 29, 2014 at 19:37
  • I set the contextual filter to Content:L# (This is the customer number) Then in the preview area I typed in an active L# and I get a teaser of the customer content type. So some success! now if we can get it to display reservation content types instead of customer content types. While in the contextual filters, I stumbled across Search: Search Terms. While testing it seemed to return the search results like I am looking for. Have you ever used this filter?
    – Maruska
    Commented Jul 30, 2014 at 17:59
  • I set the Filter criteria to Content: type(=Reservation). When I type in an L# in the preview area nothing shows up. Thinking there might not be content to display, I than created a reservation with my L# and tried again, and again nothing came up. Any Ideas? Is there maybe something I need to set in the L# field?
    – Maruska
    Commented Aug 6, 2014 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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