Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-29-2001, 01:12 AM
RobAC RobAC is offline
 
Join Date: Oct 2001
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #2  
Old 05-29-2001, 02:05 AM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 05-29-2001, 02:32 AM
RobAC RobAC is offline
 
Join Date: Oct 2001
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 05-29-2001, 02:39 AM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 05-29-2001, 12:10 PM
RobAC RobAC is offline
 
Join Date: Oct 2001
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 06-12-2001, 09:30 PM
RobAC RobAC is offline
 
Join Date: Oct 2001
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #7  
Old 06-13-2001, 09:20 PM
RobAC RobAC is offline
 
Join Date: Oct 2001
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^^^^bump....anyone?
Reply With Quote
  #8  
Old 06-13-2001, 10:26 PM
tubedogg's Avatar
tubedogg tubedogg is offline
 
Join Date: Oct 2001
Location: Medina, OH
Posts: 785
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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...
Reply With Quote
  #9  
Old 06-14-2001, 12:47 AM
RobAC RobAC is offline
 
Join Date: Oct 2001
Posts: 314
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 06-14-2001, 02:27 AM
tubedogg's Avatar
tubedogg tubedogg is offline
 
Join Date: Oct 2001
Location: Medina, OH
Posts: 785
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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


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 07:25 PM.


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.04682 seconds
  • Memory Usage 2,285KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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