Author Topic: Problem Adding Extra Fields  (Read 20873 times)

0 Members and 1 Guest are viewing this topic.

Offline halobender

  • Pre-Newbie
  • Posts: 3
    • View Profile
Problem Adding Extra Fields
« on: October 13, 2005, 05:45:50 AM »
Hi,

I have been trying to add additional fields to the user profile; I have managed to get the fields to show up in the control panel, but the information I type into them will not save. (For example, I am trying to insert a field where a user can type a small bio about themselves. I enter the text, click Save in my control panel, but the info does not show up.) There are so many things that might need adjusting, and I need help.


I HAVE... added the directory to my database:
Code: [Select]
4images_users -> user_bio  tinyint(1) notnull  default 0
I HAVE... modified my /includes/db_field_definitions.php to include this field:
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
$additional_user_fields['user_bio'] = array($lang['user_bio'], "text", 0);

I have made sure that there are no spaces after ?>

I HAVE... modified my /templates/custom/member_edit.html file:
Code: [Select]
          <tr>
    <td class="row2"><b>{lang_bio}</b></td>
<td class="row2"><input type="text" name="user_bio"  size="30" value="{user_bio}" class="input" /></td>

</tr>

I HAVE... edited my /templates/custom/register_form.html file:
Code: [Select]
<tr>
    <td class="row1"><b>{lang_user_bio}</b></td>
<td class="row1"><input type="text" name="user_bio" size="30" class="input" value="{user_bio}" /></td>
</tr>

I HAVE... edited my /lang/english/main.php file:
Code: [Select]
//--- Users ------------------------------------------- (...) $lang['bio'] = "Bio:";
I HAVE... edited my /templates/custom/member_profile.html file:
Code: [Select]
<tr>
    <td class="row2"><b>{user_bio}</b></td>
<td class="row2">{user_bio} </td>
</tr>



It's very confusing, editing all of these files. I do not know what is going wrong, so I do not know what I need to fix. Please help. Does anyone know what I might be doing wrong? I will answer all questions asked (maybe not immediately) but I will.

Thanks so much

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Problem Adding Extra Fields
« Reply #1 on: October 13, 2005, 06:36:20 AM »
1)
Quote
user_bio  tinyint(1) notnull  default 0
is a wrong type of field for this purpose
You either need VARCHAR(255) or TEXT type of the field.

2)
Code: [Select]
if (!defined('ROOT_PATH')) {
  die("Security violation");
$additional_user_fields['user_bio'] = array($lang['user_bio'], "text", 0);
I hope it doesnt look like this in your file, your new entry should be just above closing ?>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline halobender

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Problem Adding Extra Fields
« Reply #2 on: October 13, 2005, 11:46:44 PM »
Thanks very much! That got things working. :D


One other small thing: how do I resize an input field to make it taller (this is for the bio information a user can enter in their control panel, which can contain up to 255 characters) and make it so that the field has an option for a scrollbar (if necessary). Does that need a special TEXTAREA tag/setting in my database?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Problem Adding Extra Fields
« Reply #3 on: October 14, 2005, 12:05:15 AM »
not in the database, but in the template where you have this field (textarea)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline halobender

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Problem Adding Extra Fields
« Reply #4 on: October 14, 2005, 12:19:14 AM »
I've tried that, but it won't save the information I put into the field (I just know for a fact there's something wrong with this code, but I don't know how to fix it). Here is what I am typing in my member_editprofile.html file:

Code: [Select]
<td class="row2"><b>{lang_user_bio}</b></td>
<td class="row2"><TEXTAREA name="user_bio" cols="23" rows="5" value="{user_bio}" class="input" /></textarea></td>



EDIT: It won't show the bio text after I type it in the field and submit it, but when I click on my profile from the main gallery page, the information is there in my profile. Weird. My setting for this field in my database is VARCHAR(255).

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Problem Adding Extra Fields
« Reply #5 on: October 14, 2005, 12:29:54 AM »
you must add {user_bio} between <textarea> and </textarea> not as value="" ;)

Code: [Select]
<TEXTAREA name="user_bio" cols="23" rows="5" class="input" />{user_bio}</textarea>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #6 on: January 28, 2006, 12:47:00 AM »
DB Error: Bad SQL Query: INSERT INTO 4images_users (user_id, user_level, user_name, user_password, user_email, user_showemail, user_allowemails, user_invisible, user_joindate, user_activationkey, user_lastaction, user_lastvisit, user_comments, user_homepage, user_icq, user_limit, user_bio) VALUES (2147483648, 2, '56', '9f61408e3afb633e50cdf1b20de6f466', '56@mail.ru', 1, 1, 0, 1138404708, 'e3e19611643411ef5e21e808afbf55ba', 1138404708, 1138404708, 0, '', '', 5, 'tyhjh')
Duplicate entry '2147483647' for key 1

У меня такая проблема , что это может быть за двойной вход и как его исправить :?: :D Плиз... подскажите...

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #7 on: January 30, 2006, 03:01:40 PM »
Как вывести  {user_bio}{lang_user_bio} на страничке   details.html .   Если я их просто вставляю туда то они не отображаются. Подскажите пожалуйста что нужно сделать :?:

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #8 on: January 30, 2006, 04:45:48 PM »
Как вывести  {user_bio}{lang_user_bio} на страничке   details.html .   Если я их просто вставляю туда то они не отображаются. Подскажите пожалуйста что нужно сделать :?:
Ведь в профиле город появляется а почему details.html нет :?:

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #9 on: January 30, 2006, 06:55:32 PM »
V@no   Подскажите как специалист :D

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #10 on: January 31, 2006, 01:44:39 PM »
 :?: :cry:

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #11 on: January 31, 2006, 01:46:43 PM »
 :?: :cry:

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #12 on: January 31, 2006, 04:17:12 PM »
Неужели мне никто не поможет :?:

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Problem Adding Extra Fields
« Reply #13 on: January 31, 2006, 04:44:33 PM »
Quote

Duplicate entry '2147483647' for key 1


@Alex_Ok:

The problem is that you already have this entry in your users table and cannot be added twice. If you're trying to make any corrections on that table, make sure to backup it up first, then to empty your table. Then, execute the SQL query from your mysql_default.sql file. ;)

Offline Alex_Ok

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Problem Adding Extra Fields
« Reply #14 on: February 05, 2006, 08:07:58 AM »
Как вывести  {user_bio}{lang_user_bio} на страничке   details.html .   Если я их просто вставляю туда то они не отображаются. Подскажите пожалуйста что нужно сделать