Jump to content

Community

Developer Documentation

Delayed Deletes

All Content Items, Comments, and Reviews that implement the \IPS\Content\Hideable interface will automatically work with the Delayed Deletes system. The information below is just for reference only.

The \IPS\core\DeletionLog class is an Active Record class that handles content queued for deletion.

namespace IPS\core;

/**
 * Deletion Log Model
 */
class _DeletionLog extends \IPS\Patterns\ActiveRecord
{
	/**
	 * @brief	Database Table
	 */
	public static $databaseTable = 'core_deletion_log';
	
	/**
	 * @brief	Database Prefix
	 */
	public static $databasePrefix = 'dellog_';
		
	/**
	 * @brief	[ActiveRecord] ID Database Column
	 */
	public static $databaseColumnId = 'id';
	
	/**
	 * Set Default Values
	 *
	 * @return	void
	 */
	public function setDefaultValues()
	
	/**
	 * Set deleted date
	 *
	 * @param	\IPS\DateTime	A DateTime object
	 * @return	void
	 */
	public function set_deleted_date( \IPS\DateTime $time )
	
	/**
	 * Get deleted date
	 *
	 * @return	\IPS\DateTime
	 */
	public function get_deleted_date()
	
	/**
	 * Set Deleted By
	 *
	 * @param	\IPS\Member		The member
	 * @return	void
	 */
	public function set_deleted_by( \IPS\Member $member )
	
	/**
	 * Get Deleted By
	 *
	 * @return	\IPS\Member
	 */
	public function get__deleted_by()
	
	/**
	 * Get Permissions
	 *
	 * @return	array|string
	 */
	public function get_content_permissions()
	
	/**
	 * Get the date the content will be permanently removed on
	 *
	 * @return	\IPS\DateTime
	 */
	public function get_deletion_date()
	
	/**
	 * Set Content and Member
	 *
	 * @param	\IPS\Content		The content being deleted.
	 * @param	\IPS\Member|NULL	The member performing the deletion, or NULL for the currently logged in member
	 * @return	void
	 * @note Convenience ftw
	 */
	public function setContentAndMember( \IPS\Content $content, \IPS\Member $member = NULL )
	
	/**
	 * Save
	 *
	 * @return	void
	 */
	public function save()
	
	/**
	 * Load and check perms
	 *
	 * @param	int		ID
	 * @return	static
	 * @throws
	 *	@li \OutOfRangeException
	 */
	public static function loadAndCheckPerms( $id )
	
	/**
	 * Can View the deleted content
	 *
	 * @param	\IPS\Member|NULL	The member, or NULL for currently logged in
	 * @return	bool
	 */
	public function canView( \IPS\Member $member = NULL )
	
	/**
	 * URL to the deleted content
	 *
	 * @param	string|NULL		"action" parameter or NULL to go to the content
	 * @return	\IPS\Http\Url
	 */
	public function url( $action=NULL )
}

A new method was added to \IPS\Content which will queue the content for deletion.

	/**
	 * Log for deletion later
	 *
	 * \IPS\Member|NULL 	$member	The member or NULL for currently logged in
	 * @return	void
	 */
	public function logDelete( $member = NULL )

To identify content queued for deletion, the \IPS\Content::hidden() method now has the following return values:

  • 1 - This content is currently hidden requiring moderator approval.
  • 0 - This content is visible
  • -1 - This content has been hidden by a moderator
  • -2 - This content has been deleted by a moderator, and will be permanently removed at a later date.
Edited by Ryan Ashbrook

  Report Document


×
×
  • Create New...