Skip to content

Instantly share code, notes, and snippets.

@cryptexvinci
Last active October 12, 2020 04:45
Show Gist options
  • Save cryptexvinci/04166858b2af7c8c0cc9eb9831c7a865 to your computer and use it in GitHub Desktop.
Save cryptexvinci/04166858b2af7c8c0cc9eb9831c7a865 to your computer and use it in GitHub Desktop.
Display Ultimate Member Message button in TutorLMS student profile.
<?php
add_action('tutor_student/before/wrap', 'display_tutor_msg' );
function display_tutor_msg(){
$user_name = sanitize_text_field(get_query_var('tutor_student_username'));
$sub_page = sanitize_text_field(get_query_var('profile_sub_page'));
$get_user = tutor_utils()->get_user_by_login($user_name);
$user_id = $get_user->ID;
$title = "Message";
wp_enqueue_script( 'um-messaging' );
wp_enqueue_style( 'um-messaging' );
?>
<div class="um-messaging-btn">
<div class="um-members-messaging-btn um-members-list-footer-button-wrapper">
<a href="javascript:void(0);" class="um-message-btn um-button" data-message_to="<?php echo esc_attr( $user_id ) ?>" title="<?php echo esc_attr( $title ) ?>">
<span><?php echo esc_html( $title ) ?></span>
</a>
</div>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment