Activity_Helper::prepare_actions()

Description #

Prepare all actions of activity. Numeric keys are used here so that we can save space while saving in database.

Changelog #

VersionDescription
4.1.2Introduced.

Source #

File: includes/class/class-activity-helper.php

	public function prepare_actions() {
		$defaults = array(
			'new_q'               => array(
				'ref_type' => 'question',
				'verb'     => __( 'Asked question', 'anspress-question-answer' ),
				'icon'     => 'apicon-question',
			),
			'edit_q'              => array(
				'ref_type' => 'question',
				'verb'     => __( 'Edited question', 'anspress-question-answer' ),
				'icon'     => 'apicon-pencil',
			),
			'new_a'               => array(
				'ref_type' => 'answer',
				'verb'     => __( 'Answered question', 'anspress-question-answer' ),
				'icon'     => 'apicon-answer',
			),
			'edit_a'              => array(
				'ref_type' => 'answer',
				'verb'     => __( 'Edited answer', 'anspress-question-answer' ),
				'icon'     => 'apicon-answer',
			),
			'status_publish'      => array(
				'ref_type' => 'post',
				'verb'     => __( 'Changed status to publish', 'anspress-question-answer' ),
				'icon'     => 'apicon-flag',
			),
			'status_future'       => array(
				'ref_type' => 'post',
				'verb'     => __( 'Changed publish date to future', 'anspress-question-answer' ),
				'icon'     => 'apicon-flag',
			),
			'status_moderate'     => array(
				'ref_type' => 'post',
				'verb'     => __( 'Changed status to moderate', 'anspress-question-answer' ),
				'icon'     => 'apicon-flag',
			),
			'status_private_post' => array(
				'ref_type' => 'post',
				'verb'     => __( 'Changed visibility to private', 'anspress-question-answer' ),
				'icon'     => 'apicon-flag',
			),
			'status_trash'        => array(
				'ref_type' => 'post',
				'verb'     => __( 'Trashed', 'anspress-question-answer' ),
				'icon'     => 'apicon-trashcan',
			),
			'featured'            => array(
				'ref_type' => 'question',
				'verb'     => __( 'Marked as featured question', 'anspress-question-answer' ),
				'icon'     => 'apicon-star',
			),
			'unfeatured'          => array(
				'ref_type' => 'question',
				'verb'     => __( 'Unfeatured the question', 'anspress-question-answer' ),
				'icon'     => 'apicon-question',
			),
			'closed_q'            => array(
				'ref_type' => 'question',
				'verb'     => __( 'Marked as closed', 'anspress-question-answer' ),
				'icon'     => 'apicon-alert',
			),
			'open_q'              => array(
				'ref_type' => 'question',
				'verb'     => __( 'Re-opened the question', 'anspress-question-answer' ),
				'icon'     => 'apicon-question',
			),
			'new_c'               => array(
				'ref_type' => 'comment',
				'verb'     => __( 'Posted new comment', 'anspress-question-answer' ),
				'icon'     => 'apicon-comments',
			),
			'edit_c'              => array(
				'ref_type' => 'comment',
				'verb'     => __( 'Edited comment', 'anspress-question-answer' ),
				'icon'     => 'apicon-comments',
			),
			'selected'            => array(
				'ref_type' => 'answer',
				'verb'     => __( 'Selected answer as best', 'anspress-question-answer' ),
				'icon'     => 'apicon-check',
			),
			'unselected'          => array(
				'ref_type' => 'answer',
				'verb'     => __( 'Unselected an answer', 'anspress-question-answer' ),
				'icon'     => 'apicon-check',
			),
		);

		/**
		 * Filter allows adding new activity actions. This hook is only called once
		 * while class initiate. Hence, later filters will not work. Also make sure
		 * to keep array key length less then 20 characters.
		 *
		 * @param array $actions Originally registered actions.
		 * @since 4.1.2
		 */
		$actions = apply_filters( 'ap_activity_actions', $defaults );

		// We have to check for array key length and must keep it below 20 characters.
		foreach ( $actions as $key => $action ) {
			$this->actions[ $key ] = $action;
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment