Exemple #1
0
/**
 * @deprecated Replaced by {@link phorum_api_custom_field_restore()}.
 */
function phorum_api_custom_profile_field_restore($id)
{
    require_once PHORUM_PATH . '/include/api/custom_field.php';
    return phorum_api_custom_field_restore($id);
}
Exemple #2
0
// Create or update a custom profile field.
if (count($_POST) && $_POST['name'] != '') {
    $_POST['curr'] = $_POST['curr'] == 'NEW' ? 'NEW' : (int) $_POST['curr'];
    $_POST['field_type'] = (int) $_POST['field_type'];
    $_POST['name'] = trim($_POST['name']);
    $_POST['length'] = (int) $_POST['length'];
    $_POST['html_disabled'] = !empty($_POST['html_disabled']) ? 1 : 0;
    $_POST['show_in_admin'] = !empty($_POST['show_in_admin']) ? 1 : 0;
    // Check if there is a deleted field with the same name.
    // If this is the case, then we want to give the admin a chance
    // to restore the deleted field.
    $check = phorum_api_custom_field_byname($_POST['name'], $_POST['field_type']);
    if ($check !== FALSE && !empty($check["deleted"])) {
        // Handle restoring a deleted field.
        if (isset($_POST["restore"])) {
            if (phorum_api_custom_field_restore($check["id"]) === FALSE) {
                phorum_admin_error(phorum_api_error_message());
            } else {
                phorum_admin_okmsg("The custom field " . "\"{$check["name"]}\" has been restored.");
            }
            // Empty the POST array, so the code below won't try to
            // create or update a field.
            $_POST = array();
        } elseif (isset($_POST["create"])) {
            phorum_api_custom_field_delete($check["id"], TRUE);
        } else {
            ?>
        <div class="PhorumInfoMessage">
          <strong>Restore deleted field?</strong><br/></br>
          A previously deleted custom field with the same name
          "<?php