Elgg  Version 2.3
delete.php
Go to the documentation of this file.
1 <?php
7 $id = get_input('id');
8 if (!is_numeric($id)) {
9  return elgg_error_response(elgg_echo('profile:editdefault:delete:fail'));
10 }
11 
12 $fieldlist = elgg_get_config('profile_custom_fields');
13 if (!$fieldlist) {
14  $fieldlist = '';
15 }
16 
17 $fieldlist = str_replace("{$id},", "", $fieldlist);
18 $fieldlist = str_replace(",{$id}", "", $fieldlist);
19 $fieldlist = str_replace("{$id}", "", $fieldlist);
20 
21 if (unset_config("admin_defined_profile_$id") &&
22  unset_config("admin_defined_profile_type_$id") &&
23  elgg_save_config('profile_custom_fields', $fieldlist)) {
24 
25  return elgg_ok_response('', elgg_echo('profile:editdefault:delete:success'));
26 }
27 
28 return elgg_error_response(elgg_echo('profile:editdefault:delete:fail'));
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
unset_config($name, $site_guid=0)
Removes a config setting.
elgg_save_config($name, $value, $site_guid=0)
Save a configuration setting.
if(!is_numeric($id)) $fieldlist
Definition: delete.php:12
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
elgg_error_response($error= '', $forward_url=REFERRER, $status_code=ELGG_HTTP_OK)
Prepare an error response to be returned by a page or an action handler.
$id
Elgg profile plugin edit default profile action removal.
Definition: delete.php:7
elgg_ok_response($content= '', $message= '', $forward_url=null, $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.