vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Select user profile field inside a user profile field possible? (https://vborg.vbsupport.ru/showthread.php?t=289648)

Amit86 10-25-2012 09:09 PM

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

TheSupportForum 10-25-2012 11:22 PM

Quote:

Originally Posted by Amit86 (Post 2375981)
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

Amit86 10-25-2012 11:25 PM

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

Amit86 10-27-2012 09:02 AM

So I take it by the no replies that this isnt possible?

Lynne 10-27-2012 04:15 PM

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.

Amit86 10-27-2012 06:21 PM

1 Attachment(s)
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:
https://vborg.vbsupport.ru/attachmen...1&d=1351365398

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

kh99 10-27-2012 09:41 PM

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.

John Lester 10-27-2012 10:41 PM

Quote:

Originally Posted by Amit86 (Post 2376360)

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.

Amit86 10-28-2012 11:41 AM

Quote:

Originally Posted by kh99 (Post 2376413)
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 (Post 2376429)
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 :) )

kh99 10-28-2012 12:18 PM

Quote:

Originally Posted by Amit86 (Post 2376527)
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.


All times are GMT. The time now is 01:40 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.01272 seconds
  • Memory Usage 1,746KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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