Advertisement
Guest User

get current user data in block (drupal, views)

a guest
Mar 13th, 2012
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.30 KB | None
  1. $view = new view;
  2. $view->name = 'current_user';
  3. $view->description = '';
  4. $view->tag = 'default';
  5. $view->base_table = 'users';
  6. $view->human_name = 'current user';
  7. $view->core = 7;
  8. $view->api_version = '3.0';
  9. $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
  10.  
  11. /* Display: Master */
  12. $handler = $view->new_display('default', 'Master', 'default');
  13. $handler->display->display_options['title'] = 'current user';
  14. $handler->display->display_options['access']['type'] = 'perm';
  15. $handler->display->display_options['access']['perm'] = 'access user profiles';
  16. $handler->display->display_options['cache']['type'] = 'none';
  17. $handler->display->display_options['query']['type'] = 'views_query';
  18. $handler->display->display_options['query']['options']['query_comment'] = FALSE;
  19. $handler->display->display_options['exposed_form']['type'] = 'basic';
  20. $handler->display->display_options['pager']['type'] = 'some';
  21. $handler->display->display_options['pager']['options']['items_per_page'] = '5';
  22. $handler->display->display_options['style_plugin'] = 'default';
  23. $handler->display->display_options['row_plugin'] = 'fields';
  24. /* Field: User: Name */
  25. $handler->display->display_options['fields']['name']['id'] = 'name';
  26. $handler->display->display_options['fields']['name']['table'] = 'users';
  27. $handler->display->display_options['fields']['name']['field'] = 'name';
  28. $handler->display->display_options['fields']['name']['label'] = '';
  29. $handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
  30. $handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
  31. $handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
  32. $handler->display->display_options['fields']['name']['alter']['word_boundary'] = 0;
  33. $handler->display->display_options['fields']['name']['alter']['ellipsis'] = 0;
  34. $handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
  35. $handler->display->display_options['fields']['name']['alter']['trim'] = 0;
  36. $handler->display->display_options['fields']['name']['alter']['html'] = 0;
  37. $handler->display->display_options['fields']['name']['hide_empty'] = 0;
  38. $handler->display->display_options['fields']['name']['empty_zero'] = 0;
  39. $handler->display->display_options['fields']['name']['link_to_user'] = 1;
  40. $handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
  41. /* Field: User: Vorname */
  42. $handler->display->display_options['fields']['field_user_vorname']['id'] = 'field_user_vorname';
  43. $handler->display->display_options['fields']['field_user_vorname']['table'] = 'field_data_field_user_vorname';
  44. $handler->display->display_options['fields']['field_user_vorname']['field'] = 'field_user_vorname';
  45. $handler->display->display_options['fields']['field_user_vorname']['alter']['alter_text'] = 0;
  46. $handler->display->display_options['fields']['field_user_vorname']['alter']['make_link'] = 0;
  47. $handler->display->display_options['fields']['field_user_vorname']['alter']['absolute'] = 0;
  48. $handler->display->display_options['fields']['field_user_vorname']['alter']['external'] = 0;
  49. $handler->display->display_options['fields']['field_user_vorname']['alter']['replace_spaces'] = 0;
  50. $handler->display->display_options['fields']['field_user_vorname']['alter']['trim_whitespace'] = 0;
  51. $handler->display->display_options['fields']['field_user_vorname']['alter']['nl2br'] = 0;
  52. $handler->display->display_options['fields']['field_user_vorname']['alter']['word_boundary'] = 1;
  53. $handler->display->display_options['fields']['field_user_vorname']['alter']['ellipsis'] = 1;
  54. $handler->display->display_options['fields']['field_user_vorname']['alter']['more_link'] = 0;
  55. $handler->display->display_options['fields']['field_user_vorname']['alter']['strip_tags'] = 0;
  56. $handler->display->display_options['fields']['field_user_vorname']['alter']['trim'] = 0;
  57. $handler->display->display_options['fields']['field_user_vorname']['alter']['html'] = 0;
  58. $handler->display->display_options['fields']['field_user_vorname']['element_label_colon'] = 1;
  59. $handler->display->display_options['fields']['field_user_vorname']['element_default_classes'] = 1;
  60. $handler->display->display_options['fields']['field_user_vorname']['hide_empty'] = 0;
  61. $handler->display->display_options['fields']['field_user_vorname']['empty_zero'] = 0;
  62. $handler->display->display_options['fields']['field_user_vorname']['hide_alter_empty'] = 1;
  63. $handler->display->display_options['fields']['field_user_vorname']['field_api_classes'] = 0;
  64. /* Field: User: Name */
  65. $handler->display->display_options['fields']['field_user_name']['id'] = 'field_user_name';
  66. $handler->display->display_options['fields']['field_user_name']['table'] = 'field_data_field_user_name';
  67. $handler->display->display_options['fields']['field_user_name']['field'] = 'field_user_name';
  68. $handler->display->display_options['fields']['field_user_name']['alter']['alter_text'] = 0;
  69. $handler->display->display_options['fields']['field_user_name']['alter']['make_link'] = 0;
  70. $handler->display->display_options['fields']['field_user_name']['alter']['absolute'] = 0;
  71. $handler->display->display_options['fields']['field_user_name']['alter']['external'] = 0;
  72. $handler->display->display_options['fields']['field_user_name']['alter']['replace_spaces'] = 0;
  73. $handler->display->display_options['fields']['field_user_name']['alter']['trim_whitespace'] = 0;
  74. $handler->display->display_options['fields']['field_user_name']['alter']['nl2br'] = 0;
  75. $handler->display->display_options['fields']['field_user_name']['alter']['word_boundary'] = 1;
  76. $handler->display->display_options['fields']['field_user_name']['alter']['ellipsis'] = 1;
  77. $handler->display->display_options['fields']['field_user_name']['alter']['more_link'] = 0;
  78. $handler->display->display_options['fields']['field_user_name']['alter']['strip_tags'] = 0;
  79. $handler->display->display_options['fields']['field_user_name']['alter']['trim'] = 0;
  80. $handler->display->display_options['fields']['field_user_name']['alter']['html'] = 0;
  81. $handler->display->display_options['fields']['field_user_name']['element_label_colon'] = 1;
  82. $handler->display->display_options['fields']['field_user_name']['element_default_classes'] = 1;
  83. $handler->display->display_options['fields']['field_user_name']['hide_empty'] = 0;
  84. $handler->display->display_options['fields']['field_user_name']['empty_zero'] = 0;
  85. $handler->display->display_options['fields']['field_user_name']['hide_alter_empty'] = 1;
  86. $handler->display->display_options['fields']['field_user_name']['field_api_classes'] = 0;
  87. /* Sort criterion: User: Created date */
  88. $handler->display->display_options['sorts']['created']['id'] = 'created';
  89. $handler->display->display_options['sorts']['created']['table'] = 'users';
  90. $handler->display->display_options['sorts']['created']['field'] = 'created';
  91. $handler->display->display_options['sorts']['created']['order'] = 'DESC';
  92. /* Contextual filter: User: Uid */
  93. $handler->display->display_options['arguments']['uid']['id'] = 'uid';
  94. $handler->display->display_options['arguments']['uid']['table'] = 'users';
  95. $handler->display->display_options['arguments']['uid']['field'] = 'uid';
  96. $handler->display->display_options['arguments']['uid']['default_action'] = 'default';
  97. $handler->display->display_options['arguments']['uid']['default_argument_type'] = 'current_user';
  98. $handler->display->display_options['arguments']['uid']['default_argument_skip_url'] = 0;
  99. $handler->display->display_options['arguments']['uid']['summary']['number_of_records'] = '0';
  100. $handler->display->display_options['arguments']['uid']['summary']['format'] = 'default_summary';
  101. $handler->display->display_options['arguments']['uid']['summary_options']['items_per_page'] = '25';
  102. $handler->display->display_options['arguments']['uid']['break_phrase'] = 0;
  103. $handler->display->display_options['arguments']['uid']['not'] = 0;
  104. /* Filter criterion: User: Active */
  105. $handler->display->display_options['filters']['status']['id'] = 'status';
  106. $handler->display->display_options['filters']['status']['table'] = 'users';
  107. $handler->display->display_options['filters']['status']['field'] = 'status';
  108. $handler->display->display_options['filters']['status']['value'] = '1';
  109. $handler->display->display_options['filters']['status']['group'] = 1;
  110. $handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
  111.  
  112. /* Display: Block */
  113. $handler = $view->new_display('block', 'Block', 'block');
Advertisement
RAW Paste Data Copied
Advertisement