Example #1
0
/**
 * Set value of specific user configuration option
 *
 * @param string $option_name
 * @param mixed $value
 * @param int $user_id User Id, if null logged user is taken
 * @return boolean
 */
function set_user_config_option($option_name, $value, $user_id = null ) {
	$config_option = ContactConfigOptions::getByName($option_name);
	if(!($config_option instanceof ContactConfigOption)) {
		return false;
	}
	$config_option->setContactValue($value, $user_id);
	
	// update cache if available
	if (GlobalCache::isAvailable()) {
		GlobalCache::update('user_config_option_'.$user_id.'_'.$option_name, $value);
	}
	
	return $config_option->save();
} // set_config_option
 /**
  * Remove Getting Started widget from dashboard
  *
  */
 function remove_getting_started_widget()
 {
     try {
         DB::beginWork();
         $option = ContactConfigOptions::getByName('show getting started widget');
         $option->setUserValue(0, logged_user()->getId());
         $option->save();
         DB::commit();
         ajx_current('reload');
     } catch (Exception $ex) {
         DB::rollback();
     }
 }
Example #3
0
echo $genid;
?>
eventAttachNotification" style="margin: 3px; float: left;" 
					<?php 
echo array_var($file_data, 'attach_to_notification', user_config_option('attach_to_notification')) ? 'checked="checked"' : '';
?>
/>
				<label for="<?php 
echo $genid;
?>
eventAttachNotification" class="checkbox"><?php 
echo lang('attach to notification');
?>
</label>
				<?php 
if (ContactConfigOptions::getByName('notify_myself_too') instanceof ContactConfigOption) {
    ?>
							
				<input type="checkbox" name="file[notify_myself_too]" id="<?php 
    echo $genid;
    ?>
notifyMyselfToo" style="margin: 3px 3px 3px 15px; float: left;"
					<?php 
    echo user_config_option('notify_myself_too') ? 'checked="checked"' : '';
    ?>
/>
				<label for="<?php 
    echo $genid;
    ?>
notifyMyselfToo" class="checkbox"><?php 
    echo lang('notify myself too');