How to conditionally output to sidebar of each author’s archive and posts by each author?

As often the case, asking the question reveals the answer:

Use global $authordata;. Fix php errors: == operator. Fix $rid=’445′, not $rid=445.

Here’s the working code:

add_action ('genesis_before_sidebar_widget_area','user_testimonials',10);

function user_testimonials(){

if (is_author() || is_singular('post')){ 

global $authordata; //using global $authordata is more direct

$authorlogin = $authordata->user_login;

//print_r( $authordata ); //to see everything

if (is_author('author-1') || ($authorlogin=="author-1") ) //Fix the == operators

{

$rid='445';

} 

elseif (is_author('author-2')  || ($authorlogin=='author-2') )

{

    $rid='451';

}


echo "<section class="widget"><h3 class="widget-title"> Testimonials </h3>";
echo do_shortcode('
[testimonial_rotator id='. $rid .' hide_title="true" format="list"]')  
. '</section>';
}
}