public/wordpress/wp-content/plugins/wp-courseware/includes/controllers/units.php
/**
	 * Remove Unit Content on Post Type Archives.
	 *
	 * @since 4.3.0
	 */
Remove Unit Content on Post Type Archives.
Remove Unit Content on Post Type Archives .
public function post_type_remove_content( $content ) {
		global $post;
		if ( ! is_main_query() || ! is_a( $post, 'WP_Post' ) || ( $this->post_type_slug !== $post->post_type ) ) {
			return $content;
		}
		$is_taxonomy = ( is_archive() && ( is_tax( $this->taxonomy_tag_slug ) || is_tax( $this->taxonomy_category_slug ) ) );
		$is_single = is_singular( $this->post_type_slug );
		$message = WPCW_UnitFrontend::message_createMessage_error( esc_html__( 'Sorry, but you\'re not allowed to access this unit.', 'wp-courseware' ) );
		if ( $is_taxonomy && apply_filters( 'wpcw_units_enable_taxonomy_archive_content', false ) ) {
			return $content;
		}
		if ( $is_taxonomy && ! wpcw_can_student_access_unit( get_the_ID() ) ) {
			$content = apply_filters( 'wpcw_units_taxonomy_archive_content_no_access_message', $message );
		}
		if ( $is_single && apply_filters( 'wpcw_units_enable_single_content', false ) ) {
			return $content;
		}
		if ( $is_single && ! wpcw_can_student_access_unit( get_the_ID() ) ) {
			$content = apply_filters( 'wpcw_units_single_content_no_access_message', $message );
		}
		return $content;
	}
public function post_type_remove_content ( $ content ) { global $ post ; if ( ! is_main_query ( ) || ! is_a ( $ post , 'WP_Post' ) || ( $ this -> post_type_slug !== $ post -> post_type ) ) { return $ content ; } $ is_taxonomy = ( is_archive ( ) && ( is_tax ( $ this -> taxonomy_tag_slug ) || is_tax ( $ this -> taxonomy_category_slug ) ) ) ; $ is_single = is_singular ( $ this -> post_type_slug ) ; $ message = WPCW_UnitFrontend :: message_createMessage_error ( esc_html__ ( 'Sorry, but you\'re not allowed to access this unit.' , 'wp-courseware' ) ) ; if ( $ is_taxonomy && apply_filters ( 'wpcw_units_enable_taxonomy_archive_content' , false ) ) { return $ content ; } if ( $ is_taxonomy && ! wpcw_can_student_access_unit ( get_the_ID ( ) ) ) { $ content = apply_filters ( 'wpcw_units_taxonomy_archive_content_no_access_message' , $ message ) ; } if ( $ is_single && apply_filters ( 'wpcw_units_enable_single_content' , false ) ) { return $ content ; } if ( $ is_single && ! wpcw_can_student_access_unit ( get_the_ID ( ) ) ) { $ content = apply_filters ( 'wpcw_units_single_content_no_access_message' , $ message ) ; } return $ content ; }
Remove Unit Content on Post Type Archives.
Remove Unit Content on Post Type Archives .
// Is Unit Taxonomy. // Is Unit Single. // No Access Message. /**
		 * Filter: Units Enable Taxonomy Archive Content.
		 *
		 * @since 4.3.0
		 *
		 * @param bool True to enable unit content to be displayed on archive pages. Default is False.
		 *
		 * @return bool The boolean paramater to enable or disable content on archive pages.
		 */ /**
			 * Filter: Units Taxonomy Archive Content - No Access Message.
			 *
			 * @since 4.3.0
			 *
			 * @param string $message The no access message.
			 *
			 * @return string $message The no access message.
			 */ /**
		 * Filter: Units Enable Single Content.
		 *
		 * @since 4.5.1
		 *
		 * @param bool True to enable unit content to be displayed on single pages. Default is False.
		 *
		 * @return bool The boolean paramater to enable or disable content on single pages.
		 */ // Single Content. /**
			 * Filter: Units Single Content - No Access Message.
			 *
			 * @since 4.5.1
			 *
			 * @param string $message The no access message.
			 *
			 * @return string $message The no access message.
			 */