Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

delete_config_option()

Description

Delete entry from the user_preferences table completely (instead of setting to blank via set_config_option).
Used by system preferences page when deleting a file to allow fallback to value (if set) in config.php instead
of replacing it with blank from user_preference value.

Parameters

ColumnTypeDefaultDescription
$user_id int|null User ID. Use NULL for system wide config options.
$param_name string Parameter name

Return

bool True if preference was deleted else false.

Location

include/config_functions.php lines 176 to 213

Definition

 
function delete_config_option(?int $user_idstring $param_name) : bool
    
{
    if(empty(
$param_name))
        {
        return 
false;
        }

    
$current_param_value null;
    if(
get_config_option($user_id$param_name$current_param_value))
        {
        if(
is_null($user_id))
            {
            
$user_query 'user IS NULL';
            }
        else
            {
            
$user_query 'user = ?';
            
$params[] = 'i'$params[] = $user_id;
            }

        
$query "DELETE FROM user_preferences WHERE "$user_query ." AND parameter = ?";
        
$params[] = "s"$params[] = $param_name;

        if (
is_null($user_id))      // only log activity for system changes, i.e. when user not specified
            
{
            
log_activity(nullLOG_CODE_DELETEDnull'user_preferences''value'"parameter='" $param_name "'"null$current_param_value);
            }

        
ps_query($query,$params);

        
// Clear disk cache
        
clear_query_cache("preferences");

        return 
true;
        }

    return 
false;
    }

This article was last updated 15th December 2024 19:35 Europe/London time based on the source file dated 11th December 2024 15:55 Europe/London time.