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.


All times are GMT. The time now is 01:11 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.01197 seconds
  • Memory Usage 1,776KB
  • 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)pagenav
  • (1)pagenav_curpage
  • (2)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