vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   <if condition="$show['member']"> not working in custom template? (https://vborg.vbsupport.ru/showthread.php?t=150313)

dutchbb 06-21-2007 07:33 PM

<if condition="$show['member']"> not working in custom template?
 
Ok, I made a custom template, used this conditional in it (normally used in navbar):

<if condition="$show['member']">

But it's not working there, howcome?

dutchbb 06-21-2007 08:01 PM

That conditional is used with an <else /> in navbar as default for showing the navbar login information (pm and such) or login information for guests.

Just original vbulletin code:

Code:

        <if condition="$show['member']">
       
                <td class="alt2" valign="top" nowrap="nowrap">
                <div class="smallfont">
                        <strong><phrase 1="$bbuserinfo[username]">$vbphrase[welcome_x]</phrase></strong><br />
                        <phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
                        <if condition="$show['pmstats']"><br /><phrase 1="$vbphrase[unread_x_nav_compiled]" 2="$vbphrase[total_x_nav_compiled]" 3="$session[sessionurl_q]">$vbphrase[private_messages_nav]</phrase></if>
                        <if condition="$show['pmwarning']"><br /><strong><phrase 1="$vbphrase[pmpercent_nav_compiled]">$vbphrase[your_pm_box_is_x_full]</phrase></strong></if>
                </div>
                </td>
               
        <else />
               
                <td class="alt2" nowrap="nowrap" style="padding:0px">
                       
                <!-- login form -->
                <form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
                <script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr>
                        <td class="smallfont"><label for="navbar_username">$vbphrase[username]</label></td>
                        <td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
                        <td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td>
                </tr>
                <tr>
                        <td class="smallfont"><label for="navbar_password">$vbphrase[password]</label></td>
                        <td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td>
                        <td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
                </tr>
                </table>
                <input type="hidden" name="s" value="$session[sessionhash]" />
                <input type="hidden" name="do" value="login" />               
                <input type="hidden" name="vb_login_md5password" />
                <input type="hidden" name="vb_login_md5password_utf" />
                </form>
                <!-- / login form -->
                       
                </td>
               
        </if>


But I want to use this whole piece of code in a custom template, with a variable for it in the forumhome template.

Dismounted 06-22-2007 06:03 AM

Try $vbulletin->userinfo['userid'] != 0 instead.

dutchbb 06-22-2007 02:48 PM

That is not possible since I need to use an <else /> after it to show something different for guests...

I would like to know why the conditional $show['member'] doesnt work in a custom template, any help is appreciated.

TheMilkCarton 06-22-2007 03:11 PM

Why is it not possible to use <else /> with Dismounted's suggestion?

Code:

<if condition="$vbulletin->userinfo['userid'] != 0"> member code <else /> guest code </if>
Maybe I'm missing something?

dutchbb 06-23-2007 08:09 AM

You are right, it does work. However still like to know why the original didn't??

BTW is user ID better than using usergroup != 1 ?

And another problem: <phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase> is also not working in this template, is there a way to make these work in custom templates?

TheMilkCarton 06-23-2007 09:42 AM

Quote:

Originally Posted by dutchbb (Post 1274497)
BTW is user ID better than using usergroup != 1 ?

It doesn't really matter. Just use what works? :)

Quote:

Originally Posted by dutchbb (Post 1274497)
And another problem: <phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase> is also not working in this template, is there a way to make these work in custom templates?

Is this for vBadvanced? The vBa code would look like this:
Code:

<phrase 1="$lastvisitdate" 2="$lastvisittime">$vbphrase[last_visited_x_at_y]</phrase>
If not, I can't really help, because I don't know what this custom template is and what plugin/PHP file is calling on it.

dutchbb 06-23-2007 10:38 AM

Nope, not vbadvanced. I just would like to use navbar code in a new template (rightcolumn). Anyone know of a topic i can read here about this issue? thanks

Dismounted 06-23-2007 10:57 AM

Code:

<phrase 1="$lastvisitdate" 2="$lastvisittime">$vbphrase[last_visited_x_at_y]</phrase>
You will also need to have this PHP code (either in a plugin or in the file itself):
PHP Code:

$lastvisitdate vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit']);
$lastvisittime vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit']); 


TheMilkCarton 06-23-2007 01:30 PM

Quote:

Originally Posted by dutchbb (Post 1274553)
Nope, not vbadvanced. I just would like to use navbar code in a new template (rightcolumn). Anyone know of a topic i can read here about this issue? thanks

I assume you're using one of the forum column mods then? Kerry Anne's maybe?

No offense to her or anything... but you should really just install vBadvanced 3.0. Column integration is now integrated and *automated* in 3.0 and there are no more file edits -- you just tell vBa which forum pages to show the column on.

There is already a Welcome/Log-in box in vBa by default that you can position wherever you want, not to mention Mini Calendar, Recent Threads, News, News Archive modules, etc.

And if you continue to try adding a lot of code that depends on variables to that "rightcolumn" template you're inevitably going to run into the same problem again and have to add more variables to the plugin or PHP file that the column hack uses.

dutchbb 06-23-2007 02:29 PM

No I did the right column myself. it's a pretty simple mod, I really don't want a big mod like vba, just need the right column with login, nothing more.

Quote:

Originally Posted by Dismounted (Post 1274560)
Code:

<phrase 1="$lastvisitdate" 2="$lastvisittime">$vbphrase[last_visited_x_at_y]</phrase>
You will also need to have this PHP code (either in a plugin or in the file itself):
PHP Code:

$lastvisitdate vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit']);
$lastvisittime vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit']); 


And where should I add this, in my rightcolumn plugin on global_start it has no effect.

Dismounted 06-24-2007 05:57 AM

How are you displaying this template?

dutchbb 06-24-2007 09:01 AM

Quote:

Originally Posted by Dismounted (Post 1275160)
How are you displaying this template?

I'm displaying it by using a plugin called 'rightcolumn' at the location: global_start with this content:

Code:

eval('$rightcolumn = "' . fetch_template('rightcolumn') . '";');
Than I just add $rightcolumn in the FORUMHOME template.

Dismounted 06-25-2007 06:32 AM

Add the PHP code I gave you above it.

dutchbb 06-25-2007 01:10 PM

Yes I tried that , it has no effect.

But I think it has to do with the navbar phrases, they are not working in rightcolumn and contain the '{1}' that show the time etc. If you understand what I mean.

Dismounted 06-26-2007 07:30 AM

Can you just put $vbphrase[last_visited_x_at_y] in the template? What comes out?

dutchbb 06-26-2007 09:45 AM

This is what I get:

Your Last Visit: %1$s at %2$s

Dismounted 06-26-2007 11:21 AM

It should work then....But somehow it's not working.

dutchbb 06-28-2007 04:35 PM

Hm.. if you want to, I can give access to my testing board. Maybe you can find what's wrong. If not, no prob :)

dutchbb 07-07-2007 07:40 PM

Let me know plz:)


All times are GMT. The time now is 02:52 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.01596 seconds
  • Memory Usage 1,777KB
  • 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
  • (6)bbcode_code_printable
  • (2)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)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