1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Custom user-extended fields - work-in-progress. (experimental)

This commit is contained in:
Cameron
2016-05-05 18:51:30 -07:00
parent 01ec33cc8e
commit 1e44928e1f
4 changed files with 27 additions and 3 deletions

View File

@@ -856,6 +856,10 @@ class e107plugin
// FIXME - use sql parse handler
$error = FALSE;
$count = 0;
$sql = e107::getDb();
if($action == 'add')
{
$sql_data = file_get_contents($f);
@@ -867,7 +871,7 @@ class e107plugin
foreach($creation[0] as $tab)
{
$query = str_replace($search,$replace,$tab);
if(!mysql_query($query))
if(!$sql->gen($query))
{
$error = TRUE;
}
@@ -878,7 +882,7 @@ class e107plugin
foreach($inserts[0] as $ins)
{
$qry = str_replace($search,$replace,$ins);
if(!mysql_query($qry))
if(!$sql->gen($qry))
{
$error = TRUE;
}
@@ -894,7 +898,7 @@ class e107plugin
if($action == 'remove')
{
// executed only if the sql file exists!
return mysql_query("DROP TABLE ".MPREFIX."user_extended_".$field_name) ? true : false;
return $sql->gen("DROP TABLE ".MPREFIX."user_extended_".$field_name) ? true : false;
}
}

View File

@@ -66,6 +66,7 @@ class e107_user_extended
define('EUF_PREDEFINED',9); // should be EUF_LIST IMO
define('EUF_CHECKBOX',10);
define('EUF_PREFIELD',11); // should be EUF_PREDEFINED, useful when creating fields from e.g. plugin XML
define('EUF_ADDON', 12); // defined within e_user.php addon
$this->typeArray = array(
'text' => 1,
@@ -79,6 +80,7 @@ class e107_user_extended
'list' => 9,
'checkbox' => 10,
'predefined' => 11, // DON'T USE IT IN PREDEFINED FIELD XML!!! Used in plugin installation routine.
'addon' => 12
);
$this->user_extended_types = array(
@@ -92,6 +94,7 @@ class e107_user_extended
8 => UE_LAN_8,
9 => UE_LAN_9,
10=> UE_LAN_10
// 12=> UE_LAN_10
);
//load array with field names from main user table, so we can disallow these

View File

@@ -23,5 +23,21 @@ class _blank_user // plugin-folder + '_user'
return $var;
}
function fields()
{
$fields = array(
);
}
}

View File

@@ -25,5 +25,6 @@
</userClasses>
<extendedFields>
<field name="custom" type='EUF_TEXTAREA' default='0' active="true" />
<field name="custom2" type='EUF_ADDON' data="str" default='0' active="true" system="false" text="My Label" />
</extendedFields>
</e107Plugin>