Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.
Forgot Password?
Navigation

Cant get userfield to work.. or enable

Last updated on 2 years ago
D
diesltek710Junior Member
Posted 2 years ago
sample code based from irq / aim as those are similar fields i need to add to the registration... when i try to enable nothing happens and when i manually add the tables to my data base i get this error

Quote

Error: Check the files of the user field user_av_6!


<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHP Fusion Inc
| https://phpfusion.com/
+--------------------------------------------------------+
| Filename: user_av_6_include.php
| Author: Digitanium
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or >isError()) {
 $user_av_6 = isset($_POST['user_av_6']) ? stripinput($_POST['user_av_6']) : $user_av_6;
 }

 echo "<tr>n";
 echo "<td class='tbl".$this->getErrorClass("user_av_6")."'><label for='user_av_6'>".$locale['uf_icq'].$required."</label></td>n";
 echo "<td class='tbl".$this->getErrorClass("user_av_6")."'>";
 echo "<input type='text' id='user_av_6' name='user_av_6' value='".$user_av_6."' maxlength='16' class='textbox' style='width:200px;' />";
 echo "</td>n</tr>n";

 if ($required) {
 $this->setRequiredJavaScript("user_av_6", $locale['uf_icq_error']);
 }

 // Display in profile
} else if ($profile_method == "display") {
 if ($user_data['user_av_6']) {
 echo "<tr>n";
 echo "<td class='tbl1'>".$locale['uf_icq']."</td>n";
 echo "<td align='right' class='tbl1'>".$user_data['user_av_6']."</td>n";
 echo "</tr>n";
 }

 // Insert and update
} else if ($profile_method == "validate_insert" || $profile_method == "validate_update") {
 // Get input data
 if (isset($_POST['user_av_6']) && ($_POST['user_av_6'] != "" || $this->_isNotRequired("user_av_6"))) {
 if (isnum($_POST['user_av_6']) || $_POST['user_av_6'] == "") {
 // Set update or insert user data
 $this->_setDBValue("user_av_6", $_POST['user_av_6']);
 } else {
 $this->_setError("user_av_6", $locale['uf_icq_error2']);
 }
 } else {
 $this->_setError("user_av_6", $locale['uf_icq_error'], TRUE);
 }
}


<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHP Fusion Inc
| https://phpfusion.com/
+--------------------------------------------------------+
| Filename: user_icq_include_var.php
| Author: Digitanium
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or >
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) {
 die("Access Denied");
}

// Version of the user fields api
$user_field_api_version = "1.01.00";

$user_field_name = '+6 Avail.';
$user_field_desc = 'Are you availible at +6?';
$user_field_dbname = "user_av_6";
$user_field_group = 1;
$user_field_dbinfo = "VARCHAR(3) NOT NULL DEFAULT ''";
D
diesltek710Junior Member
Posted 2 years ago
I have added the colums into my database but cant even hard code the items in to register...

i am trying to make a form like the one below to update the tables i made in my user database already.
but im stuck what to do to make it update / add to my db table....

