PHP Class TrollManagementPlugin, addons

TODO: Verify that activity feed works properly with/without troll content. Added new event to core to get it working. Add additional troll management options: - Disemvoweler - Troll Annoyances (slow page loading times, random over capacity errors, form submission failures, etc). - Trolls' posts don't bump the thread. - Admin page that shows all trolls and their punishments - Sink troll comments by default - Custom per-troll punishments - Speed optimizations (add troll state to user attributes, and return from troll specific functions quickly when possible).
Author: Mark O'Sullivan ([email protected])
Inheritance: extends Gdn_Plugin
Datei anzeigen Open project: vanilla/addons Class Usage Examples

Public Properties

Property Type Description
$trolls

Public Methods

Method Description
activityModel_afterGet_handler ( ActivityModel $sender ) Attach to the Activity model and remove all records by trolls (unless the current user is a troll)
base_beforeCommentBody_handler ( type $sender ) Identify troll comments for moderators.
base_beforeDiscussionMeta_handler ( type $sender ) Identify troll discussions for moderators.
base_render_before ( Gdn_Controller $sender ) Fingerprint the user.
commentModel_afterGet_handler ( CommentModel $sender ) Attach to the Comment model and remove all records by trolls (unless the current user is a troll)
commentModel_beforeUpdateCommentCount_handler ( CommentModel $sender ) Do not let troll comments bump discussions.
discussionModel_afterAddColumns_handler ( DiscussionModel $sender ) Attach to the Discussion model and remove all records by trolls (unless the current user is a troll)
discussionModel_beforeSaveDiscussion_handler ( DiscussionModel $sender ) Auto-sink troll discussions.
getTrolls ( ) : array Get list of current troll user IDs.
profileController_beforeProfileOptions_handler ( ProfileController $sender ) Add toggle option to add/remove troll status from users
profileController_beforeUserInfo_handler ( ProfileController $sender ) If user has been marked as troll, write a message at the top of their profile for moderators to read.
profileController_render_before ( ProfileController $sender ) Display shared accounts on the user profiles for moderators.
profileController_userLoaded_handler ( ProfileController $sender ) Hide counters on profile of trolls unless viewer is a moderator.
setTrolls ( array $trolls ) Save list of current troll IDs to config.
setup ( ) Setup: on enable
structure ( ) Database structure: on update
userController_markTroll_create ( UserController $sender, $userID, $troll = true ) Validates the current user's permissions & transientkey and then marks a user as a troll.

Private Methods

Method Description
_cleanDataSet ( $sender, $dataEventArgument ) Look in the sender event arguments for a dataset to clean of troll content.
_showAdmin ( Gdn_Controller $sender, string $eventArgumentName, string $style = 'message' ) : void Display troll warning on comments and discussions for moderators to see.

Method Details

activityModel_afterGet_handler() public method

Attach to the Activity model and remove all records by trolls (unless the current user is a troll)
public activityModel_afterGet_handler ( ActivityModel $sender )
$sender ActivityModel

base_beforeCommentBody_handler() public method

Identify troll comments for moderators.
public base_beforeCommentBody_handler ( type $sender )
$sender type

base_beforeDiscussionMeta_handler() public method

Identify troll discussions for moderators.
public base_beforeDiscussionMeta_handler ( type $sender )
$sender type

base_render_before() public method

Fingerprint the user.
public base_render_before ( Gdn_Controller $sender )
$sender Gdn_Controller

commentModel_afterGet_handler() public method

Attach to the Comment model and remove all records by trolls (unless the current user is a troll)
public commentModel_afterGet_handler ( CommentModel $sender )
$sender CommentModel

commentModel_beforeUpdateCommentCount_handler() public method

Do not let troll comments bump discussions.
public commentModel_beforeUpdateCommentCount_handler ( CommentModel $sender )
$sender CommentModel

discussionModel_afterAddColumns_handler() public method

Attach to the Discussion model and remove all records by trolls (unless the current user is a troll)
public discussionModel_afterAddColumns_handler ( DiscussionModel $sender )
$sender DiscussionModel

discussionModel_beforeSaveDiscussion_handler() public method

Auto-sink troll discussions.
public discussionModel_beforeSaveDiscussion_handler ( DiscussionModel $sender )
$sender DiscussionModel

getTrolls() public static method

Get list of current troll user IDs.
public static getTrolls ( ) : array
return array

profileController_beforeProfileOptions_handler() public method

Add toggle option to add/remove troll status from users
public profileController_beforeProfileOptions_handler ( ProfileController $sender )
$sender ProfileController

profileController_beforeUserInfo_handler() public method

If user has been marked as troll, write a message at the top of their profile for moderators to read.
public profileController_beforeUserInfo_handler ( ProfileController $sender )
$sender ProfileController

profileController_render_before() public method

Display shared accounts on the user profiles for moderators.
public profileController_render_before ( ProfileController $sender )
$sender ProfileController

profileController_userLoaded_handler() public method

Hide counters on profile of trolls unless viewer is a moderator.
public profileController_userLoaded_handler ( ProfileController $sender )
$sender ProfileController

setTrolls() public static method

Save list of current troll IDs to config.
public static setTrolls ( array $trolls )
$trolls array

setup() public method

Setup: on enable
public setup ( )

structure() public method

Database structure: on update
public structure ( )

userController_markTroll_create() public method

Validates the current user's permissions & transientkey and then marks a user as a troll.
public userController_markTroll_create ( UserController $sender, $userID, $troll = true )
$sender UserController

Property Details

$trolls static_oe public_oe property

static public $trolls