From 1e44928e1f58b74ebe128597f88e6eda279d1850 Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 5 May 2016 18:51:30 -0700 Subject: [PATCH] Custom user-extended fields - work-in-progress. (experimental) --- e107_handlers/plugin_class.php | 10 +++++++--- e107_handlers/user_extended_class.php | 3 +++ e107_plugins/_blank/e_user.php | 16 ++++++++++++++++ e107_plugins/_blank/plugin.xml | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 90096a2d9..e2b764176 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -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; } } diff --git a/e107_handlers/user_extended_class.php b/e107_handlers/user_extended_class.php index e314b19f4..077a9cba6 100644 --- a/e107_handlers/user_extended_class.php +++ b/e107_handlers/user_extended_class.php @@ -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 diff --git a/e107_plugins/_blank/e_user.php b/e107_plugins/_blank/e_user.php index 4551652ed..546355081 100644 --- a/e107_plugins/_blank/e_user.php +++ b/e107_plugins/_blank/e_user.php @@ -23,5 +23,21 @@ class _blank_user // plugin-folder + '_user' return $var; } + + + + function fields() + { + + $fields = array( + + + + ); + + + } + + } \ No newline at end of file diff --git a/e107_plugins/_blank/plugin.xml b/e107_plugins/_blank/plugin.xml index 8e8abd3d7..ad207e74f 100644 --- a/e107_plugins/_blank/plugin.xml +++ b/e107_plugins/_blank/plugin.xml @@ -25,5 +25,6 @@ +