How to change image’s author via a function when using GravityForms uploader? [closed]

add_action("gform_user_registered", "image_author", 10, 4);
function image_author($user_id, $config, $entry, $user_pass) 
{
$post_id = $entry["post_id"];

$args = array(
'post_parent' => $post_id,
'post_type' => 'attachment',
'post_mime_type' => 'image'
);

$attachments = get_posts($args);
if($attachments) :
    foreach ($attachments as $attachment) : setup_postdata($attachment);
       $the_post = array();
       $the_post['ID'] = $attachment->ID;
       $the_post['post_author'] = $user_id;

       wp_update_post( $the_post );

   endforeach;
endif;    

}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)