Skip to:
Content
Pages
Categories
Search
Top
Bottom

How can I add mention on username compose field


  • marcelokayata
    Participant

    @marcelokayata

    place to suggest

    This is m y code

    <?php
    //marcelokayata
    
    //mentions
    define( 'BP_MESSAGES_AUTOCOMPLETE_ALL', true );
    //-----------------------------------------------------marcelokayata
    // Add Shortcode
    function teste_avatar_shortcode() {
    
            ob_start();
    
            global $post;
    
            $current_user = wp_get_current_user();
            /*echo 'Username: ' . $current_user->user_login . '<br />';
            echo 'User email: ' . $current_user->user_email . '<br />';
            echo 'User first name: ' . $current_user->user_firstname . '<br />';
            echo 'User last name: ' . $current_user->user_lastname . '<br />';
            echo 'User display name: ' . $current_user->display_name . '<br />';
            echo 'User ID: ' . $current_user->ID . '<br />';*/
    
            if($current_user->ID!=0){
    
                echo get_avatar_url($current_user->ID);
                echo get_avatar($current_user->ID);
    
            }
    
            $output = ob_get_contents();
            ob_end_clean();
            return $output;
    
    }
    add_shortcode( 'teste_avatar', 'teste_avatar_shortcode' );
  • You must be logged in to reply to this topic.
Skip to toolbar