views code for current user block

  1. $view = new view;
  2. $view->name = 'pootestpoo';
  3. $view->description = 'poopoo';
  4. $view->tag = '';
  5. $view->view_php = '';
  6. $view->base_table = 'users';
  7. $view->is_cacheable = FALSE;
  8. $view->api_version = 2;
  9. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  10. $handler = $view->new_display('default', 'Defaults', 'default');
  11. $handler->override_option('fields', array(
  12.   'uid' => array(
  13.     'id' => 'uid',
  14.     'table' => 'users',
  15.     'field' => 'uid',
  16.   ),
  17.   'name' => array(
  18.     'id' => 'name',
  19.     'table' => 'users',
  20.     'field' => 'name',
  21.   ),
  22.   'mail' => array(
  23.     'id' => 'mail',
  24.     'table' => 'users',
  25.     'field' => 'mail',
  26.   ),
  27.   'rid' => array(
  28.     'id' => 'rid',
  29.     'table' => 'users_roles',
  30.     'field' => 'rid',
  31.   ),
  32. ));
  33. $handler->override_option('filters', array(
  34.   'uid_current' => array(
  35.     'operator' => '=',
  36.     'value' => 1,
  37.     'group' => '0',
  38.     'exposed' => FALSE,
  39.     'expose' => array(
  40.       'operator' => FALSE,
  41.       'label' => '',
  42.     ),
  43.     'id' => 'uid_current',
  44.     'table' => 'users',
  45.     'field' => 'uid_current',
  46.     'override' => array(
  47.       'button' => 'Override',
  48.     ),
  49.     'relationship' => 'none',
  50.   ),
  51. ));
  52. $handler->override_option('access', array(
  53.   'type' => 'none',
  54.   'role' => array(),
  55.   'perm' => '',
  56. ));
  57. $handler = $view->new_display('block', 'Blockpoo', 'block_1');

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • Lines and paragraphs break automatically.

More information about formatting options