vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Mini Mods - Sections for logged in users in GTCustom Pages (https://vborg.vbsupport.ru/showthread.php?t=154349)

hamidof 08-04-2007 10:00 PM

Sections for logged in users in GTCustom Pages
 
This mod modifies GTCustom Pages, you can download it here:
https://vborg.vbsupport.ru/showthread.php?t=108583

More information here:
https://vborg.vbsupport.ru/showthread.php?t=108586

I was working on a quick project and there was 3 buy now buttons that needed to show up only for members who are logged in.
With a little modification to this hack you can do this:

First find or download goto.php that comes with this package and open it with your favourite text editor.
Find:
PHP Code:

               /* 
    * *************************************
    * PHRASES - no need to parse
    * **************************************
    */
    
$vbphrase['content'] = $vbphrase['gtcustom_' $section];
    
$vbphrase['header_title'] = $vbphrase['gtcustom_' $section '_header'];
    
$vbphrase['sub_title'] = $vbphrase['gtcustom_' $section '_subtitle']; 

It starts at line: 70
Add these lines after them:

PHP Code:

    /**
     * User logged in stuff
     * By Codehead @ talk.code-head.com
    **/ 
    
if( isset($vbphrase['gtcustom_' .$section .'_user_not_logged_in']) && strlen($vbphrase['gtcustom_' .$section .'_user_not_logged_in']) > && !$vbulletin->userinfo['userid'] ) {
        
$regex                     '#__START_USER_SECTION__.*?__END_USER_SECTION__#is';
        
$vbphrase['content'] = preg_replace($regex$vbphrase['gtcustom_' .$section .'_user_not_logged_in'], $vbphrase['content']);
    } else { 
        
$regex                    = array('#__START_USER_SECTION__#i''#__END_USER_SECTION__#i');
        
$vbphrase['content'] = preg_replace($regex''$vbphrase['content']);
    } 

So all together it will look like this:
PHP Code:

    /* 
    * *************************************
    * PHRASES - no need to parse
    * **************************************
    */
    
$vbphrase['content'] = $vbphrase['gtcustom_' $section];
    
$vbphrase['header_title'] = $vbphrase['gtcustom_' $section '_header'];
    
$vbphrase['sub_title'] = $vbphrase['gtcustom_' $section '_subtitle'];
    
    
/**
     * User logged in stuff
     * By Codehead @ talk.code-head.com
    **/ 
    
if( isset($vbphrase['gtcustom_' .$section .'_user_not_logged_in']) && strlen($vbphrase['gtcustom_' .$section .'_user_not_logged_in']) > && !$vbulletin->userinfo['userid'] ) {
        
$regex                     '#__START_USER_SECTION__.*?__END_USER_SECTION__#is';
        
$vbphrase['content'] = preg_replace($regex$vbphrase['gtcustom_' .$section .'_user_not_logged_in'], $vbphrase['content']);
    } else { 
        
$regex                    = array('#__START_USER_SECTION__#i''#__END_USER_SECTION__#i');
        
$vbphrase['content'] = preg_replace($regex''$vbphrase['content']);
    } 

Upload it back to your server.

Then you need another phrase called:
gtcustom_YOUR_CUSTOM_PAGE_user_not_logged_in

And put the text for when the user is not logged in or not a memeber, for instance:
(HTML alowed)

HTML Code:

You must be logged in to purchase this item.<br />
Please take a moment to login or register.

Then in your gtcustom_YOUR_CUSTOM_PAGE phrase wrap the sections in __START_USER_SECTION__ & __END_USER_SECTION__ for instance:

HTML Code:

Some info about the item that you want to sell...
__START_USER_SECTION__
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
...
</form>
__END_USER_SECTION__

Some other item info...
__START_USER_SECTION__
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
...
</form>
__END_USER_SECTION__

You can have multiple sections for logged in users and if they are not logged in, the text in gtcustom_YOUR_CUSTOM_PAGE_user_not_logged_in will be shown.

radarhunter 08-05-2007 01:57 PM

<font color="Red">*Reserved*</font>

Deepdog009 08-05-2007 02:14 PM

I've recently dabbled in the custom page realm and I think this may assist me a bit here and there...

Time & Effort on this deserves a click and vote... :)

P.S ....>>> screenshots with your additions?

beduino 08-05-2007 02:30 PM

tks for share!
all the best
beduino

rooban12 08-05-2007 08:18 PM

thanks a lot ----- need screen shots

Forumi Shqiptar 08-14-2007 06:37 PM

screenshots will be nice please


All times are GMT. The time now is 09:13 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.01051 seconds
  • Memory Usage 1,752KB
  • 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_html_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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