I'm making a view for the admin dashboard to review comments reported as abusive. Everything works well, except the flag link to unflag the comment. When I add that field at all, it returns a pretty unhelpful ajax error:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/view/comments_flagged_inappropriate/edit/block/ajax
StatusText: Internal Server Error
ResponseText:
And if I save the view it crashes any page that tries to load the view, including the view edit page (if autopreview is on). I had no problem getting the flag link to work on another view for non-global node flags, so I'm a little stumped. Here is my exported view:
$view = new view;
$view->name = 'comments_flagged_inappropriate';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'comment';
$view->human_name = 'Comments flagged inappropriate';
$view->core = 7;
$view->api_version = '3.0-alpha1';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Comments flagged inappropriate';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['inline'] = array(
'subject' => 'subject',
'name' => 'name',
'delete_comment' => 'delete_comment',
'edit_comment' => 'edit_comment',
'replyto_comment' => 'replyto_comment',
);
$handler->display->display_options['row_options']['separator'] = ' ';
$handler->display->display_options['row_options']['hide_empty'] = 1;
/* Relationship: Comment: Content */
$handler->display->display_options['relationships']['nid']['id'] = 'nid';
$handler->display->display_options['relationships']['nid']['table'] = 'comment';
$handler->display->display_options['relationships']['nid']['field'] = 'nid';
$handler->display->display_options['relationships']['nid']['required'] = 1;
/* Relationship: Flags: comment_report */
$handler->display->display_options['relationships']['flag_content_rel']['id'] = 'flag_content_rel';
$handler->display->display_options['relationships']['flag_content_rel']['table'] = 'comment';
$handler->display->display_options['relationships']['flag_content_rel']['field'] = 'flag_content_rel';
$handler->display->display_options['relationships']['flag_content_rel']['flag'] = 'comment_report';
$handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';
/* Field: Comment: Title */
$handler->display->display_options['fields']['subject']['id'] = 'subject';
$handler->display->display_options['fields']['subject']['table'] = 'comment';
$handler->display->display_options['fields']['subject']['field'] = 'subject';
$handler->display->display_options['fields']['subject']['label'] = '';
$handler->display->display_options['fields']['subject']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['subject']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['subject']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['subject']['alter']['trim'] = 0;
$handler->display->display_options['fields']['subject']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['subject']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['subject']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['subject']['alter']['html'] = 0;
$handler->display->display_options['fields']['subject']['hide_empty'] = 0;
$handler->display->display_options['fields']['subject']['empty_zero'] = 0;
$handler->display->display_options['fields']['subject']['link_to_comment'] = 1;
/* Field: Comment: Author */
$handler->display->display_options['fields']['name']['id'] = 'name';
$handler->display->display_options['fields']['name']['table'] = 'comment';
$handler->display->display_options['fields']['name']['field'] = 'name';
$handler->display->display_options['fields']['name']['label'] = '';
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 1;
$handler->display->display_options['fields']['name']['alter']['text'] = '-- [name]';
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['name']['alter']['external'] = 0;
$handler->display->display_options['fields']['name']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
$handler->display->display_options['fields']['name']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
$handler->display->display_options['fields']['name']['element_label_colon'] = 0;
$handler->display->display_options['fields']['name']['element_default_classes'] = 1;
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
$handler->display->display_options['fields']['name']['link_to_user'] = 1;
/* Field: Comment: Post date */
$handler->display->display_options['fields']['created']['id'] = 'created';
$handler->display->display_options['fields']['created']['table'] = 'comment';
$handler->display->display_options['fields']['created']['field'] = 'created';
$handler->display->display_options['fields']['created']['label'] = '';
$handler->display->display_options['fields']['created']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['created']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['created']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['created']['alter']['external'] = 0;
$handler->display->display_options['fields']['created']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['created']['alter']['trim'] = 0;
$handler->display->display_options['fields']['created']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['created']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['created']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['created']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['created']['alter']['html'] = 0;
$handler->display->display_options['fields']['created']['element_label_colon'] = 0;
$handler->display->display_options['fields']['created']['element_default_classes'] = 1;
$handler->display->display_options['fields']['created']['hide_empty'] = 0;
$handler->display->display_options['fields']['created']['empty_zero'] = 0;
/* Field: Fields: Comment */
$handler->display->display_options['fields']['comment_body']['id'] = 'comment_body';
$handler->display->display_options['fields']['comment_body']['table'] = 'field_data_comment_body';
$handler->display->display_options['fields']['comment_body']['field'] = 'comment_body';
$handler->display->display_options['fields']['comment_body']['label'] = '';
$handler->display->display_options['fields']['comment_body']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['external'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['trim'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['comment_body']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['comment_body']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['comment_body']['alter']['html'] = 0;
$handler->display->display_options['fields']['comment_body']['element_label_colon'] = 0;
$handler->display->display_options['fields']['comment_body']['element_default_classes'] = 1;
$handler->display->display_options['fields']['comment_body']['hide_empty'] = 0;
$handler->display->display_options['fields']['comment_body']['empty_zero'] = 0;
$handler->display->display_options['fields']['comment_body']['field_api_classes'] = 0;
/* Field: Comment: Delete link */
$handler->display->display_options['fields']['delete_comment']['id'] = 'delete_comment';
$handler->display->display_options['fields']['delete_comment']['table'] = 'comment';
$handler->display->display_options['fields']['delete_comment']['field'] = 'delete_comment';
$handler->display->display_options['fields']['delete_comment']['label'] = '';
$handler->display->display_options['fields']['delete_comment']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['external'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['trim'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['delete_comment']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['delete_comment']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['delete_comment']['alter']['html'] = 0;
$handler->display->display_options['fields']['delete_comment']['element_label_colon'] = 0;
$handler->display->display_options['fields']['delete_comment']['element_default_classes'] = 1;
$handler->display->display_options['fields']['delete_comment']['hide_empty'] = 0;
$handler->display->display_options['fields']['delete_comment']['empty_zero'] = 0;
/* Field: Comment: Edit link */
$handler->display->display_options['fields']['edit_comment']['id'] = 'edit_comment';
$handler->display->display_options['fields']['edit_comment']['table'] = 'comment';
$handler->display->display_options['fields']['edit_comment']['field'] = 'edit_comment';
$handler->display->display_options['fields']['edit_comment']['label'] = '';
$handler->display->display_options['fields']['edit_comment']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['external'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['trim'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['edit_comment']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['edit_comment']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['edit_comment']['alter']['html'] = 0;
$handler->display->display_options['fields']['edit_comment']['element_label_colon'] = 0;
$handler->display->display_options['fields']['edit_comment']['element_default_classes'] = 1;
$handler->display->display_options['fields']['edit_comment']['hide_empty'] = 0;
$handler->display->display_options['fields']['edit_comment']['empty_zero'] = 0;
$handler->display->display_options['fields']['edit_comment']['destination'] = 0;
/* Field: Comment: Reply-to link */
$handler->display->display_options['fields']['replyto_comment']['id'] = 'replyto_comment';
$handler->display->display_options['fields']['replyto_comment']['table'] = 'comment';
$handler->display->display_options['fields']['replyto_comment']['field'] = 'replyto_comment';
$handler->display->display_options['fields']['replyto_comment']['label'] = '';
$handler->display->display_options['fields']['replyto_comment']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['external'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['trim'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['replyto_comment']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['replyto_comment']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['replyto_comment']['alter']['html'] = 0;
$handler->display->display_options['fields']['replyto_comment']['element_label_colon'] = 0;
$handler->display->display_options['fields']['replyto_comment']['element_default_classes'] = 1;
$handler->display->display_options['fields']['replyto_comment']['hide_empty'] = 0;
$handler->display->display_options['fields']['replyto_comment']['empty_zero'] = 0;
/* Sort criterion: Comment: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'comment';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Comment: Approved */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'comment';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 0;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status_node']['id'] = 'status_node';
$handler->display->display_options['filters']['status_node']['table'] = 'node';
$handler->display->display_options['filters']['status_node']['field'] = 'status';
$handler->display->display_options['filters']['status_node']['relationship'] = 'nid';
$handler->display->display_options['filters']['status_node']['value'] = 1;
$handler->display->display_options['filters']['status_node']['group'] = 0;
$handler->display->display_options['filters']['status_node']['expose']['operator'] = FALSE;
/* Display: Block */
$handler = $view->new_display('block', 'Block', 'block');
$handler->display->display_options['block_description'] = 'Comments flagged inappropriate';
$translatables['comments_flagged_inappropriate'] = array(
t('Master'),
t('Comments flagged inappropriate'),
t('more'),
t('Apply'),
t('Reset'),
t('Sort by'),
t('Asc'),
t('Desc'),
t('Items per page'),
t('- All -'),
t('Offset'),
t('Content'),
t('flag'),
t('-- [name]'),
t('Block'),
);
Comments
Comment #1
scotthorn commentedSorry, between the preview and posting, my entire post was somehow deleted.
I'm working on a view for the admin dashboard that shows all comments that any user has flagged as inappropriate. All the fields work fine, except when I try to add a flag link field for admins to unflag the comment. Doing this throws an ajax error from the autopreview, and if I save the view it crashes any page that it displays on. The ajax error doesn't provide any useful information, so I'm a bit stumped. Here's my exported view:
Comment #2
quicksketchThe current versions of Flag have an issue that prevents comment flags from working properly in Views. It's been fixed in #1116690: Method flag_flag_access_multiple() on 'comment' flags broken and will be included in the next versions.
I've tested out your view and confirmed that it works fine after applying that patch, though I found a small notice error in my testing and have fixed it with this additional patch.
Comment #3
quicksketchSorry for the delay in answering this question. Marking fixed as this should be corrected in the latest 2.x dev releases and will be in beta7.