vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom Profile Fields If Else Statments (https://vborg.vbsupport.ru/showthread.php?t=46938)

Grendel602 12-23-2002 05:01 PM

Custom Profile Fields If Else Statments
 
I've created a template that will display a custom profile field ($userinfo[field5]) inside of an html table inside of the postbit. Although, I only want this html table to show up in a user?s post if they've entered information in this custom profile field (Under update profile). In the postbit I have the following html (With a lil php):

Code:

<table bgcolor="{tablebordercolor}" width="80%" border="0" cellspacing="1" cellpadding="2"><tr>
$post[gamertag]
</tr></table>

I have a template named postbit_gamertag:

Code:

<td bgcolor="#bbd89a" align="center" valign="middle"><smallfont><b>Gamertag</b></smallfont></td>
</tr>
<tr>
<td bgcolor="$post[backcolor]" align="center" height="15"><smallfont>$post[field5]</smallfont></td>

And finally I've edited member.php with the following code (I did declare the template in the $templatesused statement but left that out for simplicity):

PHP Code:

  if ($userinfo[field5]!="") {
      eval(
"\$userinfo[gamertag] = \"".gettemplate("postbit_gamertag")."\";");
    } else {
      
$userinfo[field5]="";
    } 

My problem is, none of this works. I?m fairly new to php so cut me a little slack. I really have tried to work this out but am at a loss. If someone could help me out I would appreciate it. Plus I could learn something. :D

Thanks in advance.

Xenon 12-23-2002 08:57 PM

your use of code is ok, but you have to edit admin/functions.php the getpostbitfunction :)

Grendel602 12-23-2002 10:06 PM

I added this code to admin/functions.php:

PHP Code:

          if ($post[field5]!="") {
              eval(
"\$post[gamertag] = \"".gettemplate("postbit_gamertag")."\";");
        } else {
            
$post[field5]="";
        } 

Now it works like a charm! I wondered where the "$post"[gamertag] came in. Thank you so much!

Grendel602 12-23-2002 10:15 PM

I appreciate all the help.

Xenon 12-23-2002 11:59 PM

use this one:
PHP Code:

if ($post[field5]!="") {
              eval(
"\$post[gamertag] = \"".gettemplate("postbit_gamertag")."\";");
        } else {
            
$post[gamertag]="";
        } 

and then just put $post[gamertag] into your normal postbittemplate


All times are GMT. The time now is 05:54 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.01003 seconds
  • Memory Usage 1,725KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (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