function caa_save_new_custom_author()
{
    global $wpdb;
    //Save New Author
    $username = $_POST["username"];
    if ($username == "") {
        return caa_return_message("Error! Username is required!", "error");
    }
    $email = $_POST["email"];
    $first_name = $_POST["first_name"];
    $last_name = $_POST["last_name"];
    $url = $_POST["url"];
    $description = $_POST["description"];
    $twitter = $_POST["twitter"];
    $facebook = $_POST["facebook"];
    $google_plus = $_POST["google_plus"];
    $linkedin = $_POST["linkedin"];
    $flickr = $_POST["flickr"];
    $youtube = $_POST["youtube"];
    $vimeo = $_POST["vimeo"];
    $skype = $_POST["skype"];
    $xing = $_POST["xing"];
    $custom_link_1 = $_POST["custom_link_1"];
    $custom_icon_1 = $_POST["custom_icon_1"];
    $custom_link_2 = $_POST["custom_link_2"];
    $custom_icon_2 = $_POST["custom_icon_2"];
    $custom_link_3 = $_POST["custom_link_3"];
    $custom_icon_3 = $_POST["custom_icon_3"];
    $use_custom_image = null;
    if (isset($_POST['use_custom_image'])) {
        $use_custom_image = $_POST["use_custom_image"];
    }
    $custom_image_url = $_POST["custom_image_url"];
    $display_html_block = null;
    if (isset($_POST['display_html_block'])) {
        $display_html_block = $_POST["display_html_block"];
    }
    $html_block = $_POST["html_block"];
    $custom_author_table = new CAA_Profile_DB($wpdb);
    if ($custom_author_table->get_row_by_username($username) != null) {
        //username already exist
        return caa_return_message("Error! Username <strong>" . $username . "</stong> already exists!", "error");
    }
    $profile_id = $custom_author_table->create_new_row($username, $first_name, $last_name, $email, $url, $description, $twitter, $facebook, $google_plus, $linkedin, $flickr, $youtube, $vimeo, $skype, $xing, $custom_link_1, $custom_icon_1, $custom_link_2, $custom_icon_2, $custom_link_3, $custom_icon_3, $use_custom_image, $custom_image_url, $display_html_block, $html_block);
    if ($profile_id) {
        $message = "Custom Author Successfully Added " . "<a href='admin.php?page=" . CAA_Config::display_all_custom_authors_page . "'>Back to all custom authors</a>";
        return caa_return_message($message, "updated");
    } else {
        return caa_return_message("Error Adding Custom Author!", "error");
    }
}
function caa_get_author_details_from_database($username, $convert_line_feeds_to_br = false)
{
    global $wpdb;
    $database_author_details = null;
    $author_profile_db = new CAA_Profile_DB($wpdb);
    $result = $author_profile_db->get_row_by_username($username);
    if ($result) {
        $author_description = $result->description;
        if ($convert_line_feeds_to_br) {
            $author_description = caa_replace_linefeeds_to_br($author_description);
        }
        $database_author_details = array(CAA_Author::first_name => $result->first_name, CAA_Author::last_name => $result->last_name, CAA_Author::user_email => $result->email, CAA_Author::user_url => $result->url, CAA_Author::description => $author_description, CAA_Author::twitter => $result->twitter, CAA_Author::facebook => $result->facebook, CAA_Author::google_plus => $result->google_plus, CAA_Author::linkedin => $result->linkedin, CAA_Author::flickr => $result->flickr, CAA_Author::youtube => $result->youtube, CAA_Author::vimeo => $result->vimeo, CAA_Author::skype => $result->skype, CAA_Author::xing => $result->xing, CAA_Author::custom_icon_1 => $result->custom_icon_1, CAA_Author::custom_link_1 => $result->custom_link_1, CAA_Author::custom_icon_2 => $result->custom_icon_2, CAA_Author::custom_link_2 => $result->custom_link_2, CAA_Author::custom_icon_3 => $result->custom_icon_3, CAA_Author::custom_link_3 => $result->custom_link_3, CAA_Profile_DB::use_custom_image => $result->use_custom_image, CAA_Profile_DB::custom_image_url => $result->custom_image_url, CAA_Profile_DB::display_html_block => $result->display_html_block, CAA_Profile_DB::html_block => $result->html_block);
    }
    return $database_author_details;
}