vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need help with php (https://vborg.vbsupport.ru/showthread.php?t=161467)

plot 10-30-2007 12:30 AM

Need help with php
 
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>


All times are GMT. The time now is 02:18 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.01120 seconds
  • Memory Usage 1,713KB
  • 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
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete