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_save_custom_author_changes() { global $wpdb; $profile_id = $_POST["profile_id"]; $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); $custom_author_table->edit_row($profile_id, $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); return caa_return_message("Custom Author Updated", "updated"); }
function caa_update_global_settings() { if (!isset($_POST["is_form_submitted"])) { //Form was not submitted. return; } $caa_global_display_on_home_page = NULL; if (isset($_POST["caa_global_display_on_home_page"])) { $caa_global_display_on_home_page = $_POST["caa_global_display_on_home_page"]; } add_option(CAA_Config::caa_global_display_on_home_page, $caa_global_display_on_home_page); update_option(CAA_Config::caa_global_display_on_home_page, $caa_global_display_on_home_page); $caa_global_display_on_page = NULL; if (isset($_POST["caa_global_display_on_page"])) { $caa_global_display_on_page = $_POST["caa_global_display_on_page"]; } add_option(CAA_Config::caa_global_display_on_page, $caa_global_display_on_page); update_option(CAA_Config::caa_global_display_on_page, $caa_global_display_on_page); $caa_global_display_on_single_post = NULL; if (isset($_POST["caa_global_display_on_single_post"])) { $caa_global_display_on_single_post = $_POST["caa_global_display_on_single_post"]; } add_option(CAA_Config::caa_global_display_on_single_post, $caa_global_display_on_single_post); update_option(CAA_Config::caa_global_display_on_single_post, $caa_global_display_on_single_post); $caa_global_display_on_archive_page = NULL; if (isset($_POST["caa_global_display_on_archive_page"])) { $caa_global_display_on_archive_page = $_POST["caa_global_display_on_archive_page"]; } add_option(CAA_Config::caa_global_display_on_archive_page, $caa_global_display_on_archive_page); update_option(CAA_Config::caa_global_display_on_archive_page, $caa_global_display_on_archive_page); $caa_global_display_on_top = NULL; if (isset($_POST["caa_global_display_on_top"])) { $caa_global_display_on_top = $_POST["caa_global_display_on_top"]; } add_option(CAA_Config::caa_global_display_on_top, $caa_global_display_on_top); update_option(CAA_Config::caa_global_display_on_top, $caa_global_display_on_top); echo caa_return_message("Global settings Updated!", "updated"); }