PDA

View Full Version : Need help with php


plot
10-30-2007, 12:30 AM
Hey, i would like to know if any one can help me add an option to the user control panel.

I would like to add an option under the Miscellaneous Options that enables or disables code i place in a template, is there someone who can assist me?

Michael Morris
10-30-2007, 01:23 AM
You don't need to mess with PHP for this in vbulletin. Create the user profile field using the user profile field manager. Once you create it note the field number. You can then referrence the field in templates using <if condition="$bbuserinfo['fieldX']">do this<else />do this</if>

If you need to refer to it in the post bit for the profile of that poster use $post['fieldX'] instead.

For more information regarding user profile fields check this part of the manual: http://www.vbulletin.com/docs/html/profile

plot
10-30-2007, 01:48 AM
I'm sorry but i didn't understand you explaination. What i would like to do is is create an options fo my registered users to disable an enable the Google ads i have placed in my header.

I would also like this option to appear under the 'Edit Options' area of the User Control Panel.

Michael Morris
10-30-2007, 02:53 AM
You can do that by creating a user profile field following the instructions in the vbulletin manual linked above - then use the template conditionals I gave above in the header template

plot
10-30-2007, 10:51 PM
Okay, how do i put this option in 'Edit Options' rather than in 'Edit Profile'. Also, how do i make the selection a dropdown menu rather than a list of options.

I do not want whether my user has enabled or disabled this option to appear in their post bit but just disable a code.

Also, do i replace 'FieldX' with the name of of my new field?

<if condition="$bbuserinfo['googads']">no ads<else />ads</if>

or do i do this?

<if condition="$bbuserinfo['enable']">ads<else />no ads</if>