Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -142,8 +142,13 @@ class _Notification
|
||||
*/
|
||||
public static function saveMatrix( \IPS\Member $member, array $values )
|
||||
{
|
||||
/* Remove the current preferences */
|
||||
\IPS\Db::i()->delete( 'core_notification_preferences', array( 'member_id=?', $member->member_id ) );
|
||||
|
||||
/* Get the default configuration so we know what is forced enabled by the admin */
|
||||
$defaults = static::defaultConfiguration();
|
||||
|
||||
/* Now loop over the notifications and set preferences */
|
||||
$insert = array();
|
||||
foreach ( $values['notifications'] as $k => $v )
|
||||
{
|
||||
@@ -152,10 +157,18 @@ class _Notification
|
||||
{
|
||||
$pref[] = 'inline';
|
||||
}
|
||||
else if( !$defaults[ $k ]['editable'] AND in_array( 'inline', $defaults[ $k ]['default'] ) )
|
||||
{
|
||||
$pref[] = 'inline';
|
||||
}
|
||||
if ( $v['member_notifications_email'] )
|
||||
{
|
||||
$pref[] = 'email';
|
||||
}
|
||||
else if( !$defaults[ $k ]['editable'] AND in_array( 'email', $defaults[ $k ]['default'] ) )
|
||||
{
|
||||
$pref[] = 'email';
|
||||
}
|
||||
|
||||
$insert[] = array(
|
||||
'member_id' => $member->member_id,
|
||||
@@ -163,7 +176,7 @@ class _Notification
|
||||
'preference' => implode( ',', $pref )
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
\IPS\Db::i()->insert( 'core_notification_preferences', $insert );
|
||||
}
|
||||
|
||||
@@ -321,6 +334,8 @@ class _Notification
|
||||
|
||||
$unsubscribeBlurb = NULL;
|
||||
$unfollowLink = NULL;
|
||||
$okToEmail = TRUE;
|
||||
|
||||
if ( $info )
|
||||
{
|
||||
if ( !isset( $thingsBeingFollowed[ $info['follow_app'] ][ $info['follow_area'] ][ $info['follow_rel_id'] ] ) )
|
||||
@@ -351,15 +366,23 @@ class _Notification
|
||||
}
|
||||
|
||||
$unfollowLink = (string) \IPS\Http\Url::internal( "app=core&module=system§ion=notifications&do=follow&follow_app={$info['follow_app']}&follow_area={$info['follow_area']}&follow_id={$info['follow_rel_id']}", 'front' );
|
||||
|
||||
if ( $member->members_bitoptions['email_notifications_once'] and $member->last_activity < $info['follow_notify_sent'] )
|
||||
{
|
||||
$okToEmail = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
$emails[ $language ]->buildUnsubscribe( $this->unsubscribeType, $this->key );
|
||||
$emailRecipients[ $language ][ $member->email ] = array(
|
||||
'recipient_name' => $member->name,
|
||||
'recipient_photo' => (string) $member->photo,
|
||||
'unsubscribe_blurb' => $unsubscribeBlurb,
|
||||
'unfollow_link' => $unfollowLink
|
||||
);
|
||||
if ( $okToEmail )
|
||||
{
|
||||
$emails[ $language ]->buildUnsubscribe( $this->unsubscribeType, $this->key );
|
||||
$emailRecipients[ $language ][ $member->email ] = array(
|
||||
'recipient_name' => $member->name,
|
||||
'recipient_photo' => (string) $member->photo,
|
||||
'unsubscribe_blurb' => $unsubscribeBlurb,
|
||||
'unfollow_link' => $unfollowLink
|
||||
);
|
||||
}
|
||||
|
||||
$sentTo[ $member->member_id ] = $member->member_id;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user