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)

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


All times are GMT. The time now is 05:52 PM.

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.01322 seconds
  • Memory Usage 1,782KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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