Register Members List Search Today's Posts Mark Forums Read

Reply
 
Article Options
Adding user options in usercp for mod's [Not in the manual]
almannai
Join Date: Oct 2007
Posts: 889

by almannai almannai is offline 18 Jan 2010

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



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View 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
Views: 4181
Reply With Quote
Comments
  #2  
Old 18 Jan 2010, 23:34
MARCO1's Avatar
MARCO1 MARCO1 is offline
 
Join Date: Jun 2008
Real name: Marco
Very Nice, Thanks.
__________________
Marco Mamdouh Fahem.
OUZMind Lead Developers
vBFoster Lead Developers
vBulletin 5 Alpha Team member.
Reply With Quote
  #3  
Old 19 Jan 2010, 09:31
almannai almannai is offline
 
Join Date: Oct 2007
Originally Posted by MARCO1 View Post
Very Nice, Thanks.


Nice seeing you here MARCO1
Reply With Quote
  #4  
Old 20 Jan 2010, 18:34
MARCO1's Avatar
MARCO1 MARCO1 is offline
 
Join Date: Jun 2008
Real name: Marco
Originally Posted by almannai View Post
Nice seeing you here MARCO1
That's my home my friend
__________________
Marco Mamdouh Fahem.
OUZMind Lead Developers
vBFoster Lead Developers
vBulletin 5 Alpha Team member.
Reply With Quote
  #5  
Old 22 Jan 2010, 17:50
almannai almannai is offline
 
Join Date: Oct 2007
Originally Posted by MARCO1 View Post
That's my home my friend
I know...

What do you think about my new mod that is the everywhere sidebar?
Reply With Quote
  #6  
Old 22 Jan 2010, 18:26
MARCO1's Avatar
MARCO1 MARCO1 is offline
 
Join Date: Jun 2008
Real name: Marco
Originally Posted by almannai View Post
I know...

What do you think about my new mod that is the everywhere sidebar?
Check this : http://www.vbulletin.org/forum/showp...17&postcount=4
__________________
Marco Mamdouh Fahem.
OUZMind Lead Developers
vBFoster Lead Developers
vBulletin 5 Alpha Team member.
Reply With Quote
  #7  
Old 23 Jan 2010, 07:14
almannai almannai is offline
 
Join Date: Oct 2007
Originally Posted by MARCO1 View Post
Thank you for your continuous support
Reply With Quote
  #8  
Old 14 Apr 2010, 21:15
ARP ARP is offline
 
Join Date: Mar 2009
Real name: Steve
Hello, Can you make a simple Mod of this plugins to add the options ? I can't get this working
Maybe I doing something wrong
Reply With Quote
  #9  
Old 15 Apr 2010, 07:55
almannai almannai is offline
 
Join Date: Oct 2007
Originally Posted by ARP View Post
Hello, Can you make a simple Mod of this plugins to add the options ? I can't get this working
Maybe I doing something wrong
I've used same techniques in one of my mods

check it out here
http://www.vbulletin.org/forum/showthread.php?t=232639
Reply With Quote
  #10  
Old 17 Apr 2010, 00:25
ARP ARP is offline
 
Join Date: Mar 2009
Real name: Steve
Check your PM's
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Article Options

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


New To Site? Need Help?

All times are GMT. The time now is 01:11.

Layout Options | Width: Wide Color: