Notifications::get_permalink()

Description #

Get the permalink of notification based on ref_id and ref_type.

Source #

File: addons/notifications/query.php

	public function get_permalink() {
		if ( in_array( $this->get_ref_type(), array( 'question', 'answer', 'post' ), true ) ) {
			return ap_get_short_link( array( 'ap_p' => $this->get_ref_id() ) );
		} elseif ( 'comment' === $this->get_ref_type() ) {
			return ap_get_short_link( array( 'ap_c' => $this->get_ref_id() ) );
		} elseif ( 'reputation' === $this->get_ref_type() ) {
			return ap_get_short_link(
				array(
					'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