AnsPress_Notification_Query::get_permalink()

Description #

Get the permalink of notification based on ref_id and ref_type.

Source #

File: addons/free/notification/query.php

	public function get_permalink() {
		if ( in_array( $this->get_ref_type(), [ 'question', 'answer', 'post' ], true ) ) {
			return ap_get_short_link( [ 'ap_p' => $this->get_ref_id() ] );
		} elseif ( 'comment' === $this->get_ref_type() ) {
			return ap_get_short_link( [ 'ap_c' => $this->get_ref_id() ] );
		} elseif ( 'reputation' === $this->get_ref_type() ) {
			return ap_get_short_link( [ 'ap_u' => $this->object->noti_user_id, 'sub' => 'reputations' ] );
		}
	}

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