<div class="">
 <div class="">
 <h1 access="false" id="control-7207556">Stats for Eden</h1></div>
 <div class="">
 <label for="select-footmen" class="">Footmen<span class="">*</span><span class="tooltip-element" tooltip="highest footmen level you have">?</span></label>
 <select class="form-control" name="select-footmen" id="select-footmen" required="required" aria-required="true">
 <option disabled="null" selected="null">-</option>
 <option value="T7" id="select-footmen-0">T7</option>
 <option value="T8" id="select-footmen-1">T8</option>
 <option value="T9" id="select-footmen-2">T9</option>
 <option value="T10" id="select-footmen-3">T10</option>
 </select>
 </div>
 <div class="">
 <label for="select-archers" class="">Archers<span class="formbuilder-required">*</span><span class="tooltip-element" tooltip="highest archers level you have">?</span></label>
 <select class="form-control" name="select-archers" id="select-archers" required="required" aria-required="true">
 <option disabled="null" selected="null">-</option>
 <option value="T7" id="select-archers-0">T7</option>
 <option value="T8" id="select-archers-1">T8</option>
 <option value="T9" id="select-archers-2">T9</option>
 <option value="T10" id="select-archers-3">T10</option>
 </select>
 </div>
 <div class="">
 <label for="select-cavs" class="">Calvery<span class="">*</span><span class="tooltip-element" tooltip="highest calvery level you have">?</span></label>
 <select class="form-control" name="select-cavs" id="select-cavs" required="required" aria-required="true">
 <option disabled="null" selected="null">-</option>
 <option value="T7" id="select-cavs-0">T7</option>
 <option value="T8" id="select-cavs-1">T8</option>
 <option value="T9" id="select-cavs-2">T9</option>
 <option value="T10" id="select-cavs-3">T10</option>
 </select>
 </div>
 <div class="">
 <label for="number-loyalty" class="">Loyalty Level<span class="">*</span><span class="tooltip-element" tooltip="eden loyalty level">?</span></label>
 <input type="number" placeholder="0" class="form-control" name="number-loyalty" access="false" value="2000" id="number-loyalty" title="eden loyalty level" required="required" aria-required="true">
 </div>
 <div class="">
 <label for="radio-time" class="">Available Times<span class="tooltip-element" tooltip="times best for you to participate in eden">?</span></label>
 <div id='MultiSelect_container' class='sfm_multiselect element_label'>
 <ul id='MultiSelect_ul'>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='Reset'>Reset</label></li>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='+6'>+6</label></li>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='+8'>+8</label></li>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='+12'>+12</label></li>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='+16'>+16</label></li>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='+18'>+18</label></li>
 <li ><label ><input type='checkbox' name='MultiSelect[]' value='+23'>+23</label></li>
 </ul>
 </div>
 </div>
 </div>
    <div id='Submit_container' class='loading_div sfm_element_container'>
 <input type='image' name='Submit' id='Submit' alt='submit'>
 </div>
</div>


i have also included a screenshot of what my database looks like and what the output looks like. but i cant get it to work with user fileds in registration, or making a separate page to enter these fields... pleased help im on a tight deadline...
Edited by diesltek710 on 17-10-2022 19:31, 2 years ago
You do not have access to view attachments
D
diesltek710Junior Member
Posted 2 years ago
So i have managed to get the user fields to enable themselves but after i enable them i am still getting

Quote

Error: Check the files of the user field user_av_reset!


if (!defined("IN_FUSION")) {
 die("Access Denied");
}

// Display user field input
if ($profile_method == "input") {
 $user_av_reset = isset($user_data['user_av_reset']) ? stripinput($user_data['user_av_reset']) : "";
 if ($this->isError()) {
 $user_av_reset = isset($_POST['user_av_reset']) ? stripinput($_POST['user_av_reset']) : $user_av_reset;
 }

 echo "<tr>n";
 echo "<td class='tbl".$this->getErrorClass("user_av_reset")."'><label for='user_av_reset'>".$locale['uf_location'].$required."</label></td>n";
 echo "<td class='tbl".$this->getErrorClass("user_av_reset")."'>";
 echo "<input type='text' id='user_av_reset' name='user_av_reset' value='".$user_av_reset."' maxlength='50' class='textbox' style='width:200px;' />";
 echo "</td>n</tr>n";

 if ($required) {
 $this->setRequiredJavaScript("user_av_reset", $locale['uf_location_error']);
 }

 // Display in profile
} else if ($profile_method == "display") {
 if ($user_data['user_av_reset']) {
 echo "<tr>n";
 echo "<td class='tbl1'>".$locale['uf_location']."</td>n";
 echo "<td align='right' class='tbl1'>".$user_data['user_av_reset']."</td>n";
 echo "</tr>n";
 }

 // Insert and update
} else if ($profile_method == "validate_insert" || $profile_method == "validate_update") {
 // Get input data
 if (isset($_POST['user_av_reset']) && ($_POST['user_av_reset'] != "" || $this->_isNotRequired("user_av_reset"))) {
 // Set update or insert user data
 $this->_setDBValue("user_av_reset", stripinput(trim($_POST['user_av_reset'])));
 } else {
 $this->_setError("user_av_reset", $locale['uf_location_error'], TRUE);
 }
}
Edited by diesltek710 on 17-10-2022 17:13, 2 years ago
You do not have access to view attachments
D
douwe_yntemaSenior Member
Posted 2 years ago
Did you make locale files for the new userfield?
D
diesltek710Junior Member
Posted 2 years ago
no i have not. im not going to have them localized i will manually type them out in english. I just left it as is for now because im just trying to get it to work first.
D
douwe_yntemaSenior Member
Posted 2 years ago
That is your problem, you need a locale file for the description of the user field. See existing ones for an example
D
diesltek710Junior Member
Posted 2 years ago
thanks but i just tried to update it and i still have that error...
K
karrakSenior Member
Posted 2 years ago
the name of the database is user_av_6, but according to your program it asks for the name user_av_reset
but that won't be good either. do not include _ in the name. for example user_avreset_include.php
although I don't understand the above code, where does it go
Edited by karrak on 18-10-2022 11:18, 2 years ago
D
diesltek710Junior Member
Posted 2 years ago
Thank you i will try that
D
diesltek710Junior Member
Posted 2 years ago
I tried to remove the extra _ and i am stil having this issue! the tables are made in the user table but gives me an error still as seen in the screenshot. locale files are named correctly, everything is correct... still cant make it work

