summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Kiss <marton.kiss@gmail.com>2016-09-29 10:17:06 +0200
committerMarton Kiss <marton.kiss@gmail.com>2016-09-29 10:17:06 +0200
commit2aad953dd83783c378814c959f83fcbae64d0a85 (patch)
tree32cebe0adc9360e03d81aed3272bb3e2e15b5728
parentb026be86bcefeac4c06c93bbf5931de3dbafe767 (diff)
Flag module v3 patch applied to commons modules0.40
Update Flag module to v3.9 as the 2.x branch is discontinued. The patch 0004-accomodate-flag-v3.patch merged with local commons modules under modules/commons directory. SA-CONTRIB-2016-050 https://www.drupal.org/node/2793115 Change-Id: I335963fa16b66d8914071ee5c08b61849384ae6f
Notes
Notes (review): Code-Review+2: Marton Kiss <marton.kiss@gmail.com> Workflow+1: Marton Kiss <marton.kiss@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 10 Oct 2016 15:10:58 +0000 Reviewed-on: https://review.openstack.org/379263 Project: openstack-infra/groups Branch: refs/heads/master
-rw-r--r--drupal-org.make10
-rw-r--r--modules/commons/commons_content_moderation/commons_content_moderation.features.inc31
-rw-r--r--modules/commons/commons_content_moderation/commons_content_moderation.features.user_permission.inc68
-rw-r--r--modules/commons/commons_content_moderation/commons_content_moderation.info7
-rw-r--r--modules/commons/commons_content_moderation/commons_content_moderation.views_default.inc2
-rw-r--r--modules/commons/commons_follow/commons_follow.module6
-rw-r--r--modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.inc32
-rw-r--r--modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.user_permission.inc50
-rw-r--r--modules/commons/commons_follow/commons_follow_group/commons_follow_group.info4
-rw-r--r--modules/commons/commons_follow/commons_follow_group/commons_follow_group.module12
-rw-r--r--modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.inc18
-rw-r--r--modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.user_permission.inc32
-rw-r--r--modules/commons/commons_follow/commons_follow_node/commons_follow_node.info2
-rw-r--r--modules/commons/commons_follow/commons_follow_node/commons_follow_node.module8
-rw-r--r--modules/commons/commons_follow/commons_follow_node/commons_follow_node.views_default.inc8
-rw-r--r--modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.inc18
-rw-r--r--modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.user_permission.inc32
-rw-r--r--modules/commons/commons_follow/commons_follow_term/commons_follow_term.info2
-rw-r--r--modules/commons/commons_follow/commons_follow_term/commons_follow_term.module8
-rw-r--r--modules/commons/commons_follow/commons_follow_term/commons_follow_term.views_default.inc6
-rw-r--r--modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.inc12
-rw-r--r--modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.user_permission.inc32
-rw-r--r--modules/commons/commons_follow/commons_follow_user/commons_follow_user.info2
-rw-r--r--modules/commons/commons_follow/commons_follow_user/commons_follow_user.module16
-rw-r--r--modules/commons/commons_follow/commons_follow_user/commons_follow_user.views_default.inc18
-rw-r--r--modules/commons/commons_like/commons-like.tpl.php4
-rw-r--r--modules/commons/commons_like/commons_like.module2
-rw-r--r--modules/commons/commons_q_a/commons_q_a.module2
-rw-r--r--modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_flag.inc39
-rw-r--r--modules/commons/commons_search/modules/commons_search_solr_user/commons_search_solr_user.module8
30 files changed, 340 insertions, 151 deletions
diff --git a/drupal-org.make b/drupal-org.make
index 2d8abda..36bdba3 100644
--- a/drupal-org.make
+++ b/drupal-org.make
@@ -164,15 +164,7 @@ projects[file_entity][download][revision] = "b610413"
164 164
165projects[flag][type] = "module" 165projects[flag][type] = "module"
166projects[flag][subdir] = "contrib" 166projects[flag][subdir] = "contrib"
167projects[flag][version] = "2.2" 167projects[flag][version] = "3.9"
168
169; Issue #1965760: Manually set taxonomy term flag types because its different.
170; http://drupal.org/node/1965760
171projects[flag][patch][] = "https://drupal.org/files/issues/1965760.29.flag_.entity-tokens.patch"
172
173; Provide a hook to allow default flag definitions to be altered.
174; https://drupal.org/node/2027091#comment-8012263
175projects[flag][patch][] = "https://drupal.org/files/flag-default-flags-alter-hook-2027091-03.patch"
176 168
177projects[flag_abuse][type] = "module" 169projects[flag_abuse][type] = "module"
178projects[flag_abuse][subdir] = "contrib" 170projects[flag_abuse][subdir] = "contrib"
diff --git a/modules/commons/commons_content_moderation/commons_content_moderation.features.inc b/modules/commons/commons_content_moderation/commons_content_moderation.features.inc
index 3a75218..e4999ed 100644
--- a/modules/commons/commons_content_moderation/commons_content_moderation.features.inc
+++ b/modules/commons/commons_content_moderation/commons_content_moderation.features.inc
@@ -27,7 +27,7 @@ function commons_content_moderation_flag_default_flags() {
27 $flags = array(); 27 $flags = array();
28 // Exported flag: "Comment inappropriate". 28 // Exported flag: "Comment inappropriate".
29 $flags['inappropriate_comment'] = array( 29 $flags['inappropriate_comment'] = array(
30 'content_type' => 'comment', 30 'entity_type' => 'comment',
31 'title' => 'Comment inappropriate', 31 'title' => 'Comment inappropriate',
32 'global' => 0, 32 'global' => 0,
33 'types' => array( 33 'types' => array(
@@ -47,29 +47,25 @@ function commons_content_moderation_flag_default_flags() {
47 'unflag_message' => '', 47 'unflag_message' => '',
48 'unflag_denied_text' => '', 48 'unflag_denied_text' => '',
49 'link_type' => 'confirm', 49 'link_type' => 'confirm',
50 'roles' => array( 50 'show_in_links' => array(
51 'flag' => array( 51 'diff_standard' => TRUE,
52 0 => 2, 52 'full' => TRUE,
53 ), 53 'token' => TRUE,
54 'unflag' => array(
55 0 => 2,
56 ),
57 ), 54 ),
58 'weight' => 0, 55 'weight' => 0,
59 'show_on_form' => 0, 56 'show_on_form' => 0,
60 'access_author' => 'comment_others', 57 'access_author' => 'comment_others',
61 'show_on_comment' => 1,
62 'flag_confirmation' => 'Are you sure you want to report this comment as inappropriate?', 58 'flag_confirmation' => 'Are you sure you want to report this comment as inappropriate?',
63 'unflag_confirmation' => 'Are you sure you want to cancel reporting this comment as inappropriate?', 59 'unflag_confirmation' => 'Are you sure you want to cancel reporting this comment as inappropriate?',
64 'module' => 'commons_content_moderation', 60 'module' => 'commons_content_moderation',
65 'locked' => array( 61 'locked' => array(
66 0 => 'name', 62 0 => 'name',
67 ), 63 ),
68 'api_version' => 2, 64 'api_version' => 3,
69 ); 65 );
70 // Exported flag: "Node inappropriate". 66 // Exported flag: "Node inappropriate".
71 $flags['inappropriate_node'] = array( 67 $flags['inappropriate_node'] = array(
72 'content_type' => 'node', 68 'entity_type' => 'node',
73 'title' => 'Node inappropriate', 69 'title' => 'Node inappropriate',
74 'global' => 0, 70 'global' => 0,
75 'types' => array( 71 'types' => array(
@@ -87,19 +83,12 @@ function commons_content_moderation_flag_default_flags() {
87 'unflag_message' => '', 83 'unflag_message' => '',
88 'unflag_denied_text' => '', 84 'unflag_denied_text' => '',
89 'link_type' => 'confirm', 85 'link_type' => 'confirm',
90 'roles' => array( 86 'show_in_links' => array(
91 'flag' => array( 87 'full' => TRUE,
92 0 => 2,
93 ),
94 'unflag' => array(
95 0 => 2,
96 ),
97 ), 88 ),
98 'weight' => 0, 89 'weight' => 0,
99 'show_on_form' => 0, 90 'show_on_form' => 0,
100 'access_author' => '', 91 'access_author' => '',
101 'show_on_page' => 1,
102 'show_on_teaser' => 0,
103 'show_contextual_link' => FALSE, 92 'show_contextual_link' => FALSE,
104 'i18n' => 0, 93 'i18n' => 0,
105 'flag_confirmation' => 'Are you sure you want to report this content as inappropriate?', 94 'flag_confirmation' => 'Are you sure you want to report this content as inappropriate?',
@@ -108,7 +97,7 @@ function commons_content_moderation_flag_default_flags() {
108 'locked' => array( 97 'locked' => array(
109 0 => 'name', 98 0 => 'name',
110 ), 99 ),
111 'api_version' => 2, 100 'api_version' => 3,
112 ); 101 );
113 return $flags; 102 return $flags;
114 103
diff --git a/modules/commons/commons_content_moderation/commons_content_moderation.features.user_permission.inc b/modules/commons/commons_content_moderation/commons_content_moderation.features.user_permission.inc
new file mode 100644
index 0000000..763738f
--- /dev/null
+++ b/modules/commons/commons_content_moderation/commons_content_moderation.features.user_permission.inc
@@ -0,0 +1,68 @@
1<?php
2/**
3 * @file
4 * commons_content_moderation.features.user_permission.inc
5 */
6
7/**
8 * Implements hook_user_default_permissions().
9 */
10function commons_content_moderation_user_default_permissions() {
11 $permissions = array();
12
13 // Exported permission: 'flag abuse_user'.
14 $permissions['flag abuse_user'] = array(
15 'name' => 'flag abuse_user',
16 'roles' => array(
17 'authenticated user' => 'authenticated user',
18 ),
19 'module' => 'flag',
20 );
21
22 // Exported permission: 'flag inappropriate_comment'.
23 $permissions['flag inappropriate_comment'] = array(
24 'name' => 'flag inappropriate_comment',
25 'roles' => array(
26 'authenticated user' => 'authenticated user',
27 ),
28 'module' => 'flag',
29 );
30
31 // Exported permission: 'flag inappropriate_node'.
32 $permissions['flag inappropriate_node'] = array(
33 'name' => 'flag inappropriate_node',
34 'roles' => array(
35 'authenticated user' => 'authenticated user',
36 ),
37 'module' => 'flag',
38 );
39
40 // Exported permission: 'unflag abuse_user'.
41 $permissions['unflag abuse_user'] = array(
42 'name' => 'unflag abuse_user',
43 'roles' => array(
44 'authenticated user' => 'authenticated user',
45 ),
46 'module' => 'flag',
47 );
48
49 // Exported permission: 'unflag inappropriate_comment'.
50 $permissions['unflag inappropriate_comment'] = array(
51 'name' => 'unflag inappropriate_comment',
52 'roles' => array(
53 'authenticated user' => 'authenticated user',
54 ),
55 'module' => 'flag',
56 );
57
58 // Exported permission: 'unflag inappropriate_node'.
59 $permissions['unflag inappropriate_node'] = array(
60 'name' => 'unflag inappropriate_node',
61 'roles' => array(
62 'authenticated user' => 'authenticated user',
63 ),
64 'module' => 'flag',
65 );
66
67 return $permissions;
68} \ No newline at end of file
diff --git a/modules/commons/commons_content_moderation/commons_content_moderation.info b/modules/commons/commons_content_moderation/commons_content_moderation.info
index 2fb3130..962afc6 100644
--- a/modules/commons/commons_content_moderation/commons_content_moderation.info
+++ b/modules/commons/commons_content_moderation/commons_content_moderation.info
@@ -3,6 +3,7 @@ description = Provides a content moderator role which allows privileged users to
3package = Commons - Building blocks 3package = Commons - Building blocks
4core = 7.x 4core = 7.x
5 5
6dependencies[] = comment
6dependencies[] = ctools 7dependencies[] = ctools
7dependencies[] = flag 8dependencies[] = flag
8dependencies[] = flag_abuse 9dependencies[] = flag_abuse
@@ -14,6 +15,12 @@ features[ctools][] = views:views_default:3.0
14features[features_api][] = api:2 15features[features_api][] = api:2
15features[flag][] = inappropriate_comment 16features[flag][] = inappropriate_comment
16features[flag][] = inappropriate_node 17features[flag][] = inappropriate_node
18features[user_permission][] = flag abuse_user
19features[user_permission][] = flag inappropriate_comment
20features[user_permission][] = flag inappropriate_node
21features[user_permission][] = unflag abuse_user
22features[user_permission][] = unflag inappropriate_comment
23features[user_permission][] = unflag inappropriate_node
17features[user_role][] = content moderator 24features[user_role][] = content moderator
18features[variable][] = flag_abuse_flags 25features[variable][] = flag_abuse_flags
19features[views_view][] = commons_content_moderation_reported_comments 26features[views_view][] = commons_content_moderation_reported_comments
diff --git a/modules/commons/commons_content_moderation/commons_content_moderation.views_default.inc b/modules/commons/commons_content_moderation/commons_content_moderation.views_default.inc
index b6edc0f..673a125 100644
--- a/modules/commons/commons_content_moderation/commons_content_moderation.views_default.inc
+++ b/modules/commons/commons_content_moderation/commons_content_moderation.views_default.inc
@@ -245,7 +245,7 @@ function commons_content_moderation_views_default_views() {
245 $handler->display->display_options['fields']['entity_id']['field'] = 'comment_body'; 245 $handler->display->display_options['fields']['entity_id']['field'] = 'comment_body';
246 /* Sort criterion: Flags: Flagged time */ 246 /* Sort criterion: Flags: Flagged time */
247 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp'; 247 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
248 $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content'; 248 $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
249 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp'; 249 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
250 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel'; 250 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
251 /* Filter criterion: Comment: Approved */ 251 /* Filter criterion: Comment: Approved */
diff --git a/modules/commons/commons_follow/commons_follow.module b/modules/commons/commons_follow/commons_follow.module
index 5fa62f8..10f8615 100644
--- a/modules/commons/commons_follow/commons_follow.module
+++ b/modules/commons/commons_follow/commons_follow.module
@@ -111,7 +111,7 @@ function commons_follow_views_default_views_alter(&$views) {
111 111
112 // Exposed "Following" filter. 112 // Exposed "Following" filter.
113 $handler->display->display_options['filters']['flagged']['id'] = 'flagged'; 113 $handler->display->display_options['filters']['flagged']['id'] = 'flagged';
114 $handler->display->display_options['filters']['flagged']['table'] = 'flag_content'; 114 $handler->display->display_options['filters']['flagged']['table'] = 'flagging';
115 $handler->display->display_options['filters']['flagged']['field'] = 'flagged'; 115 $handler->display->display_options['filters']['flagged']['field'] = 'flagged';
116 $handler->display->display_options['filters']['flagged']['relationship'] = 'flag_content_rel'; 116 $handler->display->display_options['filters']['flagged']['relationship'] = 'flag_content_rel';
117 $handler->display->display_options['filters']['flagged']['ui_name'] = 'Following'; 117 $handler->display->display_options['filters']['flagged']['ui_name'] = 'Following';
@@ -309,9 +309,9 @@ function commons_follow_get_followed_content($account = array()) {
309 $results = array(); 309 $results = array();
310 $flag_ids = commons_follow_get_flag_ids(); 310 $flag_ids = commons_follow_get_flag_ids();
311 // Get a list of everything that the user is following. 311 // Get a list of everything that the user is following.
312 $result = db_query("SELECT fid, content_id FROM {flag_content} WHERE fid IN (:fids) AND uid = :uid", array(':fids' => array_keys($flag_ids), ':uid' => $account->uid)); 312 $result = db_query("SELECT fid, entity_id FROM {flagging} WHERE fid IN (:fids) AND uid = :uid", array(':fids' => array_keys($flag_ids), ':uid' => $account->uid));
313 foreach ($result as $this_result) { 313 foreach ($result as $this_result) {
314 $results[$flag_ids[$this_result->fid]][] = $this_result->content_id; 314 $results[$flag_ids[$this_result->fid]][] = $this_result->entity_id;
315 } 315 }
316 316
317 return $results; 317 return $results;
diff --git a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.inc b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.inc
index ec89a6c..f20077a 100644
--- a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.inc
+++ b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.inc
@@ -21,7 +21,7 @@ function commons_follow_group_flag_default_flags() {
21 21
22 // Exported flag: "Groups". 22 // Exported flag: "Groups".
23 $flags['commons_follow_group'] = array( 23 $flags['commons_follow_group'] = array(
24 'content_type' => 'node', 24 'entity_type' => 'node',
25 'title' => 'Groups', 25 'title' => 'Groups',
26 'global' => 0, 26 'global' => 0,
27 'types' => array( 27 'types' => array(
@@ -35,31 +35,25 @@ function commons_follow_group_flag_default_flags() {
35 'unflag_message' => 'Not following', 35 'unflag_message' => 'Not following',
36 'unflag_denied_text' => '', 36 'unflag_denied_text' => '',
37 'link_type' => 'toggle', 37 'link_type' => 'toggle',
38 'roles' => array(
39 'flag' => array(
40 0 => 2,
41 ),
42 'unflag' => array(
43 0 => 2,
44 ),
45 ),
46 'weight' => 0, 38 'weight' => 0,
47 'show_on_form' => 0, 39 'show_on_form' => 0,
48 'access_author' => '', 40 'access_author' => '',
49 'show_on_page' => 1, 41 'show_in_links' => array(
50 'show_on_teaser' => 1, 42 'full' => TRUE,
43 'teaser' => TRUE,
44 ),
51 'show_contextual_link' => FALSE, 45 'show_contextual_link' => FALSE,
52 'i18n' => 0, 46 'i18n' => 0,
53 'module' => 'commons_follow_group', 47 'module' => 'commons_follow_group',
54 'locked' => array( 48 'locked' => array(
55 0 => 'name', 49 0 => 'name',
56 ), 50 ),
57 'api_version' => 2, 51 'api_version' => 3,
58 ); 52 );
59 53
60 // Exported flag: "Commons Follow (Groups - Email)". 54 // Exported flag: "Commons Follow (Groups - Email)".
61 $flags['email_group'] = array( 55 $flags['email_group'] = array(
62 'content_type' => 'node', 56 'entity_type' => 'node',
63 'title' => 'Commons Follow (Groups - Email)', 57 'title' => 'Commons Follow (Groups - Email)',
64 'global' => 0, 58 'global' => 0,
65 'types' => array( 59 'types' => array(
@@ -73,26 +67,16 @@ function commons_follow_group_flag_default_flags() {
73 'unflag_message' => '', 67 'unflag_message' => '',
74 'unflag_denied_text' => '', 68 'unflag_denied_text' => '',
75 'link_type' => 'toggle', 69 'link_type' => 'toggle',
76 'roles' => array(
77 'flag' => array(
78 0 => 2,
79 ),
80 'unflag' => array(
81 0 => 2,
82 ),
83 ),
84 'weight' => -11, 70 'weight' => -11,
85 'show_on_form' => 0, 71 'show_on_form' => 0,
86 'access_author' => '', 72 'access_author' => '',
87 'show_on_page' => 0,
88 'show_on_teaser' => 0,
89 'show_contextual_link' => FALSE, 73 'show_contextual_link' => FALSE,
90 'i18n' => 0, 74 'i18n' => 0,
91 'module' => 'commons_follow_group', 75 'module' => 'commons_follow_group',
92 'locked' => array( 76 'locked' => array(
93 0 => 'name', 77 0 => 'name',
94 ), 78 ),
95 'api_version' => 2, 79 'api_version' => 3,
96 ); 80 );
97 81
98 return $flags; 82 return $flags;
diff --git a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.user_permission.inc b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.user_permission.inc
new file mode 100644
index 0000000..3c1ef2f
--- /dev/null
+++ b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.features.user_permission.inc
@@ -0,0 +1,50 @@
1<?php
2/**
3 * @file
4 * commons_follow_group.features.user_permission.inc
5 */
6
7/**
8 * Implements hook_user_default_permissions().
9 */
10function commons_follow_group_user_default_permissions() {
11 $permissions = array();
12
13 // Exported permission: 'flag commons_follow_group'.
14 $permissions['flag commons_follow_group'] = array(
15 'name' => 'flag commons_follow_group',
16 'roles' => array(
17 'authenticated user' => 'authenticated user',
18 ),
19 'module' => 'flag',
20 );
21
22 // Exported permission: 'flag email_group'.
23 $permissions['flag email_group'] = array(
24 'name' => 'flag email_group',
25 'roles' => array(
26 'authenticated user' => 'authenticated user',
27 ),
28 'module' => 'flag',
29 );
30
31 // Exported permission: 'unflag commons_follow_group'.
32 $permissions['unflag commons_follow_group'] = array(
33 'name' => 'unflag commons_follow_group',
34 'roles' => array(
35 'authenticated user' => 'authenticated user',
36 ),
37 'module' => 'flag',
38 );
39
40 // Exported permission: 'unflag email_group'.
41 $permissions['unflag email_group'] = array(
42 'name' => 'unflag email_group',
43 'roles' => array(
44 'authenticated user' => 'authenticated user',
45 ),
46 'module' => 'flag',
47 );
48
49 return $permissions;
50}
diff --git a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.info b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.info
index cdab940..8099520 100644
--- a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.info
+++ b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.info
@@ -12,6 +12,10 @@ features[ctools][] = strongarm:strongarm:1
12features[features_api][] = api:2 12features[features_api][] = api:2
13features[flag][] = commons_follow_group 13features[flag][] = commons_follow_group
14features[flag][] = email_group 14features[flag][] = email_group
15features[user_permission][] = flag commons_follow_group
16features[user_permission][] = flag email_group
17features[user_permission][] = unflag commons_follow_group
18features[user_permission][] = unflag email_group
15features[variable][] = message_subscribe_og 19features[variable][] = message_subscribe_og
16 20
17; Information added by Drupal.org packaging script on 2015-03-18 21; Information added by Drupal.org packaging script on 2015-03-18
diff --git a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.module b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.module
index 4ed3254..366155a 100644
--- a/modules/commons/commons_follow/commons_follow_group/commons_follow_group.module
+++ b/modules/commons/commons_follow/commons_follow_group/commons_follow_group.module
@@ -19,7 +19,7 @@ function commons_follow_group_commons_follow_get_nids($account, $options) {
19 // Get subscribe flag IDs. 19 // Get subscribe flag IDs.
20 $flag_ids = commons_follow_get_subscription_flags_ids('node'); 20 $flag_ids = commons_follow_get_subscription_flags_ids('node');
21 21
22 $query = db_select('flag_content', 'f'); 22 $query = db_select('flagging', 'f');
23 if (!empty($options['range'])) { 23 if (!empty($options['range'])) {
24 $query->range(0, $options['range']); 24 $query->range(0, $options['range']);
25 } 25 }
@@ -27,9 +27,9 @@ function commons_follow_group_commons_follow_get_nids($account, $options) {
27 $result = $query 27 $result = $query
28 ->condition('fid', $flag_ids, 'IN') 28 ->condition('fid', $flag_ids, 'IN')
29 ->condition('uid', $account->uid, '=') 29 ->condition('uid', $account->uid, '=')
30 ->condition('content_type', 'node', '=') 30 ->condition('entity_type', 'node', '=')
31 ->condition('content_id', $gids['node'], 'IN') 31 ->condition('entity_id', $gids['node'], 'IN')
32 ->fields('f',array('content_id')) 32 ->fields('f',array('entity_id'))
33 ->execute() 33 ->execute()
34 ->fetchAll(); 34 ->fetchAll();
35 35
@@ -39,7 +39,7 @@ function commons_follow_group_commons_follow_get_nids($account, $options) {
39 39
40 $nids = array(); 40 $nids = array();
41 foreach($result as $row) { 41 foreach($result as $row) {
42 $nids[] = $row->content_id; 42 $nids[] = $row->entity_id;
43 } 43 }
44 44
45 // Get the groups' content IDs. 45 // Get the groups' content IDs.
@@ -135,7 +135,7 @@ function commons_follow_group_og_membership_delete(OgMembership $og_membership)
135 } 135 }
136} 136}
137 137
138// function flag($action, $flag_name, $content_id, $account = NULL) { 138// function flag($action, $flag_name, $entity_id, $account = NULL) {
139 139
140function commons_follow_group_sync_flag_to_group_membership($og_membership) { 140function commons_follow_group_sync_flag_to_group_membership($og_membership) {
141 if ($og_membership->entity_type == 'user' && $og_membership->field_name == 'og_user_node') { 141 if ($og_membership->entity_type == 'user' && $og_membership->field_name == 'og_user_node') {
diff --git a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.inc b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.inc
index 145c7fe..2bf5420 100644
--- a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.inc
+++ b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.inc
@@ -19,7 +19,7 @@ function commons_follow_node_flag_default_flags() {
19 19
20 // Exported flag: "Other content you follow". 20 // Exported flag: "Other content you follow".
21 $flags['commons_follow_node'] = array( 21 $flags['commons_follow_node'] = array(
22 'content_type' => 'node', 22 'entity_type' => 'node',
23 'title' => 'Other content', 23 'title' => 'Other content',
24 'global' => 0, 24 'global' => 0,
25 'types' => array(), 25 'types' => array(),
@@ -31,26 +31,20 @@ function commons_follow_node_flag_default_flags() {
31 'unflag_message' => 'Not following', 31 'unflag_message' => 'Not following',
32 'unflag_denied_text' => '', 32 'unflag_denied_text' => '',
33 'link_type' => 'toggle', 33 'link_type' => 'toggle',
34 'roles' => array(
35 'flag' => array(
36 0 => 2,
37 ),
38 'unflag' => array(
39 0 => 2,
40 ),
41 ),
42 'weight' => -10, 34 'weight' => -10,
43 'show_on_form' => 0, 35 'show_on_form' => 0,
44 'access_author' => '', 36 'access_author' => '',
45 'show_on_page' => 1, 37 'show_in_links' => array(
46 'show_on_teaser' => 1, 38 'full' => TRUE,
39 'teaser' => TRUE,
40 ),
47 'show_contextual_link' => FALSE, 41 'show_contextual_link' => FALSE,
48 'i18n' => 0, 42 'i18n' => 0,
49 'module' => 'commons_follow_node', 43 'module' => 'commons_follow_node',
50 'locked' => array( 44 'locked' => array(
51 0 => 'name', 45 0 => 'name',
52 ), 46 ),
53 'api_version' => 2, 47 'api_version' => 3,
54 ); 48 );
55 49
56 return $flags; 50 return $flags;
diff --git a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.user_permission.inc b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.user_permission.inc
new file mode 100644
index 0000000..91974d9
--- /dev/null
+++ b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.features.user_permission.inc
@@ -0,0 +1,32 @@
1<?php
2/**
3 * @file
4 * commons_follow_node.features.user_permission.inc
5 */
6
7/**
8 * Implements hook_user_default_permissions().
9 */
10function commons_follow_node_user_default_permissions() {
11 $permissions = array();
12
13 // Exported permission: 'flag commons_follow_node'.
14 $permissions['flag commons_follow_node'] = array(
15 'name' => 'flag commons_follow_node',
16 'roles' => array(
17 'authenticated user' => 'authenticated user',
18 ),
19 'module' => 'flag',
20 );
21
22 // Exported permission: 'unflag commons_follow_node'.
23 $permissions['unflag commons_follow_node'] = array(
24 'name' => 'unflag commons_follow_node',
25 'roles' => array(
26 'authenticated user' => 'authenticated user',
27 ),
28 'module' => 'flag',
29 );
30
31 return $permissions;
32} \ No newline at end of file
diff --git a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.info b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.info
index 5580b47..b7d1993 100644
--- a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.info
+++ b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.info
@@ -10,6 +10,8 @@ dependencies[] = views_litepager
10features[ctools][] = views:views_default:3.0 10features[ctools][] = views:views_default:3.0
11features[features_api][] = api:2 11features[features_api][] = api:2
12features[flag][] = commons_follow_node 12features[flag][] = commons_follow_node
13features[user_permission][] = flag commons_follow_node
14features[user_permission][] = unflag commons_follow_node
13features[views_view][] = commons_follow_node 15features[views_view][] = commons_follow_node
14 16
15features_exclude[dependencies][views] = views 17features_exclude[dependencies][views] = views
diff --git a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.module b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.module
index 5f49126..74233dd 100644
--- a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.module
+++ b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.module
@@ -19,7 +19,7 @@ function commons_follow_node_commons_follow_get_nids($account, $options) {
19 return array(); 19 return array();
20 } 20 }
21 21
22 $query = db_select('flag_content', 'f'); 22 $query = db_select('flagging', 'f');
23 23
24 if (!empty($options['range'])) { 24 if (!empty($options['range'])) {
25 $query->range(0, $options['range']); 25 $query->range(0, $options['range']);
@@ -28,13 +28,13 @@ function commons_follow_node_commons_follow_get_nids($account, $options) {
28 $result = $query 28 $result = $query
29 ->condition('fid', $flag_ids, 'IN') 29 ->condition('fid', $flag_ids, 'IN')
30 ->condition('uid', $account->uid, '=') 30 ->condition('uid', $account->uid, '=')
31 ->condition('content_type', 'node', '=') 31 ->condition('entity_type', 'node', '=')
32 ->fields('f',array('content_id')) 32 ->fields('f',array('entity_id'))
33 ->execute() 33 ->execute()
34 ->fetchAll(); 34 ->fetchAll();
35 $nids = array(); 35 $nids = array();
36 foreach($result as $row) { 36 foreach($result as $row) {
37 $nids[] = (integer) $row->content_id; 37 $nids[] = (integer) $row->entity_id;
38 } 38 }
39 39
40 return $nids; 40 return $nids;
diff --git a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.views_default.inc b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.views_default.inc
index aa1c658..d4b0c07 100644
--- a/modules/commons/commons_follow/commons_follow_node/commons_follow_node.views_default.inc
+++ b/modules/commons/commons_follow/commons_follow_node/commons_follow_node.views_default.inc
@@ -84,7 +84,7 @@ function commons_follow_node_views_default_views() {
84 $handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any'; 84 $handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any';
85 /* Relationship: Flags: User */ 85 /* Relationship: Flags: User */
86 $handler->display->display_options['relationships']['uid']['id'] = 'uid'; 86 $handler->display->display_options['relationships']['uid']['id'] = 'uid';
87 $handler->display->display_options['relationships']['uid']['table'] = 'flag_content'; 87 $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
88 $handler->display->display_options['relationships']['uid']['field'] = 'uid'; 88 $handler->display->display_options['relationships']['uid']['field'] = 'uid';
89 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel'; 89 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
90 /* Field: Content: Title */ 90 /* Field: Content: Title */
@@ -94,14 +94,14 @@ function commons_follow_node_views_default_views() {
94 $handler->display->display_options['fields']['title_field']['link_to_entity'] = 1; 94 $handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
95 /* Field: Flags: Flag link */ 95 /* Field: Flags: Flag link */
96 $handler->display->display_options['fields']['ops_1']['id'] = 'ops_1'; 96 $handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
97 $handler->display->display_options['fields']['ops_1']['table'] = 'flag_content'; 97 $handler->display->display_options['fields']['ops_1']['table'] = 'flagging';
98 $handler->display->display_options['fields']['ops_1']['field'] = 'ops'; 98 $handler->display->display_options['fields']['ops_1']['field'] = 'ops';
99 $handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1'; 99 $handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1';
100 $handler->display->display_options['fields']['ops_1']['label'] = 'Send email?'; 100 $handler->display->display_options['fields']['ops_1']['label'] = 'Send email?';
101 $handler->display->display_options['fields']['ops_1']['element_label_colon'] = FALSE; 101 $handler->display->display_options['fields']['ops_1']['element_label_colon'] = FALSE;
102 /* Field: Flags: Flag link */ 102 /* Field: Flags: Flag link */
103 $handler->display->display_options['fields']['ops']['id'] = 'ops'; 103 $handler->display->display_options['fields']['ops']['id'] = 'ops';
104 $handler->display->display_options['fields']['ops']['table'] = 'flag_content'; 104 $handler->display->display_options['fields']['ops']['table'] = 'flagging';
105 $handler->display->display_options['fields']['ops']['field'] = 'ops'; 105 $handler->display->display_options['fields']['ops']['field'] = 'ops';
106 $handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel'; 106 $handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';
107 $handler->display->display_options['fields']['ops']['label'] = ''; 107 $handler->display->display_options['fields']['ops']['label'] = '';
@@ -109,7 +109,7 @@ function commons_follow_node_views_default_views() {
109 $handler->display->display_options['fields']['ops']['link_type'] = 'toggle'; 109 $handler->display->display_options['fields']['ops']['link_type'] = 'toggle';
110 /* Sort criterion: Flags: Flagged time */ 110 /* Sort criterion: Flags: Flagged time */
111 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp'; 111 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
112 $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content'; 112 $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
113 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp'; 113 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
114 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel'; 114 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
115 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC'; 115 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
diff --git a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.inc b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.inc
index f2f38c3..8db89fa 100644
--- a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.inc
+++ b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.inc
@@ -19,7 +19,7 @@ function commons_follow_term_flag_default_flags() {
19 19
20 // Exported flag: "Topics you follow". 20 // Exported flag: "Topics you follow".
21 $flags['commons_follow_term'] = array( 21 $flags['commons_follow_term'] = array(
22 'content_type' => 'taxonomy_term', 22 'entity_type' => 'taxonomy_term',
23 'title' => 'Topics', 23 'title' => 'Topics',
24 'global' => 0, 24 'global' => 0,
25 'types' => array( 25 'types' => array(
@@ -33,23 +33,19 @@ function commons_follow_term_flag_default_flags() {
33 'unflag_message' => 'Not following', 33 'unflag_message' => 'Not following',
34 'unflag_denied_text' => '', 34 'unflag_denied_text' => '',
35 'link_type' => 'toggle', 35 'link_type' => 'toggle',
36 'roles' => array(
37 'flag' => array(
38 0 => 2,
39 ),
40 'unflag' => array(
41 0 => 2,
42 ),
43 ),
44 'weight' => -8, 36 'weight' => -8,
45 'show_on_entity' => 1, 37 'show_in_links' => array(
38 'diff_standard' => TRUE,
39 'full' => TRUE,
40 'token' => TRUE,
41 ),
46 'show_on_form' => 0, 42 'show_on_form' => 0,
47 'access_author' => '', 43 'access_author' => '',
48 'module' => 'commons_follow_term', 44 'module' => 'commons_follow_term',
49 'locked' => array( 45 'locked' => array(
50 0 => 'name', 46 0 => 'name',
51 ), 47 ),
52 'api_version' => 2, 48 'api_version' => 3,
53 ); 49 );
54 50
55 return $flags; 51 return $flags;
diff --git a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.user_permission.inc b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.user_permission.inc
new file mode 100644
index 0000000..c9d612c
--- /dev/null
+++ b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.features.user_permission.inc
@@ -0,0 +1,32 @@
1<?php
2/**
3 * @file
4 * commons_follow_term.features.user_permission.inc
5 */
6
7/**
8 * Implements hook_user_default_permissions().
9 */
10function commons_follow_term_user_default_permissions() {
11 $permissions = array();
12
13 // Exported permission: 'flag commons_follow_term'.
14 $permissions['flag commons_follow_term'] = array(
15 'name' => 'flag commons_follow_term',
16 'roles' => array(
17 'authenticated user' => 'authenticated user',
18 ),
19 'module' => 'flag',
20 );
21
22 // Exported permission: 'unflag commons_follow_term'.
23 $permissions['unflag commons_follow_term'] = array(
24 'name' => 'unflag commons_follow_term',
25 'roles' => array(
26 'authenticated user' => 'authenticated user',
27 ),
28 'module' => 'flag',
29 );
30
31 return $permissions;
32} \ No newline at end of file
diff --git a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.info b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.info
index 41692b2..2b51305 100644
--- a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.info
+++ b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.info
@@ -10,6 +10,8 @@ dependencies[] = views_litepager
10features[ctools][] = views:views_default:3.0 10features[ctools][] = views:views_default:3.0
11features[features_api][] = api:2 11features[features_api][] = api:2
12features[flag][] = commons_follow_term 12features[flag][] = commons_follow_term
13features[user_permission][] = flag commons_follow_term
14features[user_permission][] = unflag commons_follow_term
13features[views_view][] = commons_follow_taxonomy_term 15features[views_view][] = commons_follow_taxonomy_term
14 16
15features_exclude[dependencies][ctools] = ctools 17features_exclude[dependencies][ctools] = ctools
diff --git a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.module b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.module
index 2eb4b56..a55bb6c 100644
--- a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.module
+++ b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.module
@@ -19,12 +19,12 @@ function commons_follow_term_commons_follow_get_nids($account, $options) {
19 } 19 }
20 20
21 // Get user's flagged terms. 21 // Get user's flagged terms.
22 $query = db_select('flag_content', 'f'); 22 $query = db_select('flagging', 'f');
23 $result = $query 23 $result = $query
24 ->condition('fid', $flag_ids, 'IN') 24 ->condition('fid', $flag_ids, 'IN')
25 ->condition('uid', $account->uid, '=') 25 ->condition('uid', $account->uid, '=')
26 ->condition('content_type', 'taxonomy_term', '=') 26 ->condition('entity_type', 'taxonomy_term', '=')
27 ->fields('f',array('content_id')) 27 ->fields('f',array('entity_id'))
28 ->execute() 28 ->execute()
29 ->fetchAll(); 29 ->fetchAll();
30 30
@@ -35,7 +35,7 @@ function commons_follow_term_commons_follow_get_nids($account, $options) {
35 35
36 $tids = array(); 36 $tids = array();
37 foreach($result as $row) { 37 foreach($result as $row) {
38 $tids[] = (integer) $row->content_id; 38 $tids[] = (integer) $row->entity_id;
39 } 39 }
40 40
41 // Get IDs of nodes tagged by the specified terms. 41 // Get IDs of nodes tagged by the specified terms.
diff --git a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.views_default.inc b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.views_default.inc
index 24fc59c..ec2306a 100644
--- a/modules/commons/commons_follow/commons_follow_term/commons_follow_term.views_default.inc
+++ b/modules/commons/commons_follow/commons_follow_term/commons_follow_term.views_default.inc
@@ -84,7 +84,7 @@ function commons_follow_term_views_default_views() {
84 $handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any'; 84 $handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any';
85 /* Relationship: Flags: User */ 85 /* Relationship: Flags: User */
86 $handler->display->display_options['relationships']['uid']['id'] = 'uid'; 86 $handler->display->display_options['relationships']['uid']['id'] = 'uid';
87 $handler->display->display_options['relationships']['uid']['table'] = 'flag_content'; 87 $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
88 $handler->display->display_options['relationships']['uid']['field'] = 'uid'; 88 $handler->display->display_options['relationships']['uid']['field'] = 'uid';
89 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel'; 89 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
90 /* Field: Taxonomy term: Name */ 90 /* Field: Taxonomy term: Name */
@@ -97,13 +97,13 @@ function commons_follow_term_views_default_views() {
97 $handler->display->display_options['fields']['name']['link_to_taxonomy'] = TRUE; 97 $handler->display->display_options['fields']['name']['link_to_taxonomy'] = TRUE;
98 /* Field: Flags: Flag link */ 98 /* Field: Flags: Flag link */
99 $handler->display->display_options['fields']['ops_1']['id'] = 'ops_1'; 99 $handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
100 $handler->display->display_options['fields']['ops_1']['table'] = 'flag_content'; 100 $handler->display->display_options['fields']['ops_1']['table'] = 'flagging';
101 $handler->display->display_options['fields']['ops_1']['field'] = 'ops'; 101 $handler->display->display_options['fields']['ops_1']['field'] = 'ops';
102 $handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1'; 102 $handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1';
103 $handler->display->display_options['fields']['ops_1']['label'] = 'Send email?'; 103 $handler->display->display_options['fields']['ops_1']['label'] = 'Send email?';
104 /* Field: Flags: Flag link */ 104 /* Field: Flags: Flag link */
105 $handler->display->display_options['fields']['ops']['id'] = 'ops'; 105 $handler->display->display_options['fields']['ops']['id'] = 'ops';
106 $handler->display->display_options['fields']['ops']['table'] = 'flag_content'; 106 $handler->display->display_options['fields']['ops']['table'] = 'flagging';
107 $handler->display->display_options['fields']['ops']['field'] = 'ops'; 107 $handler->display->display_options['fields']['ops']['field'] = 'ops';
108 $handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel'; 108 $handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';
109 $handler->display->display_options['fields']['ops']['label'] = ''; 109 $handler->display->display_options['fields']['ops']['label'] = '';
diff --git a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.inc b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.inc
index 79061c5..fe64b85 100644
--- a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.inc
+++ b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.inc
@@ -28,7 +28,7 @@ function commons_follow_user_flag_default_flags() {
28 28
29 // Exported flag: "People". 29 // Exported flag: "People".
30 $flags['commons_follow_user'] = array( 30 $flags['commons_follow_user'] = array(
31 'content_type' => 'user', 31 'entity_type' => 'user',
32 'title' => 'People', 32 'title' => 'People',
33 'global' => 0, 33 'global' => 0,
34 'types' => array(), 34 'types' => array(),
@@ -40,14 +40,6 @@ function commons_follow_user_flag_default_flags() {
40 'unflag_message' => 'Not following', 40 'unflag_message' => 'Not following',
41 'unflag_denied_text' => '', 41 'unflag_denied_text' => '',
42 'link_type' => 'toggle', 42 'link_type' => 'toggle',
43 'roles' => array(
44 'flag' => array(
45 0 => 2,
46 ),
47 'unflag' => array(
48 0 => 2,
49 ),
50 ),
51 'weight' => -13, 43 'weight' => -13,
52 'show_on_form' => 0, 44 'show_on_form' => 0,
53 'access_author' => '', 45 'access_author' => '',
@@ -57,7 +49,7 @@ function commons_follow_user_flag_default_flags() {
57 'locked' => array( 49 'locked' => array(
58 0 => 'name', 50 0 => 'name',
59 ), 51 ),
60 'api_version' => 2, 52 'api_version' => 3,
61 ); 53 );
62 54
63 return $flags; 55 return $flags;
diff --git a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.user_permission.inc b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.user_permission.inc
new file mode 100644
index 0000000..1147627
--- /dev/null
+++ b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.features.user_permission.inc
@@ -0,0 +1,32 @@
1<?php
2/**
3 * @file
4 * commons_follow_user.features.user_permission.inc
5 */
6
7/**
8 * Implements hook_user_default_permissions().
9 */
10function commons_follow_user_user_default_permissions() {
11 $permissions = array();
12
13 // Exported permission: 'flag commons_follow_user'.
14 $permissions['flag commons_follow_user'] = array(
15 'name' => 'flag commons_follow_user',
16 'roles' => array(
17 'authenticated user' => 'authenticated user',
18 ),
19 'module' => 'flag',
20 );
21
22 // Exported permission: 'unflag commons_follow_user'.
23 $permissions['unflag commons_follow_user'] = array(
24 'name' => 'unflag commons_follow_user',
25 'roles' => array(
26 'authenticated user' => 'authenticated user',
27 ),
28 'module' => 'flag',
29 );
30
31 return $permissions;
32} \ No newline at end of file
diff --git a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.info b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.info
index fc8cc14..eb9a819 100644
--- a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.info
+++ b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.info
@@ -22,6 +22,8 @@ features[features_api][] = api:2
22features[field_instance][] = message-commons_follow_user_user_followed-field_target_users 22features[field_instance][] = message-commons_follow_user_user_followed-field_target_users
23features[flag][] = commons_follow_user 23features[flag][] = commons_follow_user
24features[message_type][] = commons_follow_user_user_followed 24features[message_type][] = commons_follow_user_user_followed
25features[user_permission][] = flag commons_follow_user
26features[user_permission][] = unflag commons_follow_user
25features[variable][] = field_bundle_settings_message__commons_follow_user_user_followed 27features[variable][] = field_bundle_settings_message__commons_follow_user_user_followed
26features[views_view][] = commons_follow_user 28features[views_view][] = commons_follow_user
27features[views_view][] = commons_follow_user_followers 29features[views_view][] = commons_follow_user_followers
diff --git a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.module b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.module
index 0f4cac6..f8d7f3b 100644
--- a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.module
+++ b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.module
@@ -21,12 +21,12 @@ function commons_follow_user_commons_follow_get_nids($account, $options) {
21 } 21 }
22 22
23 // Get flagged user IDs. 23 // Get flagged user IDs.
24 $query = db_select('flag_content', 'f'); 24 $query = db_select('flagging', 'f');
25 $result = $query 25 $result = $query
26 ->condition('fid', $flag_ids, 'IN') 26 ->condition('fid', $flag_ids, 'IN')
27 ->condition('uid', $account->uid, '=') 27 ->condition('uid', $account->uid, '=')
28 ->condition('content_type', 'user', '=') 28 ->condition('entity_type', 'user', '=')
29 ->fields('f',array('content_id')) 29 ->fields('f',array('entity_id'))
30 ->execute() 30 ->execute()
31 ->fetchAll(); 31 ->fetchAll();
32 32
@@ -37,7 +37,7 @@ function commons_follow_user_commons_follow_get_nids($account, $options) {
37 37
38 $uids = array(); 38 $uids = array();
39 foreach($result as $row) { 39 foreach($result as $row) {
40 $uids[] = (integer) $row->content_id; 40 $uids[] = (integer) $row->entity_id;
41 } 41 }
42 42
43 // Get the user's node IDs. 43 // Get the user's node IDs.
@@ -63,12 +63,12 @@ function commons_follow_user_commons_follow_get_nids($account, $options) {
63} 63}
64 64
65/** 65/**
66 * Implements hook_flag(). 66 * Implements hook_flag_flag().
67 */ 67 */
68function commons_follow_user_flag($op, $flag, $content_id, $account, $fcid) { 68function commons_follow_user_flag_flag($flag, $entity_id, $account, $fcid) {
69 // Display an activity stream message when a user follows another user. 69 // Display an activity stream message when a user follows another user.
70 if (module_exists('commons_activity_streams') && $flag->name == 'commons_follow_user' && $op == 'flag') { 70 if (module_exists('commons_activity_streams') && $flag->name == 'commons_follow_user') {
71 $followed_user = user_load($content_id); 71 $followed_user = user_load($entity_id);
72 // Don't generate a message for flagging blocked users. 72 // Don't generate a message for flagging blocked users.
73 if (!$followed_user->status) { 73 if (!$followed_user->status) {
74 return; 74 return;
diff --git a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.views_default.inc b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.views_default.inc
index e79fddf..005e8e6 100644
--- a/modules/commons/commons_follow/commons_follow_user/commons_follow_user.views_default.inc
+++ b/modules/commons/commons_follow/commons_follow_user/commons_follow_user.views_default.inc
@@ -84,7 +84,7 @@ function commons_follow_user_views_default_views() {
84 $handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any'; 84 $handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any';
85 /* Relationship: Flags: User */ 85 /* Relationship: Flags: User */
86 $handler->display->display_options['relationships']['uid']['id'] = 'uid'; 86 $handler->display->display_options['relationships']['uid']['id'] = 'uid';
87 $handler->display->display_options['relationships']['uid']['table'] = 'flag_content'; 87 $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
88 $handler->display->display_options['relationships']['uid']['field'] = 'uid'; 88 $handler->display->display_options['relationships']['uid']['field'] = 'uid';
89 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel'; 89 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
90 /* Field: User: Name */ 90 /* Field: User: Name */
@@ -96,20 +96,20 @@ function commons_follow_user_views_default_views() {
96 $handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE; 96 $handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
97 /* Field: Flags: Flag link */ 97 /* Field: Flags: Flag link */
98 $handler->display->display_options['fields']['ops_1']['id'] = 'ops_1'; 98 $handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
99 $handler->display->display_options['fields']['ops_1']['table'] = 'flag_content'; 99 $handler->display->display_options['fields']['ops_1']['table'] = 'flagging';
100 $handler->display->display_options['fields']['ops_1']['field'] = 'ops'; 100 $handler->display->display_options['fields']['ops_1']['field'] = 'ops';
101 $handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1'; 101 $handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1';
102 $handler->display->display_options['fields']['ops_1']['label'] = 'Send email?'; 102 $handler->display->display_options['fields']['ops_1']['label'] = 'Send email?';
103 /* Field: Flags: Flag link */ 103 /* Field: Flags: Flag link */
104 $handler->display->display_options['fields']['ops']['id'] = 'ops'; 104 $handler->display->display_options['fields']['ops']['id'] = 'ops';
105 $handler->display->display_options['fields']['ops']['table'] = 'flag_content'; 105 $handler->display->display_options['fields']['ops']['table'] = 'flagging';
106 $handler->display->display_options['fields']['ops']['field'] = 'ops'; 106 $handler->display->display_options['fields']['ops']['field'] = 'ops';
107 $handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel'; 107 $handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';
108 $handler->display->display_options['fields']['ops']['label'] = ''; 108 $handler->display->display_options['fields']['ops']['label'] = '';
109 $handler->display->display_options['fields']['ops']['element_label_colon'] = FALSE; 109 $handler->display->display_options['fields']['ops']['element_label_colon'] = FALSE;
110 /* Sort criterion: Flags: Flagged time */ 110 /* Sort criterion: Flags: Flagged time */
111 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp'; 111 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
112 $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content'; 112 $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
113 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp'; 113 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
114 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel'; 114 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
115 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC'; 115 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
@@ -206,7 +206,7 @@ function commons_follow_user_views_default_views() {
206 $handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any'; 206 $handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';
207 /* Relationship: Flags: User */ 207 /* Relationship: Flags: User */
208 $handler->display->display_options['relationships']['uid']['id'] = 'uid'; 208 $handler->display->display_options['relationships']['uid']['id'] = 'uid';
209 $handler->display->display_options['relationships']['uid']['table'] = 'flag_content'; 209 $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
210 $handler->display->display_options['relationships']['uid']['field'] = 'uid'; 210 $handler->display->display_options['relationships']['uid']['field'] = 'uid';
211 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel'; 211 $handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
212 $handler->display->display_options['relationships']['uid']['required'] = TRUE; 212 $handler->display->display_options['relationships']['uid']['required'] = TRUE;
@@ -233,13 +233,13 @@ function commons_follow_user_views_default_views() {
233 $handler->display->display_options['fields']['name']['element_default_classes'] = FALSE; 233 $handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
234 /* Sort criterion: Flags: Flagged time */ 234 /* Sort criterion: Flags: Flagged time */
235 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp'; 235 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
236 $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content'; 236 $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
237 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp'; 237 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
238 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel'; 238 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
239 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC'; 239 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
240 /* Contextual filter: Flags: Content ID */ 240 /* Contextual filter: Flags: Content ID */
241 $handler->display->display_options['arguments']['content_id']['id'] = 'content_id'; 241 $handler->display->display_options['arguments']['content_id']['id'] = 'content_id';
242 $handler->display->display_options['arguments']['content_id']['table'] = 'flag_content'; 242 $handler->display->display_options['arguments']['content_id']['table'] = 'flagging';
243 $handler->display->display_options['arguments']['content_id']['field'] = 'content_id'; 243 $handler->display->display_options['arguments']['content_id']['field'] = 'content_id';
244 $handler->display->display_options['arguments']['content_id']['relationship'] = 'flag_content_rel'; 244 $handler->display->display_options['arguments']['content_id']['relationship'] = 'flag_content_rel';
245 $handler->display->display_options['arguments']['content_id']['default_action'] = 'default'; 245 $handler->display->display_options['arguments']['content_id']['default_action'] = 'default';
@@ -381,13 +381,13 @@ function commons_follow_user_views_default_views() {
381 $handler->display->display_options['fields']['name']['element_default_classes'] = FALSE; 381 $handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
382 /* Sort criterion: Flags: Flagged time */ 382 /* Sort criterion: Flags: Flagged time */
383 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp'; 383 $handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
384 $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content'; 384 $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
385 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp'; 385 $handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
386 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel'; 386 $handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
387 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC'; 387 $handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
388 /* Contextual filter: Flags: User uid */ 388 /* Contextual filter: Flags: User uid */
389 $handler->display->display_options['arguments']['uid']['id'] = 'uid'; 389 $handler->display->display_options['arguments']['uid']['id'] = 'uid';
390 $handler->display->display_options['arguments']['uid']['table'] = 'flag_content'; 390 $handler->display->display_options['arguments']['uid']['table'] = 'flagging';
391 $handler->display->display_options['arguments']['uid']['field'] = 'uid'; 391 $handler->display->display_options['arguments']['uid']['field'] = 'uid';
392 $handler->display->display_options['arguments']['uid']['relationship'] = 'flag_content_rel'; 392 $handler->display->display_options['arguments']['uid']['relationship'] = 'flag_content_rel';
393 $handler->display->display_options['arguments']['uid']['default_action'] = 'default'; 393 $handler->display->display_options['arguments']['uid']['default_action'] = 'default';
diff --git a/modules/commons/commons_like/commons-like.tpl.php b/modules/commons/commons_like/commons-like.tpl.php
index ab83a4a..e07e5a7 100644
--- a/modules/commons/commons_like/commons-like.tpl.php
+++ b/modules/commons/commons_like/commons-like.tpl.php
@@ -32,8 +32,8 @@
32 * ) 32 * )
33 * - $mode: Display mode. 33 * - $mode: Display mode.
34 * - $just_voted: Indicator whether the user has just voted (boolean). 34 * - $just_voted: Indicator whether the user has just voted (boolean).
35 * - $content_type: "node" or "comment". 35 * - $entity_type: "node" or "comment".
36 * - $content_id: Node or comment id. 36 * - $entity_id: Node or comment id.
37 * - $buttons: Array with themed buttons (built in preprocess function). 37 * - $buttons: Array with themed buttons (built in preprocess function).
38 * - $info: String with user readable information (built in preprocess function). 38 * - $info: String with user readable information (built in preprocess function).
39 */ 39 */
diff --git a/modules/commons/commons_like/commons_like.module b/modules/commons/commons_like/commons_like.module
index d45ff3f..caa3be1 100644
--- a/modules/commons/commons_like/commons_like.module
+++ b/modules/commons/commons_like/commons_like.module
@@ -89,7 +89,7 @@ function commons_like_existing_node_like_messages($acting_uid, $target_nids) {
89function commons_like_theme() { 89function commons_like_theme() {
90 return array( 90 return array(
91 'rate_template_commons_like' => array( 91 'rate_template_commons_like' => array(
92 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'content_type' => NULL, 'content_id' => NULL, 'display_options' => NULL), 92 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'entity_type' => NULL, 'entity_id' => NULL, 'display_options' => NULL),
93 'template' => 'commons-like', 93 'template' => 'commons-like',
94 ), 94 ),
95 ); 95 );
diff --git a/modules/commons/commons_q_a/commons_q_a.module b/modules/commons/commons_q_a/commons_q_a.module
index 6725a5c..9d886c6 100644
--- a/modules/commons/commons_q_a/commons_q_a.module
+++ b/modules/commons/commons_q_a/commons_q_a.module
@@ -12,7 +12,7 @@ include_once 'commons_q_a.features.inc';
12function commons_q_a_theme() { 12function commons_q_a_theme() {
13 return array( 13 return array(
14 'rate_template_commons_thumbs_up_down' => array( 14 'rate_template_commons_thumbs_up_down' => array(
15 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'content_type' => NULL, 'content_id' => NULL, 'display_options' => NULL), 15 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'entity_type' => NULL, 'entity_id' => NULL, 'display_options' => NULL),
16 'template' => 'commons-thumbs-up-down', 16 'template' => 'commons-thumbs-up-down',
17 ), 17 ),
18 ); 18 );
diff --git a/modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_flag.inc b/modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_flag.inc
index 8f3b4b2..01c7ef3 100644
--- a/modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_flag.inc
+++ b/modules/commons/commons_radioactivity/includes/incidents/commons_radioactivity.incidents_flag.inc
@@ -6,26 +6,37 @@
6 */ 6 */
7 7
8/** 8/**
9 * Implements hook_flag(). 9 * Implements hook_flag_flag().
10 * 10 *
11 * Trigger radioactivity incidents when a user follows a node or group. 11 * Trigger radioactivity incidents when a user follows a node or group.
12 */ 12 */
13function commons_radioactivity_flag($op, $flag, $content_id, $account, $fcid) { 13function commons_radioactivity_flag_flag($flag, $entity_id, $account, $fcid) {
14 if (in_array($flag->name, array('commons_follow_node', 'commons_follow_group'))) { 14 if (in_array($flag->name, array('commons_follow_node', 'commons_follow_group'))) {
15 $node = node_load($content_id); 15 $node = node_load($entity_id);
16 16
17 if ($op == 'flag') { 17 // A user following their own node shouldn't add to its radioactivity.
18 // A user following their own node should not increase radioactivity. 18 if ($node->uid == $account->uid) {
19 if ($node->uid != $account->uid) { 19 return;
20 commons_radioactivity_incident_node($node, COMMONS_RADIOACTIVITY_FLAG_NODE);
21 }
22 } 20 }
23 21
24 if ($op == 'unflag') { 22 commons_radioactivity_incident_node($node, COMMONS_RADIOACTIVITY_FLAG_NODE);
25 // A user unfollowing their own node should not decrease radioactivity.
26 if ($node->uid != $account->uid) {
27 commons_radioactivity_incident_node($node, -1 * COMMONS_RADIOACTIVITY_FLAG_NODE);
28 }
29 }
30 } 23 }
31} 24}
25
26/**
27 * Implements hook_flag_unflag().
28 *
29 * Trigger radioactivity incidents when a user follows a node or group.
30 */
31function commons_radioactivity_flag_unflag($flag, $entity_id, $account, $flagging) {
32 if (in_array($flag->name, array('commons_follow_node', 'commons_follow_group'))) {
33 $node = node_load($entity_id);
34
35 // A user unfollowing their own node shouldn't add to its radioactivity.
36 if ($node->uid == $account->uid) {
37 return;
38 }
39
40 commons_radioactivity_incident_node($node, -1 * COMMONS_RADIOACTIVITY_FLAG_NODE);
41 }
42} \ No newline at end of file
diff --git a/modules/commons/commons_search/modules/commons_search_solr_user/commons_search_solr_user.module b/modules/commons/commons_search/modules/commons_search_solr_user/commons_search_solr_user.module
index d003bfe..39a9ec1 100644
--- a/modules/commons/commons_search/modules/commons_search_solr_user/commons_search_solr_user.module
+++ b/modules/commons/commons_search/modules/commons_search_solr_user/commons_search_solr_user.module
@@ -86,9 +86,9 @@ function commons_search_solr_user_apachesolr_search_page_alter(&$build, $search_
86 $out_results = array(); 86 $out_results = array();
87 if ($flagged && $flag = flag_get_flag('commons_follow_user')) { 87 if ($flagged && $flag = flag_get_flag('commons_follow_user')) {
88 // Get the count of flagged users for a particular account. 88 // Get the count of flagged users for a particular account.
89 $fl_results = db_select('flag_content', 'f') 89 $fl_results = db_select('flagging', 'f')
90 ->fields('f', array('content_id', 'uid')) 90 ->fields('f', array('entity_id', 'uid'))
91 ->condition('f.content_type', 'user', '=') 91 ->condition('f.entity_type','user','=')
92 ->condition('f.uid', $user->uid, '=') 92 ->condition('f.uid', $user->uid, '=')
93 ->condition('f.fid', $flag->fid, '=') 93 ->condition('f.fid', $flag->fid, '=')
94 ->extend('PagerDefault')->limit($limit) 94 ->extend('PagerDefault')->limit($limit)
@@ -96,7 +96,7 @@ function commons_search_solr_user_apachesolr_search_page_alter(&$build, $search_
96 ->addMetaData('flagged', $flagged) 96 ->addMetaData('flagged', $flagged)
97 ->execute(); 97 ->execute();
98 while ($record = $fl_results->fetchAssoc()) { 98 while ($record = $fl_results->fetchAssoc()) {
99 $out_results[] = user_view(user_load($record['content_id']), 'search_results'); 99 $out_results[] = user_view(user_load($record['entity_id']), 'search_results');
100 } 100 }
101 $build['pager'] = array('#theme' => 'pager'); 101 $build['pager'] = array('#theme' => 'pager');
102 } 102 }