vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   If Profile Field Empty (https://vborg.vbsupport.ru/showthread.php?t=198649)

TheInsaneManiac 12-12-2008 12:32 AM

If Profile Field Empty
 
I want to make a script not run if a profile field is empty, but can't seem to find a conditional for this. I don't want this script to run if my profile field is not filled in:
Code:

if($vbulletin->options['xbl_avatar_system_enable_product'] AND $vbulletin->options['xbl_avatar_system_display_navbar'])
{
$xblavatarfield = $vbulletin->options['xbl_avatar_system_userfield'];
eval('$xblavatarhead = "<td style=\"padding:1px\"><a href=\"member.php?".$vbulletin->session->vars[sessionurl]."u=".$vbulletin->userinfo[userid]."\"><img src=\"http://avatar.xboxlive.com/avatar/".$vbulletin->userinfo[$xblavatarfield]."/avatarpic-l.png\" border=\"0\" /></a></td>";');
}


Dismounted 12-12-2008 04:10 AM

You can access profile fields like this:
PHP Code:

$vbulletin->userinfo['fieldX'


TheInsaneManiac 12-12-2008 02:20 PM

So if($vbulletin->userinfo['field254']) would mean that if it is filled in it would run the script and if it wasn't it wouldn't run the script?

Gio~Logist 12-12-2008 03:12 PM

PHP Code:

if($vbulletin->userinfo['fieldx']){

// field x is filled

} else {

// field x is not filled




TheInsaneManiac 12-12-2008 07:09 PM

Quote:

Originally Posted by Gio~Logist (Post 1683910)
PHP Code:

if($vbulletin->userinfo['fieldx']){

// field x is filled

} else {

// field x is not filled




Thanx mate!

Gio~Logist 12-12-2008 07:13 PM

:up:

Dismounted 12-13-2008 03:38 AM

Let's apply some vBulletin coding standards there ;).
PHP Code:

if ($vbulletin->userinfo['fieldx'])
{
    
// field x is filled
}
else
{
    
// field x is not filled



TheInsaneManiac 12-13-2008 05:18 AM

Quote:

Originally Posted by Dismounted (Post 1684302)
Let's apply some vBulletin coding standards there ;).
PHP Code:

if ($vbulletin->userinfo['fieldx'])
{
    
// field x is filled
}
else
{
    
// field x is not filled



I don't guess there is to prevent someone from using the same profile field as someone else is there?

Dismounted 12-13-2008 08:40 AM

The field ID is the same for all users for a particular field. Each user is assigned their own row in the userfield table, which is fetched along with all the other user data.

TheInsaneManiac 12-14-2008 05:32 AM

Quote:

Originally Posted by Dismounted (Post 1684395)
The field ID is the same for all users for a particular field. Each user is assigned their own row in the userfield table, which is fetched along with all the other user data.

So there is no way to detect if a field is the same as another?


All times are GMT. The time now is 04:44 AM.

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.01006 seconds
  • Memory Usage 1,738KB
  • 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)bbcode_code_printable
  • (5)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete