Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] "Contact form 7" special tags for buddypress


  • kypto
    Participant

    @kypto

    Hi,

    i have inclueded contact form (contact form 7 plugin) to every users profile page. now i need to get their profile information into the mail from the contact form. (displayed user from which profile the form was send)

    I was trying defined special tags for contact form 7, but it seems that it doesnt cooperate with buddypress. for exemple, when i define tag for currect login user it works

    add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag_userdata', 10, 2 );
    
    function wpcf7_special_mail_tag_userdata( $output, $name ) {
    
    // For backwards compat.
    
    $name = preg_replace( '/^wpcf7\./', '_', $name );
    
    global $current_user;
    
    if ( 'user_login' == $name )
    $output = $current_user->user_login;
    
    return $output;
    }

    but when i want want to get the displayed user information like his name/email, it doesnt work …

    $output = $current_user->bp_displayed_user_fullname;

    or

    global $bp;
    return apply_filters( 'bp_displayed_user_fullname', isset( $bp->displayed_user->fullname ) ? $bp->displayed_user->fullname : '' );

    doesnt work either

    what am i doing wrong? or could you help with it somehow?

Viewing 1 replies (of 1 total)

  • kypto
    Participant

    @kypto

    oh, i feel stupid now 🙂 the solution is:

    add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag_userdata', 10, 2 );
    
    function wpcf7_special_mail_tag_userdata( $output, $name ) {
    
    $name = preg_replace( '/^wpcf7\./', '_', $name );
    
    global $bp;
    
    if ( 'user_login' == $name )
    return apply_filters( 'bp_displayed_user_fullname', isset( $bp->displayed_user->fullname ) ? $bp->displayed_user->fullname : '' );
    }
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] "Contact form 7" special tags for buddypress’ is closed to new replies.
Skip to toolbar