user_6_include_var.php
<?php

if (!defined("IN_FUSION")) {
 die("Access Denied");
}

// Version of the user fields api
$user_field_api_version = "1.01.00";

$user_field_name = '+6 Avail.';
$user_field_desc = 'Are you availible at +6?';
$user_field_dbname = "user_62";
$user_field_group = 1;
$user_field_dbinfo = "VARCHAR(3) NOT NULL DEFAULT ''";


user_6_include.php

<?php

if (!defined("IN_FUSION")) {
 die("Access Denied");
}

// Display user field input
if ($profile_method == "input") {
 $user_62 = isset($user_data['user_62']) ? $user_data['user_62'] : "";
 if ($this->isError()) {
 $user_62 = isset($_POST['user_62']) ? stripinput($_POST['user_62']) : $user_62;
 }

 echo "<tr>n";
 echo "<td class='tbl".$this->getErrorClass("user_62")."'><label for='user_62'>".$locale['uf_6'].$required."</label></td>n";
 echo "<td class='tbl".$this->getErrorClass("user_62")."'>";
 echo "<input type='text' id='user_62' name='user_62' value='".$user_62."' maxlength='3' class='textbox' style='width:200px;' />";
 echo "</td>n</tr>n";

 if ($required) {
 $this->setRequiredJavaScript("user_62", $locale['uf_6_error']);
 }

 // Display in profile
} else if ($profile_method == "display") {
 if ($user_data['user_62']) {
 echo "<tr>n";
 echo "<td class='tbl1'>".$locale['uf_6']."</td>n";
 echo "<td align='right' class='tbl1'>".$user_data['user_62']."</td>n";
 echo "</tr>n";
 }

 // Insert and update
} else if ($profile_method == "validate_insert" || $profile_method == "validate_update") {
 // Get input data
 if (isset($_POST['user_62']) && ($_POST['user_62'] != "" || $this->_isNotRequired("user_62"))) {
 if (isnum($_POST['user_62']) || $_POST['user_62'] == "") {
 // Set update or insert user data
 $this->_setDBValue("user_62", $_POST['user_62']);
 } else {
 $this->_setError("user_62", $locale['uf_6_error2']);
 }
 } else {
 $this->_setError("user_62", $locale['uf_6_error'], TRUE);
 }
}


locale user_6.php

<?php
$locale['uf_6] = "+6";
$locale['uf_6_desc'] = "+6 Avail";
$locale['uf_6_error'] = "Can not be left empty.";
$locale['uf_6_error2'] = "test.";
?>
You do not have access to view attachments
K
karrakSenior Member
Posted 2 years ago
good in principle
You do not have access to view attachments
D
diesltek710Junior Member
Posted 2 years ago
Thank you!!

that seemed to work. any idea how i can do this with check boxes? like in my form code above?

or is there a way to have a userfields category display on a different page? like update_stats.php ?
K
karrakSenior Member
Posted 2 years ago

diesltek710 wrote:

@diesltek710 -
or is there a way to have a userfields category display on a different page? like update_stats.php ?


there is none.
Edited by karrak on 20-10-2022 05:35, 2 years ago
D
douwe_yntemaSenior Member
Posted 2 years ago
I am not sure but I think then you must modify the core

You can try place them in a separate category
You can view all discussion threads in this forum.
You cannot start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You cannot download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
You cannot set up a bounty in this discussion thread.
Moderator: Support Team