Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    Good day @you4eea

    Out of box, no we’ve stuck with just the two mentioned ion our dashboard thus far. However, we do have some code-based methods available to add your own if you wanted. I am not sure how code-savvy you are, but I have provided a quick example for a user’s first name below, which would allow for using a [firstname] placeholder. There is a comment provided in the snippet as well to help explain what some of the parts are.

    function bpro_support_extra_placeholders( $message_parts, $user ) {
    	/**
    	 * The $message_parts variable will have 3 indexes:
    	 * user_email: holding the email address of the user being moderated
    	 * user_subject: email subject line
    	 * user_message: the message for the appropriate moderation action being performed.
    	 * 
    	 * You'll want to parse out any custom shortcodes matching in a similar way below, fetching the user data as needed using the passed $user object.
    	 */
    	$firstname = get_user_meta( $user->data->ID, 'first_name', true );
    	$message_parts['user_message'] = str_replace( '[firstname]', $firstname, $message_parts['user_message'] );
    
    	return $message_parts;
    }
    add_filter( 'bpro_hook_before_email', 'bpro_support_extra_placeholders', 10, 2 );
    

    Let me know if you need some help with this, or have some questions/concerns about anything.

    Thread Starter you4eea

    (@you4eea)

    WOW… YOU ROCK!
    Exactly what I needed..

    Got it..
    Threw into my functions.php file in child-theme and BAMM!

    Worked perfectly..

    Thanks!

    • This reply was modified 3 years, 2 months ago by you4eea.
    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome. Let us know if you need anything else.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘User Profile Fields Shortcode’ is closed to new replies.