fbss_comments_flag.module

Tracking 6.x-3.x branch
  1. drupal
    1. 6 contributions/facebook_status/submodules/fbss_comments/fbss_comments_flag/fbss_comments_flag.module

Integrates Flag with Facebook-style Statuses Comments.

Functions & methods

NameDescription
fbss_comments_flag_facebook_status_deleteImplementation of hook_facebook_status_delete().
fbss_comments_flag_fbss_comments_deleteImplementation of hook_fbss_comments_delete().
fbss_comments_flag_flag_default_flagsImplementation of hook_flag_default_flags().
fbss_comments_flag_flag_definitionsImplementation of hook_flag_definitions().

File

View source
  1. <?php
  2. /**
  3. * @file
  4. * Integrates Flag with Facebook-style Statuses Comments.
  5. */
  6. /**
  7. * Implementation of hook_facebook_status_delete().
  8. */
  9. function fbss_comments_flag_facebook_status_delete($status) {
  10. db_query("DELETE FROM {flag_content} WHERE content_type = 'fbss_comment' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)", $status->sid);
  11. db_query("DELETE FROM {flag_counts} WHERE content_type = 'fbss_comment' AND content_id IN (SELECT cid FROM {fbss_comments} WHERE sid = %d)", $status->sid);
  12. }
  13. /**
  14. * Implementation of hook_fbss_comments_delete().
  15. */
  16. function fbss_comments_flag_fbss_comments_delete($cid) {
  17. db_query("DELETE FROM {flag_content} WHERE content_type = 'fbss_comment' AND content_id = %s", $cid);
  18. db_query("DELETE FROM {flag_counts} WHERE content_type = 'fbss_comment' AND content_id = %s", $cid);
  19. }
  20. /**
  21. * Implementation of hook_flag_definitions().
  22. */
  23. function fbss_comments_flag_flag_definitions() {
  24. return array(
  25. 'fbss_comment' => array(
  26. 'title' => 'Facebook-style Statuses Comment',
  27. 'description' => t('Comments on status updates.'),
  28. 'handler' => 'fbss_comments_flag',
  29. ),
  30. );
  31. }
  32. /**
  33. * Implementation of hook_flag_default_flags().
  34. */
  35. function fbss_comments_flag_flag_default_flags() {
  36. $flags = array();
  37. $flags[] = array(
  38. 'content_type' => 'fbss_comment',
  39. 'name' => 'like_comments',
  40. 'title' => t('Like'),
  41. 'roles' => array('2'),
  42. 'global' => FALSE,
  43. 'types' => array('page'),
  44. 'flag_short' => t('Like'),
  45. 'flag_long' => '',
  46. 'flag_message' => '',
  47. 'unflag_short' => t('Un-like'),
  48. 'unflag_long' => '',
  49. 'unflag_message' => '',
  50. 'show_on_page' => FALSE,
  51. 'show_on_teaser' => FALSE,
  52. 'show_on_form' => FALSE,
  53. 'status' => TRUE,
  54. 'locked' => array('name', 'global', 'types', 'show_on_page', 'show_on_teaser', 'show_on_form', 'status'),
  55. );
  56. return $flags;
  57. }
  58. //This is here because the Flag module does not support magic include files.
  59. module_load_include('inc', 'fbss_comments_flag', 'fbss_comments_flag.flag');