/** * Get definitions for editable params * * @see Plugin::GetDefaultSettings() * @param local params like 'for_editing' => true */ function get_param_definitions($params) { // Load Userfield class and all fields: load_class('users/model/_userfield.class.php', 'Userfield'); $UserFieldCache =& get_UserFieldCache(); $UserFieldCache->load_all(); $user_fields = array(); foreach ($UserFieldCache->cache as $UserField) { $user_fields[$UserField->get('code')] = $UserField->get_name(); } $r = array_merge(array('title' => array('label' => T_('Block title'), 'note' => T_('Title to display in your skin.'), 'size' => 40, 'defaultvalue' => T_('Our Awesome Team')), 'org_ID' => array('label' => T_('Organization ID'), 'note' => sprintf(T_('ID of the <a %s>organization</a> to display.'), 'href="?ctrl=organizations"'), 'type' => 'integer', 'size' => 3, 'defaultvalue' => 1), 'link_profile' => array('label' => T_('Link to profile'), 'note' => T_('Check this to link each user to his profile.'), 'type' => 'checkbox', 'defaultvalue' => 1), 'display_icons' => array('label' => T_('Contact icons'), 'note' => T_('Check this to display icons for User Field URLs with an icon.'), 'type' => 'checkbox', 'defaultvalue' => 1), 'icon_colors' => array('label' => T_('Icon color'), 'type' => 'checklist', 'options' => array(array('text', T_('Use for normal text'), 0), array('bg', T_('Use for normal background'), 0), array('hovertext', T_('Use for hover text'), 0), array('hoverbg', T_('Use for hover background'), 1))), 'field_code' => array('label' => T_('Extra Info Field'), 'note' => T_('Select what extra user field should be displayed.'), 'type' => 'select', 'options' => array('' => T_('None')) + $user_fields, 'defaultvalue' => 'microbio'), 'field_extra_lines' => array('label' => T_('Lines of extra info'), 'note' => T_('Use this to keep contact cards aligned.'), 'defaultvalue' => '2')), parent::get_param_definitions($params)); return $r; }
} // Load Userfield class: load_class('users/model/_userfield.class.php', 'Userfield'); /** * @var User */ global $current_User; // Check minimum permission: $current_User->check_perm('users', 'view', true); // Set options path: $AdminUI->set_path('users', 'usersettings', 'userfields'); // Get action parameter from request: param_action(); if (param('ufdf_ID', 'integer', '', true)) { // Load userfield from cache: $UserfieldCache =& get_UserFieldCache(); if (($edited_Userfield =& $UserfieldCache->get_by_ID($ufdf_ID, false)) === false) { // We could not find the user field to edit: unset($edited_Userfield); forget_param('ufdf_ID'); $Messages->add(sprintf(T_('Requested «%s» object does not exist any longer.'), T_('User field')), 'error'); $action = 'nil'; } } switch ($action) { case 'new': // Check permission: $current_User->check_perm('users', 'edit', true); if (!isset($edited_Userfield)) { // We don't have a model to use, start with blank object: $edited_Userfield = new Userfield();