vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   post pop-up menu conditional (https://vborg.vbsupport.ru/showthread.php?t=82471)

Bad Bunny 06-06-2005 12:20 AM

wow
That's some great thinking there! Thanks, man!

Andreas 06-06-2005 12:40 AM

A (maybe) easier approach:

In template phpinclude_start add

PHP Code:

$buddyarray explode(' '$bbuserinfo['buddylist']); 

In Template postbit
FIND
Code:

<if condition="$post['userid']">
        <tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
</if>

REPLACE that with
Code:

<if condition="$post['userid'] AND $post['userid'] != $bbuserinfo['userid']">
<if condition="!in_array($post['userid'], $GLOBALS['buddyarray'])">
        <tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
<else />
        <tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=removelist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[remove_x_from_buddy_list]</phrase></a></td></tr>
</if>
</if>

And add the phrase as tmhall suggested.
The advantage over tmhalls suggestion is that this does require less processing (explode() is only executed once), and you don't have to modify the php files.

zetetic 06-06-2005 02:03 AM

Quote:

Originally Posted by Bad Bunny
wow
That's some great thinking there! Thanks, man!

Thanks. I did the same for the ignorelist, btw. It looks like Kirby's idea might be better though. But...

Kirby, you can do explode in the phpinclude_start template? I tried it in the postbit but it said explode wasn't allowed to be used in templates. I didn't know phpinclude_start existed. :nervous:

Andreas 06-06-2005 02:18 AM

Yes you can.
In normal Templates you can use only a few functions.
But phpinclude_start is a special template where you can place PHP - only PHP.
The code there will be executed by global.php

zetetic 06-06-2005 02:22 AM

Well I'll be damned. That's good to know, thanks. :)

Yep, that works like a charm. Thanks again, Kirby.


All times are GMT. The time now is 03:12 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.01783 seconds
  • Memory Usage 1,727KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete