vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Text only viewable by logged in users (https://vborg.vbsupport.ru/showthread.php?t=159980)

shiznatix 10-11-2007 06:10 AM

Text only viewable by logged in users
 
I have a forum post that I would like to make for a tournament but in this post I have to give out a password. Now I don't want just anybody browsing the forums to see the password, I want it to be only visible if you are logged into the forums. So if I was NOT logged in and went to this thread it would look something like this:

Blah blah blah blah blah blah
password: *you must be logged in*
Blah blah blah blah blah blah

but if I WAS logged in, it would look like this:

Blah blah blah blah blah blah
password: super_awesome_password
Blah blah blah blah blah blah

Is there a mod or something that can give me this or should I start diving into the class_bbcode.php and hope for the best? I have tried making a custom bbcode tag but it won't parse PHP

Triky 10-11-2007 09:41 AM

Just editing your template: use this code..

Code:

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

Password: 123

<else />

You must to be logged in.

</if>



;)

Dismounted 10-11-2007 09:58 AM

Yes, but he wants it in a specific thread.

shiznatix 10-11-2007 10:19 AM

Quote:

Originally Posted by Dismounted (Post 1357464)
Yes, but he wants it in a specific thread.

yes exactally. Is there a way to put some template stuff like that in a post if you are a moderator?

--------------- Added at 12:32 ---------------

I made this quick hack to use a [usersonly] bb code tag for this. It just goes like this:


PHP Code:

/***********************************************************
This is Andrews section for a custom [usersonly] bb code tag
************************************************************/
if (false !== strpos($post['pagetext'], '[usersonly]') && false !== strpos($post['pagetext'], '[/usersonly]'))
{
    
session_start();
    if (!empty(
$_SESSION['user']['user']['logged_in']))
    {
        
$post['pagetext'] = str_replace('[usersonly]'''$post['pagetext']);
        
$post['pagetext'] = str_replace('[/usersonly]'''$post['pagetext']);
    }
    else
    {
        
$post['pagetext'] = preg_replace('#\[usersonly\](.*)\[/usersonly\]#''*You must be logged in to view this*'$post['pagetext']);
    }
    
    
$post['pagetext_html'] = '';
}
/***********************************************************
End Andrews section for a custom [usersonly] bb code tag
************************************************************/ 

And I put that in the appropriate places for viewing in hybrid mode, threaded, and regular. Is there an easier way to do this or not because this hack seams like a bit too much.


All times are GMT. The time now is 12:01 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.01038 seconds
  • Memory Usage 1,730KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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