Support » Plugin: WP Better Emails » Member specific information from a custom shortcode in the output

  • Hi,

    I am using Contact Form 7 and I’ve attempted to achieve what I am trying through their shortcode adding and I’ve also tried through WP Better Emails’ version too but it isn’t working with either.

    I am attempting to output some detailed information about the particular user, most of which can only be accessed with the use of their username/userid/email, I’ve been testing the following code just to output some simple text about the person that used the contact form:

    add_filter('wpbe_tags', 'add_my_tags');
    function add_my_tags( $tags ) {
        $MInfo = 'Details:';
        if (!is_user_logged_in()) {
            $MInfo .= "\n" . 'Account: Unregistered/Not Logged In';
        } else {
            $MInfo .= "\n" . 'Account: Registered/Logged In';
        if ($name === 'MInfo'){
            return $MInfo;
        $tags['MInfo'] = $MInfo;
        return $tags;

    However, regardless of the logged in status it will always output::

    Account: Unregistered/Not Logged In

    How can I make the above work… how can I transmit the user ID or email or username to the shortcode?


Viewing 1 replies (of 1 total)
  • is_user_logged_in() is plugable, this means it fires late in wordpress. Try using

    $current_user = wp_get_current_user();
        if ( $current_user != 0 ) {
            $minfo = 'User ' . esc_html( $current_user->user_firstname );
        } else {
            $minfo = 'Unrigistered';
Viewing 1 replies (of 1 total)
  • The topic ‘Member specific information from a custom shortcode in the output’ is closed to new replies.