/**
 * Template function for adding new contacts
 * @since 0.1
 */
function rolo_add_contact()
{
    $user = wp_get_current_user();
    if ($user->ID) {
        //TODO - Check user capabilites
        //TODO - Verify nounce here
        if (isset($_POST['rp_add_contact']) && $_POST['rp_add_contact'] == 'add_contact') {
            $contact_id = _rolo_save_contact_fields();
            if ($contact_id) {
                // echo __("Contacto adicionado com sucesso.", 'rolopress');
                $location = get_bloginfo('siteurl');
                echo "<script type='text/javascript'>window.location = '" . $location . "';</script>";
                //header("Location: $location", true, 301);
            } else {
                echo __("Ocorreu um erro ao inserir o contacto, por favor tente novamente.", 'rolopress');
                _rolo_show_contact_fields();
                //            TODO - Handle Error properly
            }
        } elseif (isset($_POST['rp_add_notes']) && $_POST['rp_add_notes'] == 'add_notes') {
            if (_rolo_save_contact_notes()) {
                echo __("Comentários adicionados com sucesso.", 'rolopress');
            } else {
                //            TODO - Handle Error properly
                echo __("Ocorreu um erro ao inserir o comentário", 'rolopress');
            }
        } else {
            _rolo_show_contact_fields();
        }
    }
}
/**
 * Template function for adding new contacts
 * @since 0.1
 */
function rolo_add_contact()
{
    $user = wp_get_current_user();
    if ($user->ID) {
        //TODO - Check user capabilites
        //TODO - Verify nounce here
        if (isset($_POST['rp_add_contact']) && $_POST['rp_add_contact'] == 'add_contact') {
            $contact_id = _rolo_save_contact_fields();
            if ($contact_id) {
                echo __("Contact information successfully added.", 'rolopress');
            } else {
                echo __("There was some problem in inserting the contact info", 'rolopress');
                //            TODO - Handle Error properly
            }
        } elseif (isset($_POST['rp_add_notes']) && $_POST['rp_add_notes'] == 'add_notes') {
            if (_rolo_save_contact_notes()) {
                echo __("Notes successfully added.", 'rolopress');
            } else {
                //            TODO - Handle Error properly
                echo __("There was some problem in inserting the notes", 'rolopress');
            }
        } else {
            _rolo_show_contact_fields();
        }
    }
}