Documentation > Developers > Filter Examples > Show Number of Images in Approval Email

Show Number of Images in Approval Email

The following snippet will add the number of approved as well as the number of all images to the approval email, the photographer receives, once the client has approved the collection.

Please note that for multi-collections, the number of images, which have been approved at least once, will be displayed.

function my_picu_add_number_of_approved_images( $mail_parts, $mail_context, $post_id ) {
	if ( $mail_context == 'photographer_collection_approved' ) {

		$images = picu_get_collection_image_num( $post_id );
		$approved = picu_get_selection_count( $post_id );

		$mail_parts['num'] = [
			'type' => 'text',
			'text' => '<p>The customer approved ' . $approved . ' out of ' . $images . ' available photos.</p>',
		];
	}

	return $mail_parts;
}

add_filter( 'picu_mail_parts', 'my_picu_add_number_of_approved_images', 10, 3 );Code language: PHP (php)

Need help?

If you couldn’t find what you were looking for and need more assistance, please get in touch with us directly and we’re happy to help.