The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Using your User Profile Fields in your postbit templates (w/ all plugin method)
This article is written with the assumption that you have already created your own User Profile Fields in the User Profile Field Manager. If you need help with this, you may read about it in the manual here - http://www.vbulletin.com/docs/html/profile For the Purposes of this article, I will be referring to "fieldx" as the name of your profile field. Your real name will be found in the User Profile Manager in the "Name" column - field1, field2, etc. Adding the Profile Field to your postbit (or postbit_legacy) template For Single-Line Text Box, Multiple-Line Text Box, Single-Selection Radio Buttons, and Single-Selection Menu Method 1 - Modifying the Template Open the postbit or postbit_legacy template and find the area you want to add it to. For instance, to add it right after the user post count, find this:Method 2 - Using a template_hook I have always found it easier to just use the existing $template_hooks in the template and write a plugin to add these. In this case, there is a $template_hook right where we want it, after the user post count:For Multiple-Selection Menu and Multiple-Selection Checkbox It is a bit more complicated for these two types of selections since the options selected are stored as a binary number. If you just display the field using the method above, you will get a number, not a list of options selected. So, in order to use these types of fields, you will have to use the method below. Here is a thead that will explain the binary scheme - http://www.vbulletin.com/forum/showt...To-The-Postbit Method 1 - Modifying the Template Open the template and find the area you want to add it to. For instance, to add it right after the user post count, find this:Method 2 - Using a template_hook Find the template_hook you want to use. In this case, there is a $template_hook right where we want it, after the user post count:More Advanced If you like everything to be 'automatic' - meaning you don't have to supply any text at all, just use everything already stored in the database - then you can use a few of plugins to do the work for you. Plugin 1 - This plugin is used to get the phrasegroup "cprofilefield" added for use in the page so that you may use $vbphrase[fieldx_title] to get the Profile Field Title you entered in the User Profile Field Manager. ? hook location - init_startupPlugin 2 - This plugin is used to get the fields you defined for the profile in the User Profile Field Manager. ? hook location - showthread_postbit_createPlugin 3 - This plugin simply spits the data out into the postbit using the template_hook and using the phrase for the Title and the Options are all spit out with commas between them (if needed) into the postbit. ? hook location - postbit_display_complete |
#112
|
|||
|
|||
Multiple-Selection Menu
& Multiple-Selection Checkbox 1) How do I get some/all of those fields highlighted/checkboxes ticked as the default during registration? 2) How do I force all my existing members into updating their user profile settings? I have some forced options now (like gender). Members who are registering now are forced to pick male or female. Whereas members who have already signed up, they aren't forced as nothing appears in their postbit (gender) unless they go to their userCP profile and press save. P.S= Thank you Lynne for this brilliant article :up: |
#113
|
||||
|
||||
1. For Multiple-Selection Menu, you may set the first one as default but that is the only option. There is no way to pre-select several checkboxes. I think you would need to write a plugin to do that.
2. I think you can set Field Required to Yes, Always and that should do what you want. Quote:
|
#114
|
|||
|
|||
Quote:
How do I set the first option as the default (highlighted)? As the current settings I'm using, doesn't do this... Quote:
Yes, at registration and profile updating - Doesn't work. Yes, always - Worked |
#115
|
||||
|
||||
1) Whoops, sorry, I was looking at the wrong type of profile field (single-selection menu, not multi-selection menu).
|
#116
|
|||
|
|||
Quote:
https://vborg.vbsupport.ru/showthread.php?t=320081 I made a request for somebody to make a plugin allowing the admin to set defaults for Multiple-Selection Menu/Checkbox when creating a User Profile Field. |
#117
|
|||
|
|||
1) Do you know any way to set it so only certain usergroups will have X User Profile Field option appear in their userCP?
2) How do I execute a SQL Query to force All Users/ Certain Usergroups/ Certain Users to have their X user profile field options changed into what I want? They can change into what they want from the userCP later. |
#118
|
||||
|
||||
1) No, I do not.
2) Very hard to say without specifics. But, you can probably use phpMyAdmin to do it. |
#119
|
|||
|
|||
Quote:
Invisible On: UPDATE user SET options=options + 512 WHERE NOT(options & 512); Off: UPDATE user SET options=options - 512 WHERE options & 512; Run from Execute SQL Query Where you'd just need to colour code what I need to change depending on my options & field number. |
#120
|
||||
|
||||
It would be something like that only on the userfield table (where the settings for the user profile fields are kept). But, if it is for a certain usergroup, your WHERE statement would have to include a SELECT of only certain users whose user.usergroupid was xx since the usergroupid is not included in the userfield table. I'm not good at writing those sort of queries.
|
#121
|
|||
|
|||
Quote:
1) Code:
UPDATE userfield SET field5='Hide' where userid in (SELECT userid FROM user WHERE usergroupid IN (X, X, X)) Key: Red = User Profile Field ID. Green = User Profile Field Option you want to change to. Blue = Usergroup ID. 2) Code:
UPDATE userfield SET field5='Hide' where field5='Male' AND userid in (SELECT userid FROM user WHERE usergroupid IN (X, X, X)) Key: Red = User Profile Field ID. Green = User Profile Field Option you want to change to. Orange = Option you want changed. Blue = Usergroup ID. 3) Code:
UPDATE userfield SET field5='Hide' where (field5='Male' OR field5='Female') AND userid in (SELECT userid FROM user WHERE usergroupid IN (X, X, X)) Key: Red = User Profile Field ID. Green = User Profile Field Option you want to change to. Orange = Option you want changed. Blue = Usergroup ID. Note: Change usergroupid to userid to change for several users, instead of entire usergroups. Note 2: You don't have to select more than 1 usergroup. Just selecting 1 usergroup still works. P.S= If you want to know how to change 'Display Reputation', 'Invisible' etc, check out my guide here: https://vborg.vbsupport.ru/showthrea...58#post2555258 --------------- Added [DATE]1443391500[/DATE] at [TIME]1443391500[/TIME] --------------- Quote:
If anybody can help out, that would be great |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|