Skip to main content

I have the following view being called in my code with views_get_view() and I then try to modify the filter called usershare to admin instead of the default that I have set in my view. But it doesntdoesn't seem to override my view output at all. What am I doing wrong here? I noticed that some examples use pre_execute() and some just use excute(). I'm not sure if that has anything to do with it.

      $view2 = views_get_view('flag_lists_user_lists_public', FALSE);
      $view2->set_display('default');

$view2->display_handler->display->display_options['filters']['usershare']['value'] = 'admin';

      $view2->pre_execute();
      $output .= $view2->render();  

I have the following view being called in my code with views_get_view() and I then try to modify the filter called usershare to admin instead of the default that I have set in my view. But it doesnt seem to override my view output at all. What am I doing wrong here? I noticed that some examples use pre_execute() and some just use excute(). I'm not sure if that has anything to do with it.

      $view2 = views_get_view('flag_lists_user_lists_public', FALSE);
      $view2->set_display('default');

$view2->display_handler->display->display_options['filters']['usershare']['value'] = 'admin';

      $view2->pre_execute();
      $output .= $view2->render();  

I have the following view being called in my code with views_get_view() and I then try to modify the filter called usershare to admin instead of the default that I have set in my view. But it doesn't seem to override my view output. What am I doing wrong here? I noticed that some examples use pre_execute() and some just use excute(). I'm not sure if that has anything to do with it.

      $view2 = views_get_view('flag_lists_user_lists_public', FALSE);
      $view2->set_display('default');

$view2->display_handler->display->display_options['filters']['usershare']['value'] = 'admin';

      $view2->pre_execute();
      $output .= $view2->render();  
Source Link
Patoshi パトシ
  • 8.7k
  • 14
  • 80
  • 166

Modify Override the Views Filter Criteria Programaticly

I have the following view being called in my code with views_get_view() and I then try to modify the filter called usershare to admin instead of the default that I have set in my view. But it doesnt seem to override my view output at all. What am I doing wrong here? I noticed that some examples use pre_execute() and some just use excute(). I'm not sure if that has anything to do with it.

      $view2 = views_get_view('flag_lists_user_lists_public', FALSE);
      $view2->set_display('default');

$view2->display_handler->display->display_options['filters']['usershare']['value'] = 'admin';

      $view2->pre_execute();
      $output .= $view2->render();