The MU forums have moved to WordPress.org

Dan's avatar for MU (1 post)

  1. indojepang
    Member
    Posted 17 years ago #

    hi.. How to make this running in MU?
    I test global $blog_id everywhere.. but not working lol..
    please help..

    function cmd_show_avatar()
    {
    global $wpdb;
    global $avatars_path;

    $the_author_name = get_comment_author();
    if($the_author_name == "" or $the_author_name == __('Anonymous'))
    { // Avatar for posts
    $the_author = get_the_author_id();
    $the_author_name = get_the_author();
    } else { // Avatar for comments - only for registered users
    $the_comment_ID = get_comment_ID();
    $the_author = $wpdb->get_var("SELECT user_ID FROM $wpdb->comments WHERE comment_ID='$the_comment_ID'");
    }

    $image_path = get_bloginfo('wpurl')."/wp-content/avatars/";
    $the_avatar = $image_path.$the_author.".jpg";
    if(file_exists("$avatars_path/$the_author.jpg"))
    {
    echo '<img src="' . $the_avatar. '" alt="' . $the_author_name . '" class="cmd-avatar" />';
    } elseif(file_exists("$avatars_path/default.jpg")) {
    echo '<img src="' . $image_path . 'default.jpg" alt="Unregistered" class="cmd-avatar" />';
    }
    // If the file doesn't exist then return nothing...
    }

About this Topic

  • Started 17 years ago by indojepang