• Hi @dcavins,

    I’m trying to add a function to notify the admin each time a new document is saved. How could I add the author’s name?

    `function send_email_new_doc($post)
    {
    $emails = get_option(‘admin_email’);
    $title = wp_strip_all_tags(get_the_title($post->ID));
    $url = get_permalink($post->ID);
    $message = “LINK: \n{$url}”;

    wp_mail($emails, “HERE: {$title}”, $message);
    }

    Thank you!

Viewing 1 replies (of 1 total)
  • Plugin Author David Cavins

    (@dcavins)

    Hello, in BuddyPress the thing you’re probably looking for is the “display name” which you can get using bp_core_get_user_displayname(). You’ll need to pass the user ID, which is probably easiest to get using the current user. So something like this might do what you want:
    $author_name = bp_core_get_user_displayname( bp_loggedin_user_id() );

Viewing 1 replies (of 1 total)

The topic ‘Email notification – New Doc’ is closed to new replies.