Allow on/off switch for all activity notifications.
Default behaviour was/is to do all actitivity notifications supported by plugin. Configure is in the config file by passing array with keyed boolean values like: addPlugin('Activity', array( 'StartFollowUser' => true, 'StopFollowUser' => false, 'JoinGroup' => true, 'LeaveGroup' => true, 'StartLike' => true, 'StopLike' => false));
This commit is contained in:
parent
82db24831b
commit
7f99ce0580
@ -49,6 +49,14 @@ class ActivityPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
const VERSION = '0.1';
|
const VERSION = '0.1';
|
||||||
|
|
||||||
|
// Flags to switch off certain activity notices
|
||||||
|
public $StartFollowUser = true;
|
||||||
|
public $StopFollowUser = true;
|
||||||
|
public $JoinGroup = true;
|
||||||
|
public $LeaveGroup = true;
|
||||||
|
public $StartLike = true;
|
||||||
|
public $StopLike = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database schema setup
|
* Database schema setup
|
||||||
*
|
*
|
||||||
@ -91,6 +99,8 @@ class ActivityPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndSubscribe($subscriber, $other)
|
function onEndSubscribe($subscriber, $other)
|
||||||
{
|
{
|
||||||
|
// Only do this if config is enabled
|
||||||
|
if(!$this->StartFollowUser) return true;
|
||||||
$user = User::staticGet('id', $subscriber->id);
|
$user = User::staticGet('id', $subscriber->id);
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$rendered = sprintf(_m('<em>Started following <a href="%s">%s</a></em>.'),
|
$rendered = sprintf(_m('<em>Started following <a href="%s">%s</a></em>.'),
|
||||||
@ -114,6 +124,8 @@ class ActivityPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndUnsubscribe($subscriber, $other)
|
function onEndUnsubscribe($subscriber, $other)
|
||||||
{
|
{
|
||||||
|
// Only do this if config is enabled
|
||||||
|
if(!$this->StopFollowUser) return true;
|
||||||
$user = User::staticGet('id', $subscriber->id);
|
$user = User::staticGet('id', $subscriber->id);
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$rendered = sprintf(_m('<em>Stopped following <a href="%s">%s</a></em>.'),
|
$rendered = sprintf(_m('<em>Stopped following <a href="%s">%s</a></em>.'),
|
||||||
@ -137,6 +149,8 @@ class ActivityPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndFavorNotice($profile, $notice)
|
function onEndFavorNotice($profile, $notice)
|
||||||
{
|
{
|
||||||
|
// Only do this if config is enabled
|
||||||
|
if(!$this->StartLike) return true;
|
||||||
$user = User::staticGet('id', $profile->id);
|
$user = User::staticGet('id', $profile->id);
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
@ -162,6 +176,8 @@ class ActivityPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndDisfavorNotice($profile, $notice)
|
function onEndDisfavorNotice($profile, $notice)
|
||||||
{
|
{
|
||||||
|
// Only do this if config is enabled
|
||||||
|
if(!$this->StopLike) return true;
|
||||||
$user = User::staticGet('id', $profile->id);
|
$user = User::staticGet('id', $profile->id);
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
@ -187,6 +203,8 @@ class ActivityPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndJoinGroup($group, $user)
|
function onEndJoinGroup($group, $user)
|
||||||
{
|
{
|
||||||
|
// Only do this if config is enabled
|
||||||
|
if(!$this->JoinGroup) return true;
|
||||||
$rendered = sprintf(_m('<em>Joined the group "<a href="%s">%s</a>"</em>.'),
|
$rendered = sprintf(_m('<em>Joined the group "<a href="%s">%s</a>"</em>.'),
|
||||||
$group->homeUrl(),
|
$group->homeUrl(),
|
||||||
$group->getBestName());
|
$group->getBestName());
|
||||||
@ -207,6 +225,8 @@ class ActivityPlugin extends Plugin
|
|||||||
|
|
||||||
function onEndLeaveGroup($group, $user)
|
function onEndLeaveGroup($group, $user)
|
||||||
{
|
{
|
||||||
|
// Only do this if config is enabled
|
||||||
|
if(!$this->LeaveGroup) return true;
|
||||||
$rendered = sprintf(_m('<em>Left the group "<a href="%s">%s</a>"</em>.'),
|
$rendered = sprintf(_m('<em>Left the group "<a href="%s">%s</a>"</em>.'),
|
||||||
$group->homeUrl(),
|
$group->homeUrl(),
|
||||||
$group->getBestName());
|
$group->getBestName());
|
||||||
|
Loading…
Reference in New Issue
Block a user