Output thumbnail for current DJ using Radio Station Plugin Wordpress

So I’ve installed the “Radio Station” plugin to my Wordpress installation. All seems fine with that. There’s a widget included with this plugin that is meant to display “On Air” information about the current DJ in the sidebar and also some information, including their thumbnail image.

The trouble I’m having is, I can’t (properly i.e. dynamically) get this thumbnail to display.

With the standard installation, the plugin is apparently meant to use Gravatar avatars, but that didn’t work no matter what I tried.

So I’ve been digging through the code most of the day, trying to figure it out and maybe find a function that would get me the right value and found the following which was relevant in the dj-on-air.php file:
[php]
if(count($djs[‘all’]) > 0) {
foreach($djs[‘all’] as $dj) {
//print_r($dj);
$dj_str .= ‘

  • ’;
    if($show_avatar) {
    $dj_str .= ‘’.get_the_post_thumbnail($dj->ID, ‘thumbnail’).’’;
    }

    [/php]
    The get_the_post_thumbnail() function doesn’t seem to be working as intended for whatever reason. When I assigned the following variable and displayed it to see what was happening
    [php]
    $tmp = $dj->ID;
    [/php]
    the output was “293” (without quotes) which, looking through phpmyadmin seemed to be the “ID” value from the wp_posts table which kinda made sense but explained why get_the_post_thumbnail() wasn’t outputting a valid image url for the thumbnail since there is no user ID with a value of “293” - so it just returned nothing and the output html was

    <span class="on-air-dj-avatar"></span>
    

    So what I need to do is somehow get the “user ID” value for the currently “on-air” DJ and feed that into the following:[php]

    echo '<span class="on-air-dj-avatar">'.get_wp_user_avatar($dj->ID, 96).'</span>';
    

    [/php]
    The above doesn’t work presumably because the $dj->ID is returning “293”.

    get_wp_user_avatar() is a function I’m using from another plugin called WP User Avatar so I could set an avatar image manually for each User in the admin area.

    If I manually enter the user ID value of “3”:

    echo '<span class="on-air-dj-avatar">'.get_wp_user_avatar(3, 96).'</span>';
    

    It displays the avatar in the widget perfectly as the user ID of the DJ in question is “3”. However, I need a way to do this dynamically.

    I’m not too sure what $dj->ID is doing or how to maybe use that to get the “user ID” of the DJ and not the “wp_posts ID” as it seems to be giving?

    I hope I’ve made some sort of sense here. If anyone can help it’d be greatly appreciated and if you need to see more of the source files, please let me know.

    UPDATE:

    So I’m trying the following:
    [php]

    					global $wp_query;
    				//	$tmp=$dj->post_author;
    					
    					//$tmp = $wp_query->post->ID;
    				$author_id = $dj->post_author;
    				$tmp2 = the_author_meta( 'ID', $author_id );
    					
    					$getid = $posts[0]->post_author;
    				
    					
    						echo '<span class="on-air-dj-avatar">'.get_wp_user_avatar($dj->ID, 96).$getid.'</span>';
    					}
    

    [/php]
    This keeps giving me “1” as the $getid value which seems to be the ID of the admin user not the user of the current “post”. How can I get the user ID of the “post” relating to the current widget. Do I need to make $dj include more values? The other code above was other attempts to get the user ID of the ON-AIR DJ. I think I’m missing something fairly obvious here.

  • Ok, so I’m now looking for someone to help out for a small fee $20 - all I need is the code editing so that the avatar on the “now playing” widget shows the avatar for that DJ…

    If anyone can help out it would be greatly appreciated.

    Sponsor our Newsletter | Privacy Policy | Terms of Service