-
Notifications
You must be signed in to change notification settings - Fork 0
/
commons_groups.install
118 lines (108 loc) · 3 KB
/
commons_groups.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* Don't display group node author's avatar on the group node.
*/
function commons_groups_update_3100() {
features_revert(array('commons_groups' => array('variable')));
return array();
}
/**
* Grant users the "group organizer" role after she's created a group.
*/
function commons_groups_update_3101() {
// We've updated the og_group_manager_default_rids_node_group variable.
features_revert(array('commons_groups' => array('variable')));
return array();
}
/**
* Ensure that the anonymous users is not listed as a group member,
* per http://drupal.org/node/1910874.
*/
function commons_groups_update_3102() {
$delete = db_delete('og_users_roles')
->condition('uid', 0, '=')
->execute();
return array();
}
/**
* Grant authenticated users permission to create group nodes
* per http://drupal.org/node/1936714.
*/
function commons_groups_update_3103() {
features_revert(array('commons_groups' => array('user_permission')));
return array();
}
/**
* Grant authenticated users permission to create group nodes
* per http://drupal.org/node/1936714.
*/
function commons_groups_update_3104() {
features_revert(array('commons_groups' => array('field_base', 'field_instance')));
return array();
}
/**
* Change the OG Organizer role back to Administrator member.
* See http://drupal.org/node/1940150 for more information.
*/
function commons_groups_update_3105() {
$result = db_update('og_role')
->fields(array('name' => 'administrator member'))
->condition('rid', 3, '=')
->execute();
return array();
}
/**
* Update contributor view to show the titles per the interactive prototype.
* (http://drupal.org/node/1821808).
*/
function commons_groups_update_3106() {
$revert = array(
'commons_groups' => array('views_view'),
);
features_revert($revert);
return array();
}
/**
* Give group owners the organizer role for their own group
*/
function commons_groups_update_3107() {
// Ensure that the group creator is also listed as an organizer.
$group_nodes = db_select('node', 'n')
->fields('n', array('nid', 'uid'))
->condition('n.type', 'group','=')
->execute()
->fetchAll();
$organizer_role = db_select('og_role', 'o')
->fields('o', array('rid'))
->condition('o.group_bundle', 'group')
->condition('o.name', 'administrator member')
->execute()
->fetchField();
foreach($group_nodes as $record) {
if (!empty($organizer_role)) {
og_role_grant('node', $record->nid, $record->uid, $organizer_role);
}
}
return array();
}
/**
* Update the og_group_ref and group privacy fields per
* http://drupal.org/node/1961296.
*/
function commons_groups_update_3108() {
$revert = array(
'commons_groups' => array('field_instance', 'views_view'),
);
features_revert($revert);
return array();
}
/**
* Update the group_group field per http://drupal.org/node/1948224.
*/
function commons_groups_update_3109() {
$revert = array(
'commons_groups' => array('field_base', 'field_instance'),
);
features_revert($revert);
return array();
}