Adding user options in usercp for mod's [Not in the manual]
Hi,
This article is a part of "Not in the manual" series of articles that I hope will wrtie from time to time. Ok .. So if you have been programing in Vb3.x you are used to adding changes in the user cp by adding more options to one of the Login, Messaging, Thread View, Date/Time or the "Other" Section of the $customfields array. For example adding a textbox option to the "other" section in the usercp was as simple as adding the following plugin to the "profile_complete" hook PHP Code:
To explain the above code: First we are setting our profilefield variable like name, textbox size, description etc. We write the system 'userfield_textbox' in our variable tempcustom. Then we add that variable to the other section of the customfields array. Well that is a straightforward coding and maybe that is because we are used to it. In vb4 it is little bit more extra coding. First off all the customfields array is not there, so we have to insert our changes by replacing the "other" section of the "modifyoptions" template with the "other"section plus our custom code. Plus some other minor changes and here is same code but for vb4 PHP Code:
The first part of the code is setting our profilefield variables then saving the 'userfield_textbox' template to our $tempcustom using vb4 way. That is by using vB_Template class and registering 'profilefieldname' and 'profilefield' then rendering it. The second part we search for $customfields['other'] and replace by $customfields['other'] itself plus the $tempcustom. Don't get confused by the too many commas in the code I made it like this to make it easier [I think] to read. Actualy here how the other section part looks in the 'modifyoptions' template ' . $customfields['other'] . ' In case you want to add Dropdownlist see the following example PHP Code:
I will not go farther to explain this code cause I'm sure you will figure it out. Just small hint though; in this code we used $vbphrase to save our title and description as this is the proper way of doing it if you want to make more professional way of building mod's. Happy coding:) |
Very Nice, Thanks.
|
Quote:
Nice seeing you here MARCO1 |
Quote:
|
Quote:
What do you think about my new mod that is the everywhere sidebar? |
Quote:
|
Quote:
|
Hello, Can you make a simple Mod of this plugins to add the options ? I can't get this working :D
Maybe I doing something wrong |
Quote:
check it out here https://vborg.vbsupport.ru/showthread.php?t=232639 |
Check your PM's
|
All times are GMT. The time now is 02:58 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 | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|