... with Views. Could you tell me how? :]

When using Moofie's code from #368644: Get users who flagged a node comment #1,
I get both anonymous and logged in users who flagged a node. Great.

But when using Views as written in How to setup a "Who's bookmarked this" tab,
with node-type view or user-type view, I always get only logged in users.

Is it a Views' feature, or I can't find an option to display (or to not get rid of) anonymous
users too?

Szy.

Comments

quicksketch’s picture

I suppose you're already using #271582: Allow anonymous users to flag content? For the "Who's bookmarked this" tab, the Views support doesn't yet support showing anonymous users. If we did support this, currently it'd result in a list of users whose name was all was "Anonymous", which wouldn't be very helpful.

szy’s picture

Thanks, it sounds wisely, even though it doesn't help me :]

I always give a name for my anonymous users to look more friendly than a cold
'anonymous' :], eg. 'New Yorker' when building site about NY. Then list like this:

[avatar] New Yorker
[avatar] John15
[avatar] quicksketch
[avatar] New Yorker
[avatar] szy
[avatar] the_drupalist

... looks not so bad... ;)

Thanks for your work for us!
Szy.

szy’s picture

Status: Active » Closed (won't fix)
szy’s picture

Status: Closed (won't fix) » Fixed

@quicksketch, ... but it works! :]

This is working view. Notice, that anonymous shows up only once (the last flag),
but... it is enough for me.

$view = new view;
$view->name = 'Who_Flagged_a_Node';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
  'flag_user_content_rel' => array(
    'label' => 'user flagged content',
    'required' => 1,
    'flag' => 'interesting',
    'id' => 'flag_user_content_rel',
    'table' => 'users',
    'field' => 'flag_user_content_rel',
    'relationship' => 'none',
  ),
  'uid' => array(
    'label' => 'Flag user',
    'required' => 1,
    'id' => 'uid',
    'table' => 'flag_content',
    'field' => 'uid',
    'relationship' => 'flag_user_content_rel',
  ),
));
$handler->override_option('fields', array(
  'picture' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'exclude' => 0,
    'id' => 'picture',
    'table' => 'users',
    'field' => 'picture',
    'relationship' => 'uid',
  ),
  'name' => array(
    'label' => '',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
    ),
    'link_to_user' => 1,
    'overwrite_anonymous' => 0,
    'anonymous_text' => '',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'users',
    'field' => 'name',
    'relationship' => 'uid',
  ),
));
$handler->override_option('sorts', array(
  'timestamp' => array(
    'order' => 'DESC',
    'granularity' => 'second',
    'id' => 'timestamp',
    'table' => 'flag_content',
    'field' => 'timestamp',
    'relationship' => 'flag_user_content_rel',
  ),
));
$handler->override_option('arguments', array(
  'content_id' => array(
    'default_action' => 'default',
    'style_plugin' => 'default_summary',
    'style_options' => array(),
    'wildcard' => 'all',
    'wildcard_substitution' => 'Wszystkie',
    'title' => '',
    'default_argument_type' => 'node',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'not' => 0,
    'id' => 'content_id',
    'table' => 'flag_content',
    'field' => 'content_id',
    'relationship' => 'flag_user_content_rel',
    'validate_user_argument_type' => 'uid',
    'validate_user_roles' => array(
      '2' => 0,
      '4' => 0,
      '3' => 0,
    ),
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_flag_name' => '*relationship*',
    'validate_argument_node_flag_test' => 'flaggable',
    'validate_argument_node_flag_id_type' => 'id',
    'validate_argument_user_flag_name' => '*relationship*',
    'validate_argument_user_flag_test' => 'flaggable',
    'validate_argument_user_flag_id_type' => 'id',
    'validate_argument_node_type' => array(
      'my' => 0,
      'node' => 0,
      'types' => 0,
      'here' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '1' => 0,
      '2' => 0,
      '3' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_user_restrict_roles' => 0,
    'validate_argument_php' => '',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('style_plugin', 'grid');
$handler->override_option('style_options', array(
  'grouping' => '',
  'columns' => '2',
  'alignment' => 'horizontal',
));

:]]

Szy.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.