WordPress.org

Forums

Radio Station
Avatars not showing On-Air widget multiple themes (2 posts)

  1. diagon-ali
    Member
    Posted 1 year ago #

    Hi,

    Thanks for this plugin - really appreciate the work that's gone into it and it's coming in very handy.

    I'm having a problem with the "On Air" widget in that it's not displaying the Avatar. I've set up a Gravatar account, linked to an e-mail address and the avatar seems to show in the WordPress Users list but not in the On-Air Widget which I've placed in the Main Sidebar.

    I'm getting this as output when I view source:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <ul class="on-air-list">
    <li class="on-air-dj">
    <span class="on-air-dj-avatar"></span>
    <a href="http://www.mosaicwebsolutions.co.uk/dev/radio/?show=lauren-stripling">Lauren Stripling</a><span class="radio-clear">
    
    </span><span class="on-air-dj-sched">Thursdays, 1:00 am-12:00 pm</span><span class="on-air-dj-playlist">
    <a href="http://www.mosaicwebsolutions.co.uk/dev/radio/?playlist=reggae-beats">View Playlist</a></span>

    So the span tag with "on-air-dj-avatar" seems empty for some reason. Tried with the Twenty Twelve Theme and a few others, no luck.

    I also installed the Cimy User Extra Fields plugin and setup a new field for an avatar and *attempted* to edit the author.php file by replacing:

    get_avatar( get_the_author_meta( 'user_email' )

    with

    get_avatar( get_the_author_meta( 'USER_AVATAR' )

    where USER_AVATAR looks like the variable name assigned by Cimy Extra Fields - but clearly I'm off track here. My PHP coding skills are very limited at the moment so I'm probably missing something very obvious.

    Is there something I'm missing in getting the Avatar to show in the "On-Air" widget? Probably is something obvious but would really appreciate any help with this as I only just started setting up a site with this plugin and I've fallen at the very first hurdle!

    Thanks
    Ali

    http://wordpress.org/extend/plugins/radio-station/

  2. diagon-ali
    Member
    Posted 1 year ago #

    Ok so I've spent quite a while trying to get this working. I've discovered that this

    get_the_post_thumbnail($dj->ID, 'thumbnail')

    is what's controlling the output of the thumbnail.

    So I installed WP User Avatar plugin so I could set an image for a user manually, which works fine.

    I then set a variable to see what $dj->ID did:

    $tmp = $dj->ID;

    Then output $tmp and the result was "292" (no quotes)

    I looked in phpmyadmin and this correlates to the "wp_posts" table and is giving the "ID" of that post.

    I changed the code to:

    get_wp_user_avatar($dj->ID, 96)

    ...and this gives a blank value because there is no user ID of 292.

    In fact, the user ID I'm looking for, for the user who is "on-air" happens to be "3".

    I tried the following:

    get_wp_user_avatar(3, 96)

    and it worked! It output the user thumbnail.

    However, obviously I want to dynamically fetch this user ID and this is where I'm struggling now because my PHP knowledge isn't quite good enough.

    Please can someone help with this? How can I maybe use the wp_posts ID and pull in the user ID from the posts_author value? I'm getting confused here...

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Radio Station
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic