HIRE US

Let us help you with your Drupal requirements

To prevent automated spam submissions leave this field empty.

Views is one of the most complex of all Drupal modules and one of the most useful of all Drupal modules. The only downside is that, since it is very complex, not too many people have been able to contribute to the documentation of the module. If you search Google for finding out how to programmatically set a filter in Views2 you probably wouldn't find any help. Here is how you do it.

$view = views_get_view('name_of_view');
$view->set_display($display_id);
$filter = $view->get_item($display_id, 'filter', 'name_of_filter');
$filter['value']['value'] = $filter_value;
$view->set_item($display_id, 'filter', 'name_of_filter', $filter);

Yes, that is it. As simple as that.

Still not able to solve your problem? Contact Us for Drupal support.

Post your comments / questions