LLMS_Comments::exclude_order_comments( array $clauses )

Exclude order comments from queries and RSS.


Description Description

See also See also

  • thanks: WooCommerce 😀

Top ↑

Parameters Parameters

$clauses

(array) (Required)


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' ) ) && 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.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

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





Permalink: