How to remove Anonymous user from the users view
I've a View displaying users of my website.
how can i remove the user Anonymous from my View ?
i.e. 35 author 16 voter 0 Anonymous 0 user34
I've tried with a filter "User:Name != Anonymous" but i开发者_JAVA技巧t doesn't work.
This is how the added filter looks like: "User: Name not in Unknown"
thanks
If you don't have user 0 in your database, then that's the cause of the problem. To fix it you need to run two queries.
INSERT INTO users (uid) VALUES (0);
UPDATE users SET uid = 0 WHERE uid = last_insert_id();
(this is for MySQL).
For your special case with the empty user with uid you can run:
UPDATE users SET uid = 0 WHERE uid = 11;
That should fix your problems. Could be your db version didn't support last_insert_id().
Add the filter User: Name, and set it to Is not one of. Type in Anonymous and wait for the form autocomplete to find the Anonymous user. Your filter should look like User: Name <> Anonymous.
Here's an export of a View that lists all users except Anonymous:
$view = new view;
$view->name = 'users';
$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('fields', array(
  'name' => array(
    'label' => 'Name',
    'alter' => array(
      'alter_text' => 0,
      'text' => '',
      'make_link' => 0,
      'path' => '',
      'link_class' => '',
      'alt' => '',
      'prefix' => '',
      'suffix' => '',
      'target' => '',
      'help' => '',
      'trim' => 0,
      'max_length' => '',
      'word_boundary' => 1,
      'ellipsis' => 1,
      'html' => 0,
      'strip_tags' => 0,
    ),
    'empty' => '',
    'hide_empty' => 0,
    'empty_zero' => 0,
    'link_to_user' => 1,
    'overwrite_anonymous' => 0,
    'anonymous_text' => '',
    'exclude' => 0,
    'id' => 'name',
    'table' => 'users',
    'field' => 'name',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'uid' => array(
    'operator' => 'not in',
    'value' => array(
      '0' => 0,
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'uid',
    'table' => 'users',
    'field' => 'uid',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论