Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases

Reply
 
Thread Tools
Details »»

Version: , by Mutt Mutt is offline
Developer Last Online: Mar 2013 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 07-02-2001 Last Update: Never Installs: 29
 
No support by the author.

Hey there

I'm still trying to learn all of this and damn this is cool ****. Anyway, I installed the gender hack and was going to use it to install another profile select box. Then I saw the very cool CP tool for adding a field to the profile. It currently only allows you to add a input box. I decieded to modify it so I could add my select box from there. It wasn't very hard and the hack is pretty short.


Here it is in a nutshell
I added a textarea field to the add/edit profile field
if you want the new field to be a dropdown, you enter the dropdown values. each line represents a new option tag.

Ex. you want a new field called "sex" that is a drop down with
the choices male,female, and other.

Make the new field as usual.
Set Field Length. (1 would be a standard dropdown)
Set Maximum Input (I'd leave it at 250)
In the Select Box Items text area type

Male
Female
Other

each on it's own line.


UPDATED for v224 with vbHacker
Click thru for the updated version

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #112  
Old 05-22-2003, 02:23 AM
Hamma Hamma is offline
 
Join Date: Oct 2001
Location: MA,USA
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks 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
Reply With Quote
  #113  
Old 06-04-2003, 04:54 PM
Falkware Falkware is offline
 
Join Date: Dec 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #114  
Old 06-04-2003, 07:42 PM
Nomb's Avatar
Nomb Nomb is offline
 
Join Date: Nov 2002
Location: Phoenix, AZ
Posts: 85
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #115  
Old 06-11-2003, 06:24 PM
tomjinx1 tomjinx1 is offline
 
Join Date: Sep 2002
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #116  
Old 06-13-2003, 01:01 PM
tomjinx1 tomjinx1 is offline
 
Join Date: Sep 2002
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #117  
Old 06-13-2003, 05:50 PM
tomjinx1 tomjinx1 is offline
 
Join Date: Sep 2002
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #118  
Old 06-14-2003, 03:24 PM
Falkware Falkware is offline
 
Join Date: Dec 2001
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #119  
Old 06-14-2003, 06:57 PM
tomjinx1 tomjinx1 is offline
 
Join Date: Sep 2002
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #120  
Old 06-14-2003, 10:55 PM
tomjinx1 tomjinx1 is offline
 
Join Date: Sep 2002
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #121  
Old 06-18-2003, 01:11 AM
tomjinx1 tomjinx1 is offline
 
Join Date: Sep 2002
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:54 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05048 seconds
  • Memory Usage 2,363KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete