function render_for_ajax()
 {
     $this->anon = TRUE;
     if (!empty(PA::$login_user)) {
         $login_id = PA::$login_user->user_id;
         $this->anon = FALSE;
     }
     switch ($this->params["op"]) {
         case "add_fan":
             if ($this->anon) {
                 $this->err = __("Please log in or register to add yourself as a fan!");
                 break;
             }
             $this->subject_type = $this->params['subject_type'];
             $this->subject_id = $this->params['subject_id'];
             // actual add of fan goes here
             try {
                 $fan = new Fan();
                 $fan->subject_type = $this->subject_type;
                 $fan->subject_id = $this->subject_id;
                 $fan->user_id = PA::$login_user->user_id;
                 $fan->user_displayname = @PA::$login_user->display_login_name ? PA::$login_user->display_login_name : PA::$login_user->login_name;
                 $fan->user_fullname = @PA::$login_user->first_name . " " . @PA::$login_user->last_name;
                 $fan->save();
                 $this->note = __("You are now a fan - thank you for participating!");
                 // for rivers of people
                 $activity = 'user_add_fanof';
                 $extra = serialize(array('info' => PA::$login_user->login_name . ' became a fan.', 'subject_type' => $this->subject_type, 'subject_id' => $this->subject_id));
                 Activities::save(PA::$login_uid, $activity, -1, $extra, array($activity));
             } catch (PAException $e) {
                 $this->err = __("There was a problem adding as a fan: ") . $e->getMessage();
             }
             break;
         case "remove_fan":
             if ($this->anon) {
                 $this->err = __("Please log in or register to remove yourself as a fan!");
                 break;
             }
             $this->subject_type = $this->params['subject_type'];
             $this->subject_id = $this->params['subject_id'];
             // actual removal of fan goes here
             try {
                 Fan::remove(PA::$login_user->user_id, $this->subject_type, $this->subject_id);
                 $this->note = __("You are no longer a fan - thank you for participating!");
                 // for rivers of people
                 $activity = 'user_remove_fanof';
                 $extra = serialize(array('info' => PA::$login_user->login_name . ' is no longer a fan.', 'subject_type' => $this->subject_type, 'subject_id' => $this->subject_id));
                 Activities::save(PA::$login_uid, $activity, -1, $extra, array($activity));
             } catch (PAException $e) {
                 $this->err = __("There was a problem removing as a fan: ") . $e->getMessage();
             }
             break;
         default:
             // just ignore unknown ops
             break;
     }
     return $this->render();
 }