I am building a website for students in a school program. I have set up a Date field representing the graduating class students belong to (ie. 2013, 2012, etc). Students select their class in their user profile. When stories are posted as news, they also are assigned to class(es).

The Class field shows up in views as:

Content: Class (field_class)
Date - Appears in: News, User Profile

I am now setting up a View for News. I would like the view to filter news stories so that the class users select in their user profile will filter the news stories they see. That way, only news assigned to a given class will be seen by students in that class. ie. Class of 2012 students will not see class of 2013 stories.

I believe this is done using arguments, but I am unsure how. Any help would be great.

Thanks.

Comments

merlinofchaos’s picture

Status: Active » Fixed

Add the argument for your date field to the view.

Set the default action to provide default. Set the default type to PHP code.

Using PHP code, load the profile field for the global user, and return this as the argument to provide for the view.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.