vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Easy Question concerning $logincode (https://vborg.vbsupport.ru/showthread.php?t=44910)

JakeC 10-23-2002 06:31 PM

Easy Question concerning $logincode
 
I'm sure this ground has been covered somewhere but I can't find it. Is there a hack that makes the $logincode and $logoutcode (or any other for that matter) available in the header template. Any help with this would be much appreciated. Thanks.

JakeC

NTLDR 10-23-2002 07:28 PM

You would need to add the PHP code that you want above the line in global.php that eval's the header template.

Erwin 10-23-2002 07:35 PM

Add this to the bottom of your "phpinclude" template.

PHP Code:

// if user is know, then welcome
if ($bbuserinfo['userid']!=0) {
  
$username=$bbuserinfo['username'];
  eval(
"\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval(
"\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval(
"\$newposts = \"".gettemplate('forumhome_newposts')."\";");

} else {
  
$welcometext "";
  eval(
"\$logincode = \"".gettemplate('forumhome_logincode')."\";");


Then put your $logincode and $logoutcode in your header (or in any template). I haven't tested it, but it should work. :)

JakeC 10-23-2002 10:05 PM

First off, thanks for the replies. I have just installed the advanced dynamic templates hack by logician and I want to use the conditionals in order to decide when the logincode is displayed in the header and when its not. Someone told me that what I need to do is parse the $logincode (whatever that means, I don't know). Is there a hack already out that does this or can someone tell me how to do this? I just need the Header Template to recognize the $logincode and $logoutcode and I'll use the conditionals to do the rest. Is my thinking flawed? Please let me know. Thanks.

JakeC

Erwin, Is this what the code you posted does? I'm not a programer but it didn't seem like it. Let me know.

Chris M 10-23-2002 10:14 PM

You can only parse php code to be used in the header or footer in the phpinclude template, or the root/global.php file...

Satan

NTLDR 10-23-2002 10:17 PM

Quote:

Originally posted by JakeC
Erwin, Is this what the code you posted does? I'm not a programer but it didn't seem like it. Let me know.
Yes, if you add that code to the phpinclude template then you can use $logincode and $logoutcode in your header and use the conditionals for it :)

JakeC 10-23-2002 11:56 PM

Great!! Really appreciate the help. Thanks.

JakeC

Logician 10-24-2002 10:55 AM

Quote:

Originally posted by JakeC
First off, thanks for the replies. I have just installed the advanced dynamic templates hack by logician and I want to use the conditionals in order to decide when the logincode is displayed in the header and when its not. Someone told me that what I need to do is parse the $logincode (whatever that means, I don't know). Is there a hack already out that does this or can someone tell me how to do this? I just need the Header Template to recognize the $logincode and $logoutcode and I'll use the conditionals to do the rest. Is my thinking flawed? Please let me know. Thanks.

Erwin's solution is nice..

If you want the "conditional way" of advanced templates, it's similiar to that solution: You can use:

[[($bbuserinfo[userid]>0)]]
Your header template if the user is logged in
[[/($bbuserinfo[userid]>0)]]
[[($bbuserinfo[userid]==0)]]
Your header template if the user is NOT logged in
[[/($bbuserinfo[userid]==0)]]

format in any template you like (including header)

Erwin 10-24-2002 12:06 PM

Quote:

Originally posted by JakeC
Erwin, Is this what the code you posted does? I'm not a programer but it didn't seem like it. Let me know.
Yes.

Also, remember to add

forumhome_welcometext, forumhome_logoutcode, forumhome_newposts, forumhome_logincode

to the end of this line in global.php in your forum folder if you want to add that code above to the phpinclude template.

PHP Code:

$templatesused.=

If you do this, you will have NO additional queries to your pages. If you don't do this, my fix could give every page an additional 3 queries if you're logged in, or 1 extra query if you're logged out.

JakeC 10-24-2002 06:50 PM

Well, Thank you very much. I appreciate you letting me know. I just installed the extra snipit and everything seems ok. I've added the $logincode to the header and everything is working out. I think I really need to learn PHP so I can understand all of these hacks :paranoid: . Thanks.

JakeC

fello9 12-03-2002 06:53 AM

Quote:

Originally posted by Erwin
Add this to the bottom of your "phpinclude" template.

PHP Code:

// if user is know, then welcome
if ($bbuserinfo['userid']!=0) {
  
$username=$bbuserinfo['username'];
  eval(
"\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
  eval(
"\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
  eval(
"\$newposts = \"".gettemplate('forumhome_newposts')."\";");

} else {
  
$welcometext "";
  eval(
"\$logincode = \"".gettemplate('forumhome_logincode')."\";");


Then put your $logincode and $logoutcode in your header (or in any template). I haven't tested it, but it should work. :)

When I add this, I'm getting an error on my message board.

The reason I was trying to add this code was because I added a $logincode to the Quick Reply hack. But when inserting a user name and password and you click reply you are not logged in. So, I'm trying to fix it. Is it the same solution?

Erwin 12-03-2002 08:02 PM

What error do you get?

Smoothie 12-03-2002 08:24 PM

Appparently you can't login and post a new message with the QRB if guests are not allowed to post. He added the QRB code to show it for all users, not just logged in.

Smoothie 12-03-2002 08:32 PM

sorry, i posted this in the wrong thread.

fello9 12-03-2002 10:01 PM

Quote:

Originally posted by Erwin
What error do you get?
Yesterday, I added your code and got an error, and removed it. But now I tried it again, and it's not throwing any error.

But it didn't help me in my situation. I wanted to add the $logincode to the Quick Reply hack, which should allow a registered user to fill in his User Name & Password, and click on "Post Reply". But currently it's not working, I'm getting the standard "You're not logged in" Vbulletin message. How can I program that when someone clicks on "Post Reply" and has entered his User Name & Passwod in the fields above, it should automatically log him in too?


All times are GMT. The time now is 02:45 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.01017 seconds
  • Memory Usage 1,761KB
  • 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
  • (3)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (15)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