1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Update the notifications based on all friends and access collections |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
// loop through all users checking collections and notifications |
7
|
|
|
global $ENTITY_CACHE, $CONFIG; |
8
|
|
|
$NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal(); |
9
|
|
|
$users = mysql_query("SELECT guid, username FROM {$CONFIG->dbprefix}users_entity |
10
|
|
|
WHERE username != ''"); |
11
|
|
|
while ($user = mysql_fetch_object($users)) { |
12
|
|
|
$ENTITY_CACHE = array(); |
13
|
|
|
|
14
|
|
|
$user = get_entity($user->guid); |
15
|
|
|
foreach ($NOTIFICATION_HANDLERS as $method => $foo) { |
16
|
|
|
$notify = "notify$method"; |
17
|
|
|
$metaname = "collections_notifications_preferences_$method"; |
18
|
|
|
$collections_preferences = $user->$metaname; |
19
|
|
|
if (!$collections_preferences) { |
20
|
|
|
continue; |
21
|
|
|
} |
22
|
|
|
if (!is_array($collections_preferences)) { |
23
|
|
|
$collections_preferences = array($collections_preferences); |
24
|
|
|
} |
25
|
|
|
foreach ($collections_preferences as $collection_id) { |
26
|
|
|
// check the all friends notifications |
27
|
|
|
if ($collection_id == -1) { |
28
|
|
|
$options = array( |
29
|
|
|
'relationship' => 'friend', |
30
|
|
|
'relationship_guid' => $user->guid, |
31
|
|
|
'limit' => 0 |
32
|
|
|
); |
33
|
|
|
$friends = elgg_get_entities_from_relationship($options); |
34
|
|
|
foreach ($friends as $friend) { |
35
|
|
|
if (!check_entity_relationship($user->guid, $notify, $friend->guid)) { |
36
|
|
|
add_entity_relationship($user->guid, $notify, $friend->guid); |
37
|
|
|
} |
38
|
|
|
} |
39
|
|
|
} else { |
40
|
|
|
$members = get_members_of_access_collection($collection_id, TRUE); |
41
|
|
|
foreach ($members as $member) { |
42
|
|
|
if (!check_entity_relationship($user->guid, $notify, $members)) { |
|
|
|
|
43
|
|
|
add_entity_relationship($user->guid, $notify, $member); |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: