vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Add a select field to the profile (https://vborg.vbsupport.ru/showthread.php?t=21833)

Birdie501 07-05-2002 05:26 AM

Thanks! Now i am still waiting for a new release supporting drop down fields :)

Ryangel 07-18-2002 03:56 PM

Brilliant Hack ! :)

*installs* ... opps time to sleep ...

Ryangel 07-18-2002 03:58 PM

Quote:

Originally posted by Birdie501
Thanks! Now i am still waiting for a new release supporting drop down fields :)
hmm drop down fields? I believe if you want a single drop down box you just change the "field length" to "1" .

Maybe I'm misunderstanding the question ... hmm.

Vivi Ornitier 08-11-2002 05:54 PM

I'm not sure if anyone else is having this probelm but when i installed this hack and added all the custom fields. When a user goes into their profile and edits something, it's all good. But when they go and edit again, they have to re-enter everything over again and all the saved fields before are totally gone. Any suggestions?

Vivi Ornitier 08-11-2002 06:09 PM

and instead of telling us how to generate a text file from vbhacker, can someone just generate the text file and post it?

Sion 11-21-2002 02:30 PM

Warning: fopen("profile/5.file", "w") - No such file or directory in /home/amateur/public_html/uwc/admin/adminfunctions.php on line 156

Warning: fwrite(): supplied argument is not a valid File-Handle resource in /home/amateur/public_html/uwc/admin/adminfunctions.php on line 158

Warning: fclose(): supplied argument is not a valid File-Handle resource in /home/amateur/public_html/uwc/admin/adminfunctions.php on line 160

I get these errors, please help!

Sion 11-21-2002 02:49 PM

I can't seem to get vBhacker working properly, any1 mind posting the txt file of the latest one, please!

BigJohnson 01-26-2003 09:50 AM

so when are u going to fix this so it shows up correctly in the admin user file like u said u were. U didint add the user modifications to this for the new vbhacker version u releleased. Please help.

TheComputerGuy 01-26-2003 01:07 PM

Here is a TXT file

Personally, I am going to uninstall this file.

geniuscrew 02-05-2003 07:01 PM

Quote:

Originally posted by Ryangel


hmm drop down fields? I believe if you want a single drop down box you just change the "field length" to "1" .

Maybe I'm misunderstanding the question ... hmm.


Nope - you're right :)

Changing the "field length" to 1, makes it a drop down box :)

Working brilliantly on 2.2.9!

Nomb 02-24-2003 09:00 PM

I have this hack installed and it's working great!! I have the code for the admin cp but not in front of me right now. I?ll post a new text file with the corrections. :D

EDIT Erwin helped me solve my form issues, unrealted to this hack.

Nomb 02-27-2003 06:12 PM

I got my form problems worked out thanks to Erwin in the php forum. :D

Anyway, if you want your newly created fields to show up in the admin cp correctly, aka, dropdowns and radios actually come up that way instead of plain old text boxes I've got the code.

See my attachment below. I updated Mutt's second revision to the hack. The one that stores everything in the database, the way it should be done. The new text file shows how to alter your admin/user.php file to reflect your new fields.

Also, I made the small addition that mayja pointed out so the fields are saved. It was a minor query error.

I think you can call it final now, no more bugs. Course, I'm working on adding checkboxes. :banana:

BTW, all this is working for me on 2.2.8

Nomb 02-28-2003 06:41 AM

I found one more small bug that wasn't displaying the type dropdown correctly when editting a field in the admin cp. It's fixed and the attachment in the above post has been updated.

Doing these checkboxes isn't easy! I'm close though.

I wonder if they're including this in vB3. Hope so!

boutwell 02-28-2003 06:29 PM

Hmmm....I just (re)installed this on version 2.3.0 and everythign is working fine except for none of the cutom fields are showing up in the user's control panel where they edit their profiles. They are showing up on the registration pages and in the admin CP...anyone know what may be the problem?

Would that be an error in member.php or a template of some sort?

TheComputerGuy 02-28-2003 11:14 PM

Look in the "modifyprofile" edit "$customfields" with $customfield I believe...not tested yet...

Nomb 03-03-2003 01:01 AM

Quote:

Originally posted by boutwell
Hmmm....I just (re)installed this on version 2.3.0 and everythign is working fine except for none of the cutom fields are showing up in the user's control panel where they edit their profiles. They are showing up on the registration pages and in the admin CP...anyone know what may be the problem?

Would that be an error in member.php or a template of some sort?

That would be an error in member.php, not sure what though.

This could all be part of a small change they made in 2.3.0, not sure because I'm using 2.2.8. Post what you edited and then also post the query that updates the mysql with the custom fields.

007 03-17-2003 08:49 PM

Hey Nomb did you get the checkboxes code working yet?

danglick 03-24-2003 04:24 PM

The user.php code has a couple of errors. In both the 'add user' and the 'edit user' code, the fields are pre-filled with the values of the administrator's profile fields, rather than the user's (or blank in the case of a new record).

Nomb, I'm sure you can figure out how to fix it; but if you'd like me to send you the corrected code I'm using on my site, let me know.

DigitalDesktops 03-25-2003 02:18 AM

i'm still having problems with this. The custom field options won't show up in the User CP. I'm using 2.3.0. The Only thing that was different in the readme was this:

User.php

In my User.php(Line 295) :

PHP Code:

  maketableheader("Custom Profile Fields");
  
$userfield=$DB_site->query_first("SELECT * FROM userfield WHERE userid=$userid");

  
$profilefields=$DB_site->query("SELECT profilefieldid,title FROM profilefield");
  while (
$profilefield=$DB_site->fetch_array($profilefields)) {
    
$varname="field$profilefield[profilefieldid]";
    
makeinputcode($profilefield[title],"field".$profilefield[profilefieldid],$userfield[$varname]);
  }

  
doformfooter("Save Changes");

}

// ###################### Start do update ####################### 

In customfileds.txt posted by Nomb it says to replace this code:
PHP Code:

  maketableheader("Custom Profile Fields");
  
$profilefields=$DB_site->query("SELECT profilefieldid,title FROM profilefield");
  while (
$profilefield=$DB_site->fetch_array($profilefields)) {
    
makeinputcode($profilefield[title],"field".$profilefield[profilefieldid]);
  } 

with this code
PHP Code:

    // new options
    
    
maketableheader("Custom Profile Fields");
    
$profilefields=$DB_site->query("SELECT *
                                    FROM profilefield
                                    WHERE editable = 1
                                    ORDER BY displayorder"
);
    while (
$profilefield=$DB_site->fetch_array($profilefields)) {
      
$profilefieldname="field$profilefield[profilefieldid]";
      if (
$bgcolor=="#13486D") {
        
$bgcolor="#1C5780";
      } else {
        
$bgcolor="#13486D";
      }
      
// new options
      
$TheField="";
      
$optionlines explode(','$profilefield[options]);
      
$option_bit=$optionlines[0];
      if (
$profilefield[type]==1) {
          
// radio
          
while ($option_bit) {
              
$option_bit=trim($option_bit);
              if (
$option_bit == $bbuserinfo[$profilefieldname]) { $LocOn "checked"; } else { $LocOn ""; }
              
$TheField .= "<input type=\"radio\" name=\"$profilefieldname\" value=\"$option_bit\" $LocOn$option_bit ";
              
$option_bit=next($optionlines);
          }
      } elseif (
$profilefield[type]==2) {
          
// select
          
$TheField "<select size=\"$profilefield[size]\" name=\"$profilefieldname\">";
          while (
$option_bit) {
              
$option_bit=trim($option_bit);
              if (
$option_bit == $bbuserinfo[$profilefieldname]) { $LocOn "selected"; } else { $LocOn ""; }
              
$TheField .= "<option value=\"$option_bit\" $LocOn>$option_bit</option>";
              
$option_bit=next($optionlines);
          }
          
$TheField .= "</select>";
      } elseif (
$profilefield[type]==3) {
          
// textarea
          
$bbuserinfo[$profilefieldname]=htmlspecialchars($bbuserinfo[$profilefieldname] );
          
$TheField "<textarea name=\"$profilefieldname\" rows=\"6\" cols=\"40\" wrap=\"physical\">$bbuserinfo[$profilefieldname]</textarea>";
      } else {
          
$TheField="<input type=\"text\" class=\"bginput\" name=\"$profilefieldname\" value=\"$bbuserinfo[$profilefieldname]\" size=\"$profilefield[size]\" maxlength=\"$profilefield[maxlength]\">";
       }
    
makelabelcode($profilefield[title],$TheField);
    }
    
    
// new options 

Can anyone help me with this?

TMM 04-08-2003 12:24 PM

Looks very interesting :)

Has anyone tried Nomb's latest in 2.2.9? Danglick, maybe you could post the corrected code here...?

Also, could this be made to work with Firefly's lite registration hack?

Thanks,

TMM

lange 04-25-2003 04:07 AM

Version 2.3.0.

I'm using the Nomb's attachment (customfields.txt).

I have the same problen than DigitalDesktops. In user.php, the code is not the same than in 2.2.8.

lange 04-25-2003 06:33 PM

Anyone got it in 2.30 ?

geniuscrew 04-28-2003 11:15 PM

I'm getting errors with 2.3.0 also :/

DigitalDesktops 04-28-2003 11:21 PM

I got it working on 2.3.0. :)
Run the hack on VBhacker, then Insert the missing steps into the files, and it should work. :D

Keyser S?ze 05-04-2003 09:15 PM

i guess most everyone is having the same problem i am with 2.3.0 and this hack :(


if anyone knows how to fix it a updated install txt would be great :)

Falkware 05-05-2003 07:36 PM

using this hack on 2.3.0 and it seems to work fine with the exception of one problem.

If I have a custom field and check it to be a Required field it will not show up in User CP under Edit Profile for whatever reason.

Can somebody give me any pointers on how to get required custom fields to show up in User CP/Edit Profile on v2.3.0?

Thanks.

OmaniMan 05-11-2003 07:50 AM

What A Wonderful Hack :rambo:

Keyser S?ze 05-13-2003 01:00 AM

i got this working in 2.3.0 with so far no errors


i dont use vbhacker, try this, in admin/profilefeild

it says find this
PHP Code:

$DB_site->query("INSERT INTO profilefield (profilefieldid,title,description,required,hidden,maxlength,size,displayorder,editable) VALUES (NULL,'".addslashes($title)."','".addslashes($description)."',$required,$hidden,'$maxlength','$size','$displayorder','$editable')"); 

but its not there, search for this instead
PHP Code:

$DB_site->query("INSERT INTO profilefield 

i think its about line 40, copy the entire line, and replace it with this

PHP Code:

$DB_site->query("INSERT INTO profilefield (profilefieldid,title,description,required,hidden,maxlength,size,displayorder,editable,type,options) VALUES (NULL,'".addslashes($title)."','".addslashes($description)."',$required,$hidden,'$maxlength','$size','$displayorder', '$editable',$type,'".addslashes($options)."')"); 


further down we have another thats like this in the same php file, it ask u to find this
PHP Code:

$DB_site->query("UPDATE profilefield SET title='".addslashes($title)."',description='".addslashes($description)."',required=$required,hidden=$hidden,maxlength='$maxlength',size='$size',displayorder='$displayorder',editable='$editable' WHERE profilefieldid=$profilefieldid"); 

but again it is not there, so instead search for this
PHP Code:

$DB_site->query("UPDATE profilefield SET 

copy the entire line, (close to line 100)

and replace it with this

PHP Code:

 $DB_site->query("UPDATE profilefield SET title='".addslashes($title)."',description='".addslashes($description)."',required=$required,hidden=$hidden,maxlength='$maxlength',size='$size',displayorder='$displayorder',editable='$editable',type=$type,options='".addslashes($options)."' WHERE profilefieldid=$profilefieldid"); 

besides that use Nombs attachment and this should work fine in 2.3.0

if anyone gets the checkboxes working id love it!

Hamma 05-22-2003 01:26 AM

I've got 2.3.0 what is the most updated file i should install?

Keyser S?ze 05-22-2003 01:48 AM

this attached instructions will work in vb 2.3.0 perfectly :)

just a little update is all


dont use this for any other version other than 2.3.0, use the others

use this for 2.2.8 and i think 2.2.9 https://vborg.vbsupport.ru/showthrea...=&pagenumber=7

Hamma 05-22-2003 02:23 AM

Thanks :D I did the original code on the first page and it worked. I will make the tweaks from your file as well ;)

edit: i forgot im running 2.2.7 lol

Falkware 06-04-2003 04:54 PM

I've got this working fine on v2.3.0 using the files attached here and the recent fixes. Thanks all!

However, I have the same problem as danglick. When an Admin goes to edit a user's profile within Admin CP the custom fields are pre-filled with the values of the administrator's custom profile fields, rather than the user's values (or blank in the case of a new record).

Is there any way to stop it from doing this, and show the user's value instead?

Nomb 06-04-2003 07:42 PM

Quote:

Today at 11:54 AM Falkware said this in Post #112
I've got this working fine on v2.3.0 using the files attached here and the recent fixes. Thanks all!

However, I have the same problem as danglick. When an Admin goes to edit a user's profile within Admin CP the custom fields are pre-filled with the values of the administrator's custom profile fields, rather than the user's values (or blank in the case of a new record).

Is there any way to stop it from doing this, and show the user's value instead?

If you're using my hack for admin/user.php ... there is an error as described above.

In admin/user.php

Find This (The Code from my txt file):

PHP Code:

// new options
    
    
maketableheader("Custom Profile Fields");
    
$profilefields=$DB_site->query("SELECT *
                                    FROM profilefield
                                    WHERE editable = 1
                                    ORDER BY displayorder"
);
    while (
$profilefield=$DB_site->fetch_array($profilefields)) {
      
$profilefieldname="field$profilefield[profilefieldid]";
      if (
$bgcolor=="{firstaltcolor}") {
        
$bgcolor="{secondaltcolor}";
      } else {
        
$bgcolor="{firstaltcolor}";
      }
      
// new options
      
$TheField="";
      
$optionlines explode(','$profilefield[options]);
      
$option_bit=$optionlines[0];
      if (
$profilefield[type]==1) {
          
// radio
          
while ($option_bit) {
              
$option_bit=trim($option_bit);
              if (
$option_bit == $bbuserinfo[$profilefieldname]) { $LocOn "checked"; } else { $LocOn ""; }
              
$TheField .= "<input type=\"radio\" name=\"$profilefieldname\" value=\"$option_bit\" $LocOn$option_bit ";
              
$option_bit=next($optionlines);
          }
      } elseif (
$profilefield[type]==2) {
          
// select
          
$TheField "<select size=\"$profilefield[size]\" name=\"$profilefieldname\">";
          while (
$option_bit) {
              
$option_bit=trim($option_bit);
              if (
$option_bit == $bbuserinfo[$profilefieldname]) { $LocOn "selected"; } else { $LocOn ""; }
              
$TheField .= "<option value=\"$option_bit\" $LocOn>$option_bit</option>";
              
$option_bit=next($optionlines);
          }
          
$TheField .= "</select>";
      } elseif (
$profilefield[type]==3) {
          
// textarea
          
$bbuserinfo[$profilefieldname]=htmlspecialchars($bbuserinfo[$profilefieldname] );
          
$TheField "<textarea name=\"$profilefieldname\" rows=\"6\" cols=\"40\" wrap=\"physical\">$bbuserinfo[$profilefieldname]</textarea>";
      } else {
          
$TheField="<input type=\"text\" class=\"bginput\" name=\"$profilefieldname\" value=\"$bbuserinfo[$profilefieldname]\" size=\"$profilefield[size]\" maxlength=\"$profilefield[maxlength]\">";
       }
    
makelabelcode($profilefield[title],$TheField);
    }
    
    
// new options 

Replace it with this:

PHP Code:

    // new options
    
    
maketableheader("Custom Profile Fields");
    
$profilefields=$DB_site->query("SELECT *
                                    FROM profilefield
                                    WHERE editable = 1
                                    ORDER BY displayorder"
);
    while (
$profilefield=$DB_site->fetch_array($profilefields)) {
      
$profilefieldname="field$profilefield[profilefieldid]";
      if (
$bgcolor=="{firstaltcolor}") {
        
$bgcolor="{secondaltcolor}";
      } else {
        
$bgcolor="{firstaltcolor}";
      }
      
// new options
      
$TheField="";
      
$optionlines explode(','$profilefield[options]);
      
$option_bit=$optionlines[0];
      if (
$profilefield[type]==1) {
          
// radio
          
while ($option_bit) {
              
$option_bit=trim($option_bit);
              if (
$option_bit == $userfield[$profilefieldname]) { $LocOn "checked"; } else { $LocOn ""; }
              
$TheField .= "<input type=\"radio\" name=\"$profilefieldname\" value=\"$option_bit\" $LocOn$option_bit ";
              
$option_bit=next($optionlines);
          }
      } elseif (
$profilefield[type]==2) {
          
// select
          
$TheField "<select size=\"$profilefield[size]\" name=\"$profilefieldname\">";
          while (
$option_bit) {
              
$option_bit=trim($option_bit);
              if (
$option_bit == $userfield[$profilefieldname]) { $LocOn "selected"; } else { $LocOn ""; }
              
$TheField .= "<option value=\"$option_bit\" $LocOn>$option_bit</option>";
              
$option_bit=next($optionlines);
          }
          
$TheField .= "</select>";
      } elseif (
$profilefield[type]==3) {
          
// textarea
          
$userfield[$profilefieldname]=htmlspecialchars($userfield[$profilefieldname] );
          
$TheField "<textarea name=\"$profilefieldname\" rows=\"6\" cols=\"40\" wrap=\"physical\">$userfield[$profilefieldname]</textarea>";
      } else {
          
$TheField="<input type=\"text\" class=\"bginput\" name=\"$profilefieldname\" value=\"$userfield[$profilefieldname]\" size=\"$profilefield[size]\" maxlength=\"$profilefield[maxlength]\">";
       }
    
makelabelcode($profilefield[title],$TheField);
    }
    
    
// new options 

Basically, all the instances of $bbuserinfo have been changed to $userfield which is from the query above this block of code in user.php.

Remember to replace this twice.

tomjinx1 06-11-2003 06:24 PM

Two quickies Mutt...

This is a really good hack and I will definitely use it. However, I am having a couple of problems that will be the deciding factor.

First off is this. After saving a custom profile field with Select Box and then going back into it, the text that was entered into the textarea is gone and it has to be typed in again... Is there a way to fix this?

The last thing is a TextArea box selection. I use some boxes where the user must fill one of these out and unfortunately a straight line doesn't cut it. Is it possible to add one of these as a type where it uses height as rows and width as column?

Thanks in advance...

Tommy

tomjinx1 06-13-2003 01:01 PM

Nomb and IceMalee - you guys solve my first problem....

Now for the textarea box, I have finally coded it in and it seems to be working for me. If anyone wants the coding, please let me know and I will post it here...

Tom

tomjinx1 06-13-2003 05:50 PM

File deleted due to it having some major bugs...

If someone could make it to where we could choose textarea boxes I would really appreciate it...

Thanks

Falkware 06-14-2003 03:24 PM

Nomb, thanks for the update man. I applied it to my files and it removed the issue where it replaced the users value with my own when editing a profile in admin when a user has a select field.

However...

Instead of showing the users value now it shows the first value on the list instead.

Is there any way to make the select box retain the users chosen value even when an admin is in their profile through Admin CP?

tomjinx1 06-14-2003 06:57 PM

I had a dream last night and in that dream I was updating the coding for this stupid (not really) hack.

I am now within a few more minutes of coding before we have Radio Buttons, Select Boxes (dropdowns), Standard Text Lines, and my contribution TEXTAREA boxes.

It's been a pain, especially since I no nothing about PHP. But I'm learning fast.

The problem before was that I had the text area boxes for registration but everything else was blank..

I have however fixed that problem and I just have to recode a little on the user.php file...

If you interested in this I will have it posted in just a little bit...

Tom

tomjinx1 06-14-2003 10:55 PM

Ok, I'm very close but I need a little help on one thing.

Right now I have it where it creates the textarea by the size and maxlength entries. Everything works fine. The Standard Text, Radio Buttons, and Select Boxes hold their information however the textarea box doesn't....

Anybody wanna help me out here?

tomjinx1 06-18-2003 01:11 AM

Everything is going smoothly however I don't think anyone cares.

I need help from someone here. I have everything working great with the script above and a few modifications to the profilefield.php file. However, I need help on 2 things. The members.php file and the user.php file.

When you go to a users profile in AdminCP or if you go to Edit Profile under the UserCP, if you have a field selected as not editable by user, then it completely hides that field, from the User AND the Admin.

Can someone tell me how to get it to where the Admin can see it?

Tom


All times are GMT. The time now is 02:39 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01743 seconds
  • Memory Usage 1,949KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (11)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete