Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-25-2012, 09:09 PM
Amit86 Amit86 is offline
 
Join Date: Feb 2008
Location: Israel
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Select user profile field inside a user profile field possible?

Hello everyone,

I am trying to add a new user profile field.
This user profile field is a 'Single selection menu'
I'd like the menu to contain fields 6 to 15 as a selection

Is that possible?

To make things more realistic,
field6 to 15 are player names my members has in their game-server accounts (it auto fills not editable using some php script)
I'd like for them to be able to choose a main player from the list
Reply With Quote
  #2  
Old 10-25-2012, 11:22 PM
TheSupportForum TheSupportForum is offline
 
Join Date: Jan 2007
Posts: 1,158
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Amit86 View Post
Hello everyone,

I am trying to add a new user profile field.
This user profile field is a 'Single selection menu'
I'd like the menu to contain fields 6 to 15 as a selection

Is that possible?

To make things more realistic,
field6 to 15 are player names my members has in their game-server accounts (it auto fills not editable using some php script)
I'd like for them to be able to choose a main player from the list
you need to add "Add New Profile Field Category"

then add all the fields to that Category from "6" to "11" as you wish
Reply With Quote
  #3  
Old 10-25-2012, 11:25 PM
Amit86 Amit86 is offline
 
Join Date: Feb 2008
Location: Israel
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I already have that,
How do i make those fields appear in a Single selection menu userfield so that userfield16 can have one of their selection

--------------- Added [DATE]1351249095[/DATE] at [TIME]1351249095[/TIME] ---------------

Would be glad to get assistance
Reply With Quote
  #4  
Old 10-27-2012, 09:02 AM
Amit86 Amit86 is offline
 
Join Date: Feb 2008
Location: Israel
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I take it by the no replies that this isnt possible?
Reply With Quote
  #5  
Old 10-27-2012, 04:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you post what you have done and tell us what is wrong with your current set up? And, images of what you want always help as I can't picture what you've done and what you want.
Reply With Quote
  #6  
Old 10-27-2012, 06:21 PM
Amit86 Amit86 is offline
 
Join Date: Feb 2008
Location: Israel
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's going to be abit long but why not.

I have coded my registration page to require a custom field.

This field is my users username in a game server I am running

In order to make sure they use their username I also added a script that checks if their password match the game password.

This part is working great.

Then, I added a php schedule task that connects to my sql game server and takes all the players info based on the field they used in registration and adding this info into Players user field category (let's say fields 6-15 10 player limit)

You can see this here:


Now, After this is working as it should, I am trying to pull more information but I want the members to be able to set a main player (one of the fields) so I can display other stuff like guild, profession etc

So to do this, I need to add another custom field called Main Player
the members would have to choose from the list of players contained in fields6-15 which one is their main player and this field will be used to pull more information
Attached Images
File Type: png postbit.png (53.7 KB, 0 views)
Reply With Quote
  #7  
Old 10-27-2012, 09:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If the field is already created and you have php code that's setting the other fields, you can set the menu options of your Main Player field like this:

Code:
$players = array();
$players[1] = "Rogue";
$players[2] = "Mage";
// etc

$menuid = ID; // Change ID to profile field id of menu
global $vbulletin;
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "profilefield
                              SET data = '" . $vbulletin->db->escape_string(serialize($players)) . "' 
                              WHERE profilefieldid = $menuid");

Note that members won't have any value for this field until they set it themselves, unless you also update the userfield table.
Reply With Quote
  #8  
Old 10-27-2012, 10:41 PM
John Lester John Lester is offline
 
Join Date: Nov 2004
Posts: 543
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Amit86 View Post

This field is my users username in a game server I am running

In order to make sure they use their username I also added a script that checks if their password match the game password.

This part is working great.
I sure hope your members know what you are doing. I for one would never register on a site using the same password I use in a game, same name probably depending on the site, but never the pass.
Reply With Quote
  #9  
Old 10-28-2012, 11:41 AM
Amit86 Amit86 is offline
 
Join Date: Feb 2008
Location: Israel
Posts: 108
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
If the field is already created and you have php code that's setting the other fields, you can set the menu options of your Main Player field like this:

Code:
$players = array();
$players[1] = "Rogue";
$players[2] = "Mage";
// etc

$menuid = ID; // Change ID to profile field id of menu
global $vbulletin;
$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "profilefield
                              SET data = '" . $vbulletin->db->escape_string(serialize($players)) . "' 
                              WHERE profilefieldid = $menuid");

Note that members won't have any value for this field until they set it themselves, unless you also update the userfield table.
Do i add this in one of the PHP files or can I put it in one of the hook plugins?
If I can use plugins, which hook do you think is best for this?


Quote:
Originally Posted by John Lester View Post
I sure hope your members know what you are doing. I for one would never register on a site using the same password I use in a game, same name probably depending on the site, but never the pass.
the website makes sure your game account is correct using the password before you LINK your game account, because after LINKING your account you can change things that affect your in-game account..

Reminder, this is a private server not a global server (still not relevant to the case )
Reply With Quote
  #10  
Old 10-28-2012, 12:18 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Amit86 View Post
Do i add this in one of the PHP files or can I put it in one of the hook plugins?
If I can use plugins, which hook do you think is best for this?

Well, in a post above you said:
Quote:
...I added a php schedule task that connects to my sql game server and takes all the players info based on the field they used in registration and adding this info into Players user field category (let's say fields 6-15 10 player limit)"
So I was thinking that you'd add it as part of that task. But if the users are able to manually edit the list of players then you'd also need to find a hook that's called whenever the profile is updated and do it there as well.
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 06:02 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.04887 seconds
  • Memory Usage 2,285KB
  • Queries Executed 14 (?)
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
  • (2)bbcode_code
  • (6)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
  • (1)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
  • (1)postbit_attachment
  • (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_postinfo_query
  • fetch_postinfo
  • 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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete