LLMS_Comments::exclude_order_comments( array $clauses )

Exclude order comments from queries and RSS.


Parameters Parameters

$clauses

(array) (Required) Array of SQL clauses.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/class.llms.comments.php

	public static function exclude_order_comments( $clauses ) {

		global $wpdb, $typenow;

		// Allow queries when in the admin.
		if ( is_admin() && in_array( $typenow, array( 'llms_order' ), true ) && current_user_can( apply_filters( 'lifterlms_admin_order_access', 'manage_options' ) ) ) {
			return $clauses;
		}

		if ( ! $clauses['join'] ) {
			$clauses['join'] = '';
		}

		if ( ! strstr( $clauses['join'], "JOIN $wpdb->posts" ) ) {
			$clauses['join'] .= " LEFT JOIN $wpdb->posts ON comment_post_ID = $wpdb->posts.ID ";
		}

		if ( $clauses['where'] ) {
			$clauses['where'] .= ' AND ';
		}

		$clauses['where'] .= " $wpdb->posts.post_type NOT IN ('" . implode( "','", array( 'llms_order' ) ) . "') ";

		return $clauses;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
3.37.12 Use strict comparison for in_array().
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.