Jump to content

Namthar

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Namthar

  1. Hi ! I will add a custom shortcut in my contactForm7 plugin. I want to email the user. But I have a problem with the email. My shortcut works correctly in the contact form, but it doesn't email the user role The Code add_filter( 'wpcf7_form_elements', 'dacrosby_do_shortcodes_wpcf7_form' ); function dacrosby_do_shortcodes_wpcf7_form( $form ) { $form = do_shortcode( $form ); return $form; } // Allow custom shortcodes in CF7 mailed message body add_filter( 'wpcf7_mail_components', 'dacrosby_do_shortcodes_wpcf7_mail_body', 10, 2 ); function dacrosby_do_shortcodes_wpcf7_mail_body( $components, $number ) { $components['body'] = do_shortcode( $components['body'] ); return $components; }; // Add shortcode normally as per WordPress API add_shortcode('my_code', 'my_code_callback'); function my_code_callback($atts){ $user = wp_get_current_user(); return $user->roles[0]; } It only shows the shortcut in the contact form, but does not send it by email. Can someone help me find the problem?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.