
You can theme the global view fields (inside views) accoridingly to present them the way you like. Last but not least use the token (from replacement patterns: = User: Uid (raw)) in the "Contextual Filters field" of those settings.Īfter the above you will have a view displaying a table of user names and next to them the counts of each state. In the settings of each global view field choose the corresponding _state_view and display of that view (master display is fine). Note: it is very important to keep the "user:uid" field before the global view fields. Then add a field of "user name" and finally add three (3) consecutive global view fields. Each view will provide you the number of states for every user.Ĭreate another user view, add "user:uid" as field and exclude from display. Edit your copy of to print the search result count wherever you want. You'll find the original in modules/search. Don't forget to use a "user:uid" contextual filter in every view and to filter them appropriately for each state. Replace 'THEMENAME' with the name of your theme. Then use aggregation to count the states for every user. More specificallyĬreate three (3) different views (of users) one for each state (for example new_state_view, active_state_view & resolved_state_view).Īt each view firstly remove any default Sort Criteria (and don't add anything in that section). You can achieve this by using the Views Field View module. Now while creating the views within your contextual filter options will see uid as on the fields for which you can pick value to come from current logged in user, and views will automatically filter down results.
DRUPAL VIEWS GLOBAL COUNTER 1 OF X CODE
The above code exposes a very simple table as in screenshot 'handler' => 'views_handler_argument_user_uid', Get this field as contextual filter option. 'handler' => 'views_handler_relationship', Allow this field to show in relationship option. Allow views to join it with users table if needed while querying database. 'handler' => 'views_handler_filter_string',

'handler' => 'views_handler_filter_numeric', 'handler' => 'views_handler_field_numeric', 'help' => t('Contains records we want exposed to Views.'),

Now since its a custom table, the relation/join for users table with your custom table you have to define while exposing it to views. I am assuming you are storing user information(mostly uid) to know who created what. We do not have token based filters, but instead what we can use is ' contextual filters', with in contextual filters you can get current logged in user.
