vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Extra Profile Fields/member.php manipulation? (https://vborg.vbsupport.ru/showthread.php?t=18541)

RobAC 05-29-2001 01:12 AM

Here's what I want to do:

Add in 2 extra fields in the member's "Edit Profile" template inquiring if they are a member of 2 organizations (yes/no option) The variable names will be "ncm" and "ncrs". When they select yes or no under Edit Profile, it will show up in their user profiles. I could have added a customfield and made it easy, however, I don't want them to appear under the other customfields such as birthday, location, etc. I have a separate section in their profiles called "Memeberships" where I want this information to appear.

I've gone into the database and added two fields, both tinyint(4). My question is, where in the member.php do I add these options in to be handled by the database and how would I write the code?

Wayne Luke 05-29-2001 02:05 AM

In Member.php

find:
PHP Code:

if ($HTTP_POST_VARS['action']=="updateprofile") { 

You are going to edit the query in that section that starts with:
PHP Code:

$DB_site->query("UPDATE user SET 

In Register PHP you want to change the section where it adds a new user. The QUERY statement will be an Insert there.

Remember to update your templates as well.

RobAC 05-29-2001 02:32 AM

Thanks Wayne. I made what I believe are the necessary changes to the member.php, but didn't work.

I'm not sure if this would make a difference or not, but I wasn't planning on including the options in the registration form. Reason being, I wanted to minimize the amount of stuff in the registration form and give the user the option of dealing with it under "Edit Profile" once they have registered. I did hack the edit profile template, but the yes/no option is defaulted to "no". If I go in and set them to yes and save the settings, when I go back in, they are still defaulted to "no" and do not show up in the member's profile. Any ideas?

Wayne Luke 05-29-2001 02:39 AM

IN the section for loading the modify profile template, you will need to add some parts similar to:

if ($bbuserinfo[ncm]) {
$ncmchecked="checked";
$ncmnotchecked="";
} else {
$ncmchecked="";
$ncmnotchecked="checked";
}

You will then need to modify the template to show the checked and not checked variables next to the appropriate radio buttons.

RobAC 05-29-2001 12:10 PM

Still not working. :( I've tried everything and I can get the information to populate in the user's profile. This is the code I'm using in the modifyprofile template:

<input type="radio" name="ncm" value="yes" $ncmnotchecked> yes
<input type="radio" name="ncm"value="no" $ncmchecked> no

I've changed the data type in the database to varchar(4) since I want a "Yes" "No" to appear in the user's profile.

For some reason, I just can't get it to work. Each time I check off yes or no in the Edit Profile, and go back to the page, it show the options as being unchecked. Any ideas?

-Rob

RobAC 06-12-2001 09:30 PM

I managed to get this to partially work finally. The problem is this: if you go into Edit Options, and you check "yes" or " no" (radio buttons) and submit, it updates the user's profile. However, when you go back into Edit Options, neither button is checked. If you make any changes to your profile, or just click the submit button again, it wipes out that yes/no setting that you previous set in the user's profile. I noticed the same problem with Tubedogg's Community Bulletin generator hack where the user has the option of receiving the bulletin (yes/no radio buttons) in under Edit Options.

Does anyone have any ideas how to fix this?

RobAC 06-13-2001 09:20 PM

^^^^bump....anyone?

tubedogg 06-13-2001 10:26 PM

Quote:

Originally posted by RobAC
...I noticed the same problem with Tubedogg's Community Bulletin generator hack where the user has the option of receiving the bulletin (yes/no radio buttons) in under Edit Options.
If you added this:
Code:

if ($bbuserinfo[receivebulletin]) {
    $receivebulletinchecked = &quot; checked&quot;;
    $receivebulletinnotchecked = &quot;&quot;;
  } else {
    $receivebulletinchecked = &quot;&quot;;
    $receivebulletinnotchecked = &quot; checked&quot;;
  }

to member.php it should check one box or the other - it does for me...

RobAC 06-14-2001 12:47 AM

Kevin,

Thanks, but this doesn't solve my original problem. That piece of code which you cited is what was missing out of member.php and did solve the problem for the Community Bulletin Generator hack, however, I used that same piece of code which wluke suggested but modified it with the correct variables. It still doesn't work.

Maybe I'm not explaining the problem clearly. I have set up two option in Edit Profile which are radio buttons (yes/no) asking the user if they are a member of a particular organization. Depending on what they choose, that option will show up as Yes or No in their Member Profile.

If you go into Edit Profile, both Yes and No are not checked. If you check one of them, the result will show up in the Member Profile. However, when you go back into Edit Profile, both options are unchecked again and if you make any other changes to profile and submit, it wipes out whatever was previously set for those two organizations thus wiping out the "Yes" or "No" in their profile. Here is the code I have in Member.php:

PHP Code:

  $DB_site->query("UPDATE user SET birthday='".addslashes($birthday)."',signature='".addslashes($signature)."',customtitle='$customtitle',usertitle='".addslashes($customtext)."',email='".addslashes(htmlspecialchars($email))."',parentemail='".addslashes(htmlspecialchars($parentemail))."',coppauser='$coppauser',homepage='".addslashes(htmlspecialchars($homepage))."',icq='".addslashes(htmlspecialchars($icq))."',aim='".addslashes(htmlspecialchars($aim))."',msn='".addslashes(htmlspecialchars($msn))."',yahoo='".addslashes(htmlspecialchars($yahoo))."',ncm='".addslashes(htmlspecialchars($ncm))."',ncrs='".addslashes(htmlspecialchars($ncrs))."',usergroupid='$bbuserinfo[usergroupid]' WHERE userid='$bbuserinfo[userid]'");

  if (
$showbirthdays)
    
getbirthdays();
  
// insert custom user fields
  
$DB_site->query("UPDATE userfield SET userid=$bbuserinfo[userid]$userfields WHERE userid=$bbuserinfo[userid]");

if (
$bbuserinfo[ncm]) { 
$ncmchecked " checked"
$ncmnotchecked ""
} else { 
$ncmchecked""
$ncmnotchecked=" checked"


if (
$bbuserinfo[ncrs]) { 
$ncrschecked " checked"
$ncrsnotchecked ""
} else { 
$ncrschecked""
$ncrsnotchecked" checked"


I should probably also state, I have the fields in the database set to be varchar(4), Default=0

This is the code in the modifyprofile template:

PHP Code:

<tr>
    <
td bgcolor="{secondaltcolor}"><normalfont><b>National Corvette Museum member? (Yes/No)</b></normalfont></td>
    <
td bgcolor="{secondaltcolor}"><normalfont>

        <
input type="radio" name="ncm" value="Yes" $ncmcheckedyes
        
<input type="radio" name="ncm" value="No" $ncmnotcheckedno    </normalfont></td>
</
tr>
<
tr>
    <
td bgcolor="{firstaltcolor}"><normalfont><b>National Corvette Restorers Society member?</b></normalfont></td>
    <
td bgcolor="{firstaltcolor}"><normalfont>

        <
input type="radio" name="ncrs" value="Yes" $ncrscheckedyes
        
<input type="radio" name="ncrs" value="No" $ncrsnotcheckedno        </normalfont></td>
</
tr


tubedogg 06-14-2001 02:27 AM

Are ncm and ncrs the name of the columns in userfield? Or are they named field5, field6, etc.? That would be one reason why it isn't picking them up.

RobAC 06-14-2001 02:32 AM

they are named ncm and ncrs.

RobAC 06-15-2001 01:58 PM

I guess I'll give this one last bump before I abandon the idea.....anyone? ^^bump^^

Freddie Bingham 06-15-2001 03:13 PM

Do you want this moved to Hacks?

RobAC 06-15-2001 03:16 PM

Sure. Maybe that's where I should have posted it in the first place. I didn't think it would really be considered much of a hack, but someone over there might be able to help. Thanks Freddie.

BradC 06-25-2001 01:30 PM

RobAC,

I am still new at this database stuff (yes still working on the project I told ya about.. pain in the...) anyways..

can't you just set the default in the database to No.

or would that even make a difference when it comes time to make changes in the control panel.

Cause the code looks good to me, so it works, but does not keep it when you relogin to edit something else.

I will see what I can do to help you out on this one... if you want, pm all the code and every you are using, or... I will just off of what you have put in the previous replies and I will insert it all in my to board.. and see if I can get it to work.

RobAC 06-25-2001 01:34 PM

Thanks Brad. I've tried everything to no avail. Regardless of what you set the default to, it won't hold the value.

BradC 06-25-2001 02:46 PM

that is puzzling.. I would think it would go one way or another automatically.. then again I have seen it do just what your talking about.

I wonder if there is a missing code part to making one of them default in the html part of the code.

like radio1, radio2, set radio2 default.. no this is not html code heh.

RobAC 06-25-2001 02:57 PM

I think there is a missing chunk of code in the member.php file which I can't seem to create.

BradC 06-25-2001 10:38 PM

look at this code..

<input type="radio" value="V1" checked name="R1"><input type="radio" name="R1" value="V2"><input type="radio" name="R1" value="V3">

see the value that says.. checked name.... that might be what you need to enter.

RobAC 06-25-2001 10:46 PM

That's basically what I have. It's the same as saying $ncrschecked or $ncmchecked. :(

BradC 06-26-2001 12:17 PM

yah it is..

did you add 2 fields to the database table?... if so.. did ya make one of them default?

trying to find the little blurb... before we dig into the member.php file :)

RobAC 06-26-2001 12:35 PM

Nope, neither one of them are defaulted.

-Rob

BradC 06-26-2001 01:03 PM

Well I guess we will have to dig deeper...

I will try to figure something when I get off work.. later tonight.. but I can't promise anything heh.

RobAC 06-26-2001 01:25 PM

Cool. Thanks Brad. No rush. Hell, I've waited this long already. LOL

-Rob

BradC 06-26-2001 01:34 PM

:)

I wish I was smarter with php and everything.. so that we could get this resolved :)

I still have about 70% to do on my latest project heh.. but I tell ya it is helping me learn a lot.. :)

trial and error style mostly :)

BradC 06-28-2001 01:41 AM

RobAc,

I have been playing with.. my crap still, and instead of radio buttons I am using a drop down value.. and I have ran into the same somewhat problem as you.

There is a Default Value = NA that it keeps going back to instead of the other 2. Like when I select it and save, it does it and when I view it in the member's profile it shows it but when I go back in to change something else, it will go back to default.

What I did to fix it, considering I have no clue why it won't take characters just numbers :(

I put default value as = -1 and the others are 1 and 2..

now it works... for some odd reason.
Anyone know if you have to have "A" or 'B' or just leave it as the character for it to work properly.

BradC 06-28-2001 08:52 PM

I have got this to work.. but using different code.. but mine works now.. Rob... so contact me through email.. and maybe we can work together for ya to get this to work.

RobAC 06-28-2001 09:06 PM

Cool. Will do. Thanks Brad!

-Rob

BradC 06-28-2001 09:21 PM

Finally making headway..... well somewhat with my current project and I have had to do some things like this...

BradC 07-01-2001 08:15 AM

RobAC.

check your private messages bud...

I think I have this done for you, now we will have to change some things around for ya :)


All times are GMT. The time now is 01:49 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.01152 seconds
  • Memory Usage 1,828KB
  • 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
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (30)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete