Drupal: New Comments Block


/ Published in: PHP
Save to your folder(s)

A Views export for Drupal 5. A block that only site admin and site manager roles can access, showing unpublished comments for blog entry content type.


Copy this code and paste it in your HTML
  1. $view = new stdClass();
  2. $view->name = 'NewComments';
  3. $view->description = 'Block for new blog entry comments.';
  4. $view->access = array (
  5. 0 => '3',
  6. 1 => '4',
  7. );
  8. $view->view_args_php = '';
  9. $view->page = FALSE;
  10. $view->page_title = '';
  11. $view->page_header = '';
  12. $view->page_header_format = '1';
  13. $view->page_footer = '';
  14. $view->page_footer_format = '1';
  15. $view->page_empty = '';
  16. $view->page_empty_format = '1';
  17. $view->page_type = 'node';
  18. $view->url = '';
  19. $view->use_pager = TRUE;
  20. $view->nodes_per_page = '10';
  21. $view->block = TRUE;
  22. $view->block_title = 'New Comments';
  23. $view->block_header = '';
  24. $view->block_header_format = '1';
  25. $view->block_footer = '<a href="/admin/content/comment/list/approval">Approval Queue</a>';
  26. $view->block_footer_format = '1';
  27. $view->block_empty = '';
  28. $view->block_empty_format = '1';
  29. $view->block_type = 'list';
  30. $view->nodes_per_block = '25';
  31. $view->block_more = FALSE;
  32. $view->block_use_page_header = FALSE;
  33. $view->block_use_page_footer = FALSE;
  34. $view->block_use_page_empty = FALSE;
  35. $view->sort = array (
  36. 'tablename' => 'comments',
  37. 'field' => 'timestamp',
  38. 'sortorder' => 'DESC',
  39. 'options' => 'normal',
  40. ),
  41. );
  42. $view->argument = array (
  43. );
  44. $view->field = array (
  45. 'tablename' => 'comments',
  46. 'field' => 'subject',
  47. 'label' => '',
  48. 'handler' => 'views_handler_field_commentlink',
  49. 'options' => 'link',
  50. ),
  51. 'tablename' => 'comments',
  52. 'field' => 'name',
  53. 'label' => '',
  54. ),
  55. 'tablename' => 'comments',
  56. 'field' => 'timestamp',
  57. 'label' => '',
  58. 'handler' => 'views_handler_field_date_small',
  59. ),
  60. );
  61. $view->filter = array (
  62. 'tablename' => 'comments',
  63. 'field' => 'status',
  64. 'operator' => '=',
  65. 'options' => '',
  66. 'value' => '1',
  67. ),
  68. );
  69. $view->exposed_filter = array (
  70. );
  71. $view->requires = array(comments);
  72. $views[$view->name] = $view;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.