No results found. Try again with different words?

Search must be at least 3 characters.

Change the subscribed user email based on a role

SureFeedback includes filters to change the email users receive when they are subscribed to a project. Here’s an example on how to change it based on role:

<?php
/**
 * Change the collaborate subject for project clients
 */
function wp395_ph_change_collaborate_subject( $subject, $email, $user, $post_id ) {
	// if user is a project client
	if ( user_can( $user, 'project_client' ) ) {
		$subject = 'Your Design Project is in progress.';
	}


	return $subject;
}


add_filter( 'ph_subscribe_user_email_subject', 'wp395_ph_change_collaborate_subject', 10, 4 );


/**
 * Change the collaborate message for project clients
 */
function wp987_ph_change_collaborate_message( $message, $email, $user, $post_id ) {
	// if user is a project client
	if ( user_can( $user, 'project_client' ) ) {
		// project link
		$project_link = get_the_permalink( $post_id );


		// add message
		$message = '<p>Your design project is in progress!</p>';
		$message .= '<p>' . __( 'View the project here:', 'project-huddle' ) . '</p>';
		$message .= '<p><a href="' . esc_url( $project_link ) . '">' . esc_url( $project_link ) . '</a></p>';
	}


	return $message;
}


add_filter( 'ph_subscribe_user_email_subject', 'wp987_ph_change_collaborate_message', 10, 4 );

These two functions change the subject and the message for the email. You can see how you can change it based on other properties too, like a post id or a specific user id too.

Was this article helpful?


Did not find a solution? We are here to help you succeed.

Change the subscribed user email based on a role

SureFeedback includes filters to change the email users receive when they are subscribed to a project. Here’s an example on how to change it based on role:

<?php
/**
 * Change the collaborate subject for project clients
 */
function wp395_ph_change_collaborate_subject( $subject, $email, $user, $post_id ) {
	// if user is a project client
	if ( user_can( $user, 'project_client' ) ) {
		$subject = 'Your Design Project is in progress.';
	}


	return $subject;
}


add_filter( 'ph_subscribe_user_email_subject', 'wp395_ph_change_collaborate_subject', 10, 4 );


/**
 * Change the collaborate message for project clients
 */
function wp987_ph_change_collaborate_message( $message, $email, $user, $post_id ) {
	// if user is a project client
	if ( user_can( $user, 'project_client' ) ) {
		// project link
		$project_link = get_the_permalink( $post_id );


		// add message
		$message = '<p>Your design project is in progress!</p>';
		$message .= '<p>' . __( 'View the project here:', 'project-huddle' ) . '</p>';
		$message .= '<p><a href="' . esc_url( $project_link ) . '">' . esc_url( $project_link ) . '</a></p>';
	}


	return $message;
}


add_filter( 'ph_subscribe_user_email_subject', 'wp987_ph_change_collaborate_message', 10, 4 );

These two functions change the subject and the message for the email. You can see how you can change it based on other properties too, like a post id or a specific user id too.

Leave a Reply

Your email address will not be published. Required fields are marked *

LET’S GET STARTED

Ready to Give It a Try?

Start Your Free 14-Day Trial Now. No Obligation. No Reason Not To.

Trial Icon

14 Days Free Trial

Experience Our Platform Risk-Free

Docs Icon

Documentation

Articles that cover common questions

24/7 World Class Support Team

Friendly Support

Reach Out – We’re Here to Help

Scroll to Top