1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 05:11:42 +02:00

Added e_user.php 'settings' method to define additional (extended) user fields dynamically. See _blank/e_user.php

This commit is contained in:
Cameron
2021-01-18 18:10:00 -08:00
parent 3ee52f0cbe
commit 8f27be1150
9 changed files with 289 additions and 23 deletions

View File

@@ -24,6 +24,22 @@ class _blank_user // plugin-folder + '_user'
return $var;
}
/**
* The same field format as admin-ui, with the addition of 'fieldType', 'read', 'write', 'appliable' and 'required' as used in extended fields table.
*
* @return array
*/
function settings()
{
$fields = array();
$fields['field1'] = array('title' => "Field 1", 'fieldType' => 'varchar(30)', 'read'=> e_UC_ADMIN, 'write'=>e_UC_MEMBER, 'type' => 'text', 'writeParms' => array('size' => 'xxlarge'));
$fields['field2'] = array('title' => "Field 2", 'fieldType' => 'int(2)', 'type' => 'number', 'data'=>'int');
$fields['field3'] = array('title' => "Field 3", 'fieldType' => 'int(1)', 'type' => 'method', 'data'=>'str', 'required'=>true); // see below.
return $fields;
}
/**
* Experimental and subject to change without notice.
@@ -54,4 +70,17 @@ class _blank_user // plugin-folder + '_user'
}
// (plugin-folder)_user_form - only required when using custom methods.
class _blank_user_form extends e_form
{
// user_plugin_(plugin-folder)_(fieldname)
public function user_plugin__blank_field3($curVal, $mode, $att=array())
{
$opts = array(1,2,3,4);
return $this->select('user_plugin__blank_field3', $opts, $curVal);
}
}