![Marton Kiss](/assets/img/avatar_default.png)
The Flag module 2.x branch is discontinued and a security issue enforce the upgrade to 3.x. This patch contains all the changes required in commons modules. Change-Id: Ifb4b29198aeb8067878897bf16acf6391db0c321
1072 lines
47 KiB
Diff
1072 lines
47 KiB
Diff
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() {
|
|
$flags = array();
|
|
// Exported flag: "Comment inappropriate".
|
|
$flags['inappropriate_comment'] = array(
|
|
- 'content_type' => 'comment',
|
|
+ 'entity_type' => 'comment',
|
|
'title' => 'Comment inappropriate',
|
|
'global' => 0,
|
|
'types' => array(
|
|
@@ -47,29 +47,25 @@ function commons_content_moderation_flag_default_flags() {
|
|
'unflag_message' => '',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'confirm',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
+ 'show_in_links' => array(
|
|
+ 'diff_standard' => TRUE,
|
|
+ 'full' => TRUE,
|
|
+ 'token' => TRUE,
|
|
),
|
|
'weight' => 0,
|
|
'show_on_form' => 0,
|
|
'access_author' => 'comment_others',
|
|
- 'show_on_comment' => 1,
|
|
'flag_confirmation' => 'Are you sure you want to report this comment as inappropriate?',
|
|
'unflag_confirmation' => 'Are you sure you want to cancel reporting this comment as inappropriate?',
|
|
'module' => 'commons_content_moderation',
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
// Exported flag: "Node inappropriate".
|
|
$flags['inappropriate_node'] = array(
|
|
- 'content_type' => 'node',
|
|
+ 'entity_type' => 'node',
|
|
'title' => 'Node inappropriate',
|
|
'global' => 0,
|
|
'types' => array(
|
|
@@ -87,19 +83,12 @@ function commons_content_moderation_flag_default_flags() {
|
|
'unflag_message' => '',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'confirm',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
+ 'show_in_links' => array(
|
|
+ 'full' => TRUE,
|
|
),
|
|
'weight' => 0,
|
|
'show_on_form' => 0,
|
|
'access_author' => '',
|
|
- 'show_on_page' => 1,
|
|
- 'show_on_teaser' => 0,
|
|
'show_contextual_link' => FALSE,
|
|
'i18n' => 0,
|
|
'flag_confirmation' => 'Are you sure you want to report this content as inappropriate?',
|
|
@@ -108,7 +97,7 @@ function commons_content_moderation_flag_default_flags() {
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
return $flags;
|
|
|
|
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 @@
|
|
+<?php
|
|
+/**
|
|
+ * @file
|
|
+ * commons_content_moderation.features.user_permission.inc
|
|
+ */
|
|
+
|
|
+/**
|
|
+ * Implements hook_user_default_permissions().
|
|
+ */
|
|
+function commons_content_moderation_user_default_permissions() {
|
|
+ $permissions = array();
|
|
+
|
|
+ // Exported permission: 'flag abuse_user'.
|
|
+ $permissions['flag abuse_user'] = array(
|
|
+ 'name' => 'flag abuse_user',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'flag inappropriate_comment'.
|
|
+ $permissions['flag inappropriate_comment'] = array(
|
|
+ 'name' => 'flag inappropriate_comment',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'flag inappropriate_node'.
|
|
+ $permissions['flag inappropriate_node'] = array(
|
|
+ 'name' => 'flag inappropriate_node',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag abuse_user'.
|
|
+ $permissions['unflag abuse_user'] = array(
|
|
+ 'name' => 'unflag abuse_user',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag inappropriate_comment'.
|
|
+ $permissions['unflag inappropriate_comment'] = array(
|
|
+ 'name' => 'unflag inappropriate_comment',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag inappropriate_node'.
|
|
+ $permissions['unflag inappropriate_node'] = array(
|
|
+ 'name' => 'unflag inappropriate_node',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ return $permissions;
|
|
+}
|
|
\ 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
|
|
package = Commons - Building blocks
|
|
core = 7.x
|
|
|
|
+dependencies[] = comment
|
|
dependencies[] = ctools
|
|
dependencies[] = flag
|
|
dependencies[] = flag_abuse
|
|
@@ -14,6 +15,12 @@ features[ctools][] = views:views_default:3.0
|
|
features[features_api][] = api:2
|
|
features[flag][] = inappropriate_comment
|
|
features[flag][] = inappropriate_node
|
|
+features[user_permission][] = flag abuse_user
|
|
+features[user_permission][] = flag inappropriate_comment
|
|
+features[user_permission][] = flag inappropriate_node
|
|
+features[user_permission][] = unflag abuse_user
|
|
+features[user_permission][] = unflag inappropriate_comment
|
|
+features[user_permission][] = unflag inappropriate_node
|
|
features[user_role][] = content moderator
|
|
features[variable][] = flag_abuse_flags
|
|
features[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() {
|
|
$handler->display->display_options['fields']['entity_id']['field'] = 'comment_body';
|
|
/* Sort criterion: Flags: Flagged time */
|
|
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
|
- $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
|
|
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
|
|
$handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
|
|
/* 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) {
|
|
|
|
// Exposed "Following" filter.
|
|
$handler->display->display_options['filters']['flagged']['id'] = 'flagged';
|
|
- $handler->display->display_options['filters']['flagged']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['filters']['flagged']['table'] = 'flagging';
|
|
$handler->display->display_options['filters']['flagged']['field'] = 'flagged';
|
|
$handler->display->display_options['filters']['flagged']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['filters']['flagged']['ui_name'] = 'Following';
|
|
@@ -309,9 +309,9 @@ function commons_follow_get_followed_content($account = array()) {
|
|
$results = array();
|
|
$flag_ids = commons_follow_get_flag_ids();
|
|
// Get a list of everything that the user is following.
|
|
- $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));
|
|
+ $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));
|
|
foreach ($result as $this_result) {
|
|
- $results[$flag_ids[$this_result->fid]][] = $this_result->content_id;
|
|
+ $results[$flag_ids[$this_result->fid]][] = $this_result->entity_id;
|
|
}
|
|
|
|
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() {
|
|
|
|
// Exported flag: "Groups".
|
|
$flags['commons_follow_group'] = array(
|
|
- 'content_type' => 'node',
|
|
+ 'entity_type' => 'node',
|
|
'title' => 'Groups',
|
|
'global' => 0,
|
|
'types' => array(
|
|
@@ -35,31 +35,25 @@ function commons_follow_group_flag_default_flags() {
|
|
'unflag_message' => 'Not following',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'toggle',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- ),
|
|
'weight' => 0,
|
|
'show_on_form' => 0,
|
|
'access_author' => '',
|
|
- 'show_on_page' => 1,
|
|
- 'show_on_teaser' => 1,
|
|
+ 'show_in_links' => array(
|
|
+ 'full' => TRUE,
|
|
+ 'teaser' => TRUE,
|
|
+ ),
|
|
'show_contextual_link' => FALSE,
|
|
'i18n' => 0,
|
|
'module' => 'commons_follow_group',
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
|
|
// Exported flag: "Commons Follow (Groups - Email)".
|
|
$flags['email_group'] = array(
|
|
- 'content_type' => 'node',
|
|
+ 'entity_type' => 'node',
|
|
'title' => 'Commons Follow (Groups - Email)',
|
|
'global' => 0,
|
|
'types' => array(
|
|
@@ -73,26 +67,16 @@ function commons_follow_group_flag_default_flags() {
|
|
'unflag_message' => '',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'toggle',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- ),
|
|
'weight' => -11,
|
|
'show_on_form' => 0,
|
|
'access_author' => '',
|
|
- 'show_on_page' => 0,
|
|
- 'show_on_teaser' => 0,
|
|
'show_contextual_link' => FALSE,
|
|
'i18n' => 0,
|
|
'module' => 'commons_follow_group',
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
|
|
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 @@
|
|
+<?php
|
|
+/**
|
|
+ * @file
|
|
+ * commons_follow_group.features.user_permission.inc
|
|
+ */
|
|
+
|
|
+/**
|
|
+ * Implements hook_user_default_permissions().
|
|
+ */
|
|
+function commons_follow_group_user_default_permissions() {
|
|
+ $permissions = array();
|
|
+
|
|
+ // Exported permission: 'flag commons_follow_group'.
|
|
+ $permissions['flag commons_follow_group'] = array(
|
|
+ 'name' => 'flag commons_follow_group',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'flag email_group'.
|
|
+ $permissions['flag email_group'] = array(
|
|
+ 'name' => 'flag email_group',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag commons_follow_group'.
|
|
+ $permissions['unflag commons_follow_group'] = array(
|
|
+ 'name' => 'unflag commons_follow_group',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag email_group'.
|
|
+ $permissions['unflag email_group'] = array(
|
|
+ 'name' => 'unflag email_group',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ return $permissions;
|
|
+}
|
|
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
|
|
features[features_api][] = api:2
|
|
features[flag][] = commons_follow_group
|
|
features[flag][] = email_group
|
|
+features[user_permission][] = flag commons_follow_group
|
|
+features[user_permission][] = flag email_group
|
|
+features[user_permission][] = unflag commons_follow_group
|
|
+features[user_permission][] = unflag email_group
|
|
features[variable][] = message_subscribe_og
|
|
|
|
; 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) {
|
|
// Get subscribe flag IDs.
|
|
$flag_ids = commons_follow_get_subscription_flags_ids('node');
|
|
|
|
- $query = db_select('flag_content', 'f');
|
|
+ $query = db_select('flagging', 'f');
|
|
if (!empty($options['range'])) {
|
|
$query->range(0, $options['range']);
|
|
}
|
|
@@ -27,9 +27,9 @@ function commons_follow_group_commons_follow_get_nids($account, $options) {
|
|
$result = $query
|
|
->condition('fid', $flag_ids, 'IN')
|
|
->condition('uid', $account->uid, '=')
|
|
- ->condition('content_type', 'node', '=')
|
|
- ->condition('content_id', $gids['node'], 'IN')
|
|
- ->fields('f',array('content_id'))
|
|
+ ->condition('entity_type', 'node', '=')
|
|
+ ->condition('entity_id', $gids['node'], 'IN')
|
|
+ ->fields('f',array('entity_id'))
|
|
->execute()
|
|
->fetchAll();
|
|
|
|
@@ -39,7 +39,7 @@ function commons_follow_group_commons_follow_get_nids($account, $options) {
|
|
|
|
$nids = array();
|
|
foreach($result as $row) {
|
|
- $nids[] = $row->content_id;
|
|
+ $nids[] = $row->entity_id;
|
|
}
|
|
|
|
// Get the groups' content IDs.
|
|
@@ -135,7 +135,7 @@ function commons_follow_group_og_membership_delete(OgMembership $og_membership)
|
|
}
|
|
}
|
|
|
|
-// function flag($action, $flag_name, $content_id, $account = NULL) {
|
|
+// function flag($action, $flag_name, $entity_id, $account = NULL) {
|
|
|
|
function commons_follow_group_sync_flag_to_group_membership($og_membership) {
|
|
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() {
|
|
|
|
// Exported flag: "Other content you follow".
|
|
$flags['commons_follow_node'] = array(
|
|
- 'content_type' => 'node',
|
|
+ 'entity_type' => 'node',
|
|
'title' => 'Other content',
|
|
'global' => 0,
|
|
'types' => array(),
|
|
@@ -31,26 +31,20 @@ function commons_follow_node_flag_default_flags() {
|
|
'unflag_message' => 'Not following',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'toggle',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- ),
|
|
'weight' => -10,
|
|
'show_on_form' => 0,
|
|
'access_author' => '',
|
|
- 'show_on_page' => 1,
|
|
- 'show_on_teaser' => 1,
|
|
+ 'show_in_links' => array(
|
|
+ 'full' => TRUE,
|
|
+ 'teaser' => TRUE,
|
|
+ ),
|
|
'show_contextual_link' => FALSE,
|
|
'i18n' => 0,
|
|
'module' => 'commons_follow_node',
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
|
|
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 @@
|
|
+<?php
|
|
+/**
|
|
+ * @file
|
|
+ * commons_follow_node.features.user_permission.inc
|
|
+ */
|
|
+
|
|
+/**
|
|
+ * Implements hook_user_default_permissions().
|
|
+ */
|
|
+function commons_follow_node_user_default_permissions() {
|
|
+ $permissions = array();
|
|
+
|
|
+ // Exported permission: 'flag commons_follow_node'.
|
|
+ $permissions['flag commons_follow_node'] = array(
|
|
+ 'name' => 'flag commons_follow_node',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag commons_follow_node'.
|
|
+ $permissions['unflag commons_follow_node'] = array(
|
|
+ 'name' => 'unflag commons_follow_node',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ return $permissions;
|
|
+}
|
|
\ 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
|
|
features[ctools][] = views:views_default:3.0
|
|
features[features_api][] = api:2
|
|
features[flag][] = commons_follow_node
|
|
+features[user_permission][] = flag commons_follow_node
|
|
+features[user_permission][] = unflag commons_follow_node
|
|
features[views_view][] = commons_follow_node
|
|
|
|
features_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) {
|
|
return array();
|
|
}
|
|
|
|
- $query = db_select('flag_content', 'f');
|
|
+ $query = db_select('flagging', 'f');
|
|
|
|
if (!empty($options['range'])) {
|
|
$query->range(0, $options['range']);
|
|
@@ -28,13 +28,13 @@ function commons_follow_node_commons_follow_get_nids($account, $options) {
|
|
$result = $query
|
|
->condition('fid', $flag_ids, 'IN')
|
|
->condition('uid', $account->uid, '=')
|
|
- ->condition('content_type', 'node', '=')
|
|
- ->fields('f',array('content_id'))
|
|
+ ->condition('entity_type', 'node', '=')
|
|
+ ->fields('f',array('entity_id'))
|
|
->execute()
|
|
->fetchAll();
|
|
$nids = array();
|
|
foreach($result as $row) {
|
|
- $nids[] = (integer) $row->content_id;
|
|
+ $nids[] = (integer) $row->entity_id;
|
|
}
|
|
|
|
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() {
|
|
$handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any';
|
|
/* Relationship: Flags: User */
|
|
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
|
|
- $handler->display->display_options['relationships']['uid']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
|
|
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
|
|
$handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
|
|
/* Field: Content: Title */
|
|
@@ -94,14 +94,14 @@ function commons_follow_node_views_default_views() {
|
|
$handler->display->display_options['fields']['title_field']['link_to_entity'] = 1;
|
|
/* Field: Flags: Flag link */
|
|
$handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
|
|
- $handler->display->display_options['fields']['ops_1']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['fields']['ops_1']['table'] = 'flagging';
|
|
$handler->display->display_options['fields']['ops_1']['field'] = 'ops';
|
|
$handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1';
|
|
$handler->display->display_options['fields']['ops_1']['label'] = 'Send email?';
|
|
$handler->display->display_options['fields']['ops_1']['element_label_colon'] = FALSE;
|
|
/* Field: Flags: Flag link */
|
|
$handler->display->display_options['fields']['ops']['id'] = 'ops';
|
|
- $handler->display->display_options['fields']['ops']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['fields']['ops']['table'] = 'flagging';
|
|
$handler->display->display_options['fields']['ops']['field'] = 'ops';
|
|
$handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['fields']['ops']['label'] = '';
|
|
@@ -109,7 +109,7 @@ function commons_follow_node_views_default_views() {
|
|
$handler->display->display_options['fields']['ops']['link_type'] = 'toggle';
|
|
/* Sort criterion: Flags: Flagged time */
|
|
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
|
- $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
|
|
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
|
|
$handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
|
|
$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() {
|
|
|
|
// Exported flag: "Topics you follow".
|
|
$flags['commons_follow_term'] = array(
|
|
- 'content_type' => 'taxonomy_term',
|
|
+ 'entity_type' => 'taxonomy_term',
|
|
'title' => 'Topics',
|
|
'global' => 0,
|
|
'types' => array(
|
|
@@ -33,23 +33,19 @@ function commons_follow_term_flag_default_flags() {
|
|
'unflag_message' => 'Not following',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'toggle',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- ),
|
|
'weight' => -8,
|
|
- 'show_on_entity' => 1,
|
|
+ 'show_in_links' => array(
|
|
+ 'diff_standard' => TRUE,
|
|
+ 'full' => TRUE,
|
|
+ 'token' => TRUE,
|
|
+ ),
|
|
'show_on_form' => 0,
|
|
'access_author' => '',
|
|
'module' => 'commons_follow_term',
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
|
|
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 @@
|
|
+<?php
|
|
+/**
|
|
+ * @file
|
|
+ * commons_follow_term.features.user_permission.inc
|
|
+ */
|
|
+
|
|
+/**
|
|
+ * Implements hook_user_default_permissions().
|
|
+ */
|
|
+function commons_follow_term_user_default_permissions() {
|
|
+ $permissions = array();
|
|
+
|
|
+ // Exported permission: 'flag commons_follow_term'.
|
|
+ $permissions['flag commons_follow_term'] = array(
|
|
+ 'name' => 'flag commons_follow_term',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag commons_follow_term'.
|
|
+ $permissions['unflag commons_follow_term'] = array(
|
|
+ 'name' => 'unflag commons_follow_term',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ return $permissions;
|
|
+}
|
|
\ 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
|
|
features[ctools][] = views:views_default:3.0
|
|
features[features_api][] = api:2
|
|
features[flag][] = commons_follow_term
|
|
+features[user_permission][] = flag commons_follow_term
|
|
+features[user_permission][] = unflag commons_follow_term
|
|
features[views_view][] = commons_follow_taxonomy_term
|
|
|
|
features_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) {
|
|
}
|
|
|
|
// Get user's flagged terms.
|
|
- $query = db_select('flag_content', 'f');
|
|
+ $query = db_select('flagging', 'f');
|
|
$result = $query
|
|
->condition('fid', $flag_ids, 'IN')
|
|
->condition('uid', $account->uid, '=')
|
|
- ->condition('content_type', 'taxonomy_term', '=')
|
|
- ->fields('f',array('content_id'))
|
|
+ ->condition('entity_type', 'taxonomy_term', '=')
|
|
+ ->fields('f',array('entity_id'))
|
|
->execute()
|
|
->fetchAll();
|
|
|
|
@@ -35,7 +35,7 @@ function commons_follow_term_commons_follow_get_nids($account, $options) {
|
|
|
|
$tids = array();
|
|
foreach($result as $row) {
|
|
- $tids[] = (integer) $row->content_id;
|
|
+ $tids[] = (integer) $row->entity_id;
|
|
}
|
|
|
|
// 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() {
|
|
$handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any';
|
|
/* Relationship: Flags: User */
|
|
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
|
|
- $handler->display->display_options['relationships']['uid']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
|
|
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
|
|
$handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
|
|
/* Field: Taxonomy term: Name */
|
|
@@ -97,13 +97,13 @@ function commons_follow_term_views_default_views() {
|
|
$handler->display->display_options['fields']['name']['link_to_taxonomy'] = TRUE;
|
|
/* Field: Flags: Flag link */
|
|
$handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
|
|
- $handler->display->display_options['fields']['ops_1']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['fields']['ops_1']['table'] = 'flagging';
|
|
$handler->display->display_options['fields']['ops_1']['field'] = 'ops';
|
|
$handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1';
|
|
$handler->display->display_options['fields']['ops_1']['label'] = 'Send email?';
|
|
/* Field: Flags: Flag link */
|
|
$handler->display->display_options['fields']['ops']['id'] = 'ops';
|
|
- $handler->display->display_options['fields']['ops']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['fields']['ops']['table'] = 'flagging';
|
|
$handler->display->display_options['fields']['ops']['field'] = 'ops';
|
|
$handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';
|
|
$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() {
|
|
|
|
// Exported flag: "People".
|
|
$flags['commons_follow_user'] = array(
|
|
- 'content_type' => 'user',
|
|
+ 'entity_type' => 'user',
|
|
'title' => 'People',
|
|
'global' => 0,
|
|
'types' => array(),
|
|
@@ -40,14 +40,6 @@ function commons_follow_user_flag_default_flags() {
|
|
'unflag_message' => 'Not following',
|
|
'unflag_denied_text' => '',
|
|
'link_type' => 'toggle',
|
|
- 'roles' => array(
|
|
- 'flag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- 'unflag' => array(
|
|
- 0 => 2,
|
|
- ),
|
|
- ),
|
|
'weight' => -13,
|
|
'show_on_form' => 0,
|
|
'access_author' => '',
|
|
@@ -57,7 +49,7 @@ function commons_follow_user_flag_default_flags() {
|
|
'locked' => array(
|
|
0 => 'name',
|
|
),
|
|
- 'api_version' => 2,
|
|
+ 'api_version' => 3,
|
|
);
|
|
|
|
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 @@
|
|
+<?php
|
|
+/**
|
|
+ * @file
|
|
+ * commons_follow_user.features.user_permission.inc
|
|
+ */
|
|
+
|
|
+/**
|
|
+ * Implements hook_user_default_permissions().
|
|
+ */
|
|
+function commons_follow_user_user_default_permissions() {
|
|
+ $permissions = array();
|
|
+
|
|
+ // Exported permission: 'flag commons_follow_user'.
|
|
+ $permissions['flag commons_follow_user'] = array(
|
|
+ 'name' => 'flag commons_follow_user',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ // Exported permission: 'unflag commons_follow_user'.
|
|
+ $permissions['unflag commons_follow_user'] = array(
|
|
+ 'name' => 'unflag commons_follow_user',
|
|
+ 'roles' => array(
|
|
+ 'authenticated user' => 'authenticated user',
|
|
+ ),
|
|
+ 'module' => 'flag',
|
|
+ );
|
|
+
|
|
+ return $permissions;
|
|
+}
|
|
\ 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
|
|
features[field_instance][] = message-commons_follow_user_user_followed-field_target_users
|
|
features[flag][] = commons_follow_user
|
|
features[message_type][] = commons_follow_user_user_followed
|
|
+features[user_permission][] = flag commons_follow_user
|
|
+features[user_permission][] = unflag commons_follow_user
|
|
features[variable][] = field_bundle_settings_message__commons_follow_user_user_followed
|
|
features[views_view][] = commons_follow_user
|
|
features[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) {
|
|
}
|
|
|
|
// Get flagged user IDs.
|
|
- $query = db_select('flag_content', 'f');
|
|
+ $query = db_select('flagging', 'f');
|
|
$result = $query
|
|
->condition('fid', $flag_ids, 'IN')
|
|
->condition('uid', $account->uid, '=')
|
|
- ->condition('content_type', 'user', '=')
|
|
- ->fields('f',array('content_id'))
|
|
+ ->condition('entity_type', 'user', '=')
|
|
+ ->fields('f',array('entity_id'))
|
|
->execute()
|
|
->fetchAll();
|
|
|
|
@@ -37,7 +37,7 @@ function commons_follow_user_commons_follow_get_nids($account, $options) {
|
|
|
|
$uids = array();
|
|
foreach($result as $row) {
|
|
- $uids[] = (integer) $row->content_id;
|
|
+ $uids[] = (integer) $row->entity_id;
|
|
}
|
|
|
|
// Get the user's node IDs.
|
|
@@ -63,12 +63,12 @@ function commons_follow_user_commons_follow_get_nids($account, $options) {
|
|
}
|
|
|
|
/**
|
|
- * Implements hook_flag().
|
|
+ * Implements hook_flag_flag().
|
|
*/
|
|
-function commons_follow_user_flag($op, $flag, $content_id, $account, $fcid) {
|
|
+function commons_follow_user_flag_flag($flag, $entity_id, $account, $fcid) {
|
|
// Display an activity stream message when a user follows another user.
|
|
- if (module_exists('commons_activity_streams') && $flag->name == 'commons_follow_user' && $op == 'flag') {
|
|
- $followed_user = user_load($content_id);
|
|
+ if (module_exists('commons_activity_streams') && $flag->name == 'commons_follow_user') {
|
|
+ $followed_user = user_load($entity_id);
|
|
// Don't generate a message for flagging blocked users.
|
|
if (!$followed_user->status) {
|
|
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() {
|
|
$handler->display->display_options['relationships']['flag_content_rel_1']['user_scope'] = 'any';
|
|
/* Relationship: Flags: User */
|
|
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
|
|
- $handler->display->display_options['relationships']['uid']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
|
|
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
|
|
$handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
|
|
/* Field: User: Name */
|
|
@@ -96,20 +96,20 @@ function commons_follow_user_views_default_views() {
|
|
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
|
|
/* Field: Flags: Flag link */
|
|
$handler->display->display_options['fields']['ops_1']['id'] = 'ops_1';
|
|
- $handler->display->display_options['fields']['ops_1']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['fields']['ops_1']['table'] = 'flagging';
|
|
$handler->display->display_options['fields']['ops_1']['field'] = 'ops';
|
|
$handler->display->display_options['fields']['ops_1']['relationship'] = 'flag_content_rel_1';
|
|
$handler->display->display_options['fields']['ops_1']['label'] = 'Send email?';
|
|
/* Field: Flags: Flag link */
|
|
$handler->display->display_options['fields']['ops']['id'] = 'ops';
|
|
- $handler->display->display_options['fields']['ops']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['fields']['ops']['table'] = 'flagging';
|
|
$handler->display->display_options['fields']['ops']['field'] = 'ops';
|
|
$handler->display->display_options['fields']['ops']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['fields']['ops']['label'] = '';
|
|
$handler->display->display_options['fields']['ops']['element_label_colon'] = FALSE;
|
|
/* Sort criterion: Flags: Flagged time */
|
|
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
|
- $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
|
|
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
|
|
$handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
|
|
@@ -206,7 +206,7 @@ function commons_follow_user_views_default_views() {
|
|
$handler->display->display_options['relationships']['flag_content_rel']['user_scope'] = 'any';
|
|
/* Relationship: Flags: User */
|
|
$handler->display->display_options['relationships']['uid']['id'] = 'uid';
|
|
- $handler->display->display_options['relationships']['uid']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['relationships']['uid']['table'] = 'flagging';
|
|
$handler->display->display_options['relationships']['uid']['field'] = 'uid';
|
|
$handler->display->display_options['relationships']['uid']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['relationships']['uid']['required'] = TRUE;
|
|
@@ -233,13 +233,13 @@ function commons_follow_user_views_default_views() {
|
|
$handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
|
|
/* Sort criterion: Flags: Flagged time */
|
|
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
|
- $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
|
|
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
|
|
$handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
|
|
/* Contextual filter: Flags: Content ID */
|
|
$handler->display->display_options['arguments']['content_id']['id'] = 'content_id';
|
|
- $handler->display->display_options['arguments']['content_id']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['arguments']['content_id']['table'] = 'flagging';
|
|
$handler->display->display_options['arguments']['content_id']['field'] = 'content_id';
|
|
$handler->display->display_options['arguments']['content_id']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['arguments']['content_id']['default_action'] = 'default';
|
|
@@ -381,13 +381,13 @@ function commons_follow_user_views_default_views() {
|
|
$handler->display->display_options['fields']['name']['element_default_classes'] = FALSE;
|
|
/* Sort criterion: Flags: Flagged time */
|
|
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
|
|
- $handler->display->display_options['sorts']['timestamp']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['sorts']['timestamp']['table'] = 'flagging';
|
|
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
|
|
$handler->display->display_options['sorts']['timestamp']['relationship'] = 'flag_content_rel';
|
|
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
|
|
/* Contextual filter: Flags: User uid */
|
|
$handler->display->display_options['arguments']['uid']['id'] = 'uid';
|
|
- $handler->display->display_options['arguments']['uid']['table'] = 'flag_content';
|
|
+ $handler->display->display_options['arguments']['uid']['table'] = 'flagging';
|
|
$handler->display->display_options['arguments']['uid']['field'] = 'uid';
|
|
$handler->display->display_options['arguments']['uid']['relationship'] = 'flag_content_rel';
|
|
$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 @@
|
|
* )
|
|
* - $mode: Display mode.
|
|
* - $just_voted: Indicator whether the user has just voted (boolean).
|
|
- * - $content_type: "node" or "comment".
|
|
- * - $content_id: Node or comment id.
|
|
+ * - $entity_type: "node" or "comment".
|
|
+ * - $entity_id: Node or comment id.
|
|
* - $buttons: Array with themed buttons (built in preprocess function).
|
|
* - $info: String with user readable information (built in preprocess function).
|
|
*/
|
|
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) {
|
|
function commons_like_theme() {
|
|
return array(
|
|
'rate_template_commons_like' => array(
|
|
- 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'content_type' => NULL, 'content_id' => NULL, 'display_options' => NULL),
|
|
+ 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'entity_type' => NULL, 'entity_id' => NULL, 'display_options' => NULL),
|
|
'template' => 'commons-like',
|
|
),
|
|
);
|
|
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';
|
|
function commons_q_a_theme() {
|
|
return array(
|
|
'rate_template_commons_thumbs_up_down' => array(
|
|
- 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'content_type' => NULL, 'content_id' => NULL, 'display_options' => NULL),
|
|
+ 'variables' => array('links' => NULL, 'results' => NULL, 'mode' => NULL, 'just_voted' => FALSE, 'entity_type' => NULL, 'entity_id' => NULL, 'display_options' => NULL),
|
|
'template' => 'commons-thumbs-up-down',
|
|
),
|
|
);
|
|
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 @@
|
|
*/
|
|
|
|
/**
|
|
- * Implements hook_flag().
|
|
+ * Implements hook_flag_flag().
|
|
*
|
|
* Trigger radioactivity incidents when a user follows a node or group.
|
|
*/
|
|
-function commons_radioactivity_flag($op, $flag, $content_id, $account, $fcid) {
|
|
+function commons_radioactivity_flag_flag($flag, $entity_id, $account, $fcid) {
|
|
if (in_array($flag->name, array('commons_follow_node', 'commons_follow_group'))) {
|
|
- $node = node_load($content_id);
|
|
+ $node = node_load($entity_id);
|
|
|
|
- if ($op == 'flag') {
|
|
- // A user following their own node should not increase radioactivity.
|
|
- if ($node->uid != $account->uid) {
|
|
- commons_radioactivity_incident_node($node, COMMONS_RADIOACTIVITY_FLAG_NODE);
|
|
- }
|
|
+ // A user following their own node shouldn't add to its radioactivity.
|
|
+ if ($node->uid == $account->uid) {
|
|
+ return;
|
|
}
|
|
|
|
- if ($op == 'unflag') {
|
|
- // A user unfollowing their own node should not decrease radioactivity.
|
|
- if ($node->uid != $account->uid) {
|
|
- commons_radioactivity_incident_node($node, -1 * COMMONS_RADIOACTIVITY_FLAG_NODE);
|
|
- }
|
|
- }
|
|
+ commons_radioactivity_incident_node($node, COMMONS_RADIOACTIVITY_FLAG_NODE);
|
|
}
|
|
}
|
|
+
|
|
+/**
|
|
+ * Implements hook_flag_unflag().
|
|
+ *
|
|
+ * Trigger radioactivity incidents when a user follows a node or group.
|
|
+ */
|
|
+function commons_radioactivity_flag_unflag($flag, $entity_id, $account, $flagging) {
|
|
+ if (in_array($flag->name, array('commons_follow_node', 'commons_follow_group'))) {
|
|
+ $node = node_load($entity_id);
|
|
+
|
|
+ // A user unfollowing their own node shouldn't add to its radioactivity.
|
|
+ if ($node->uid == $account->uid) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ commons_radioactivity_incident_node($node, -1 * COMMONS_RADIOACTIVITY_FLAG_NODE);
|
|
+ }
|
|
+}
|
|
\ 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_
|
|
$out_results = array();
|
|
if ($flagged && $flag = flag_get_flag('commons_follow_user')) {
|
|
// Get the count of flagged users for a particular account.
|
|
- $fl_results = db_select('flag_content', 'f')
|
|
- ->fields('f', array('content_id', 'uid'))
|
|
- ->condition('f.content_type', 'user', '=')
|
|
+ $fl_results = db_select('flagging', 'f')
|
|
+ ->fields('f', array('entity_id', 'uid'))
|
|
+ ->condition('f.entity_type','user','=')
|
|
->condition('f.uid', $user->uid, '=')
|
|
->condition('f.fid', $flag->fid, '=')
|
|
->extend('PagerDefault')->limit($limit)
|
|
@@ -96,7 +96,7 @@ function commons_search_solr_user_apachesolr_search_page_alter(&$build, $search_
|
|
->addMetaData('flagged', $flagged)
|
|
->execute();
|
|
while ($record = $fl_results->fetchAssoc()) {
|
|
- $out_results[] = user_view(user_load($record['content_id']), 'search_results');
|
|
+ $out_results[] = user_view(user_load($record['entity_id']), 'search_results');
|
|
}
|
|
$build['pager'] = array('#theme' => 'pager');
|
|
}
|
|
--
|
|
1.8.4.2
|
|
|