Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2007, 10:09 AM
Xplorer4x4 Xplorer4x4 is offline
 
Join Date: Apr 2005
Posts: 938
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Conditonal Help

I am trying to create a conditional to use for the thread prefix hack. I would use two prefixes, one called members and one called guests. If the prefix is guest, i want guests to get a pop up asking them to register, or be redirected to the register.php.

If your familiar with the prefix hack you know the prefix itself can not have HTML mark up, you have to put it in the prefix HTML mark up box ( see screen shot here)

So what kind of mark up could I use?


I got as far as something like

<if condition="({1} == guest (then) $bbuserinfo, 1")><else><if condition="({1} == Members (then) !$bbuserinfo, 1")>

I know that is slopy and i could not think of the proper conditional to use for then, so atleast I tried. If some one could clean that up much appreciated.
Reply With Quote
  #2  
Old 06-21-2007, 10:27 AM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'd say the easiest way would be to just edit the appropriate Thread Prefix plugins. There are 7 "Display Prefix" plugins for each location it shows the Thread Prefix in though..

For example in "Prefix: Display Prefix in Front of Title (Thread)" plugin you could change
PHP Code:
if ($forum['allowprefix'] AND $thread['threadprefix'])
{
    
$thread['title'] = $vbulletin->options['prefixmarkup_start'] . $thread['threadprefix'] . $vbulletin->options['prefixmarkup_end'] . $thread['title'];

to
PHP Code:
if ($forum['allowprefix'] AND $thread['threadprefix'] AND $show['member'])
{
    
$thread['title'] = $vbulletin->options['prefixmarkup_start'] . $thread['threadprefix'] . $vbulletin->options['prefixmarkup_end'] . $thread['title'];
}
else {
echo 
"<script language=\"JavaScript\">\n";
echo 
"alert("Please register to view thread prefixes!");\n";
echo 
"</script>"

Or something.. Haha. I'm not exactly a pro at this stuff though, so I might not be doing it right. Maybe give that a try though!

EDIT: Thinking about it.. I realized this would print the error for every thread prefix that should be on the page though. Might want to insert it somewhere else?

EDIT #2: Although I guess if you would try doing it your way by inserting it into the Prefix Markup box, it would be executing the code for every instance of the thread prefix, too. lol.

EDIT #3: I just realized the plugin in my example was for SHOWTHREAD... not FORUMDISPLAY. lol. I need to lay off the caffeine. The right plugin might be "Prefix: Generate Prefix List (Forumdisplay)"
Reply With Quote
  #3  
Old 06-22-2007, 07:37 AM
Xplorer4x4 Xplorer4x4 is offline
 
Join Date: Apr 2005
Posts: 938
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

One thing i notice is in your code there is no checks to make the prefixes see weather a person is a guest or a member.
Reply With Quote
  #4  
Old 06-22-2007, 07:40 AM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Check the first line.

I'm not saying that will work (since that's not even the right plugin) but I was just using *any* Thread Prefix plugin to get the point across. I didn't exactly spend a lot of time thinking about it. haha.
Reply With Quote
  #5  
Old 06-22-2007, 08:00 AM
Xplorer4x4 Xplorer4x4 is offline
 
Join Date: Apr 2005
Posts: 938
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was told this can all be done via the HTML mark up so I think your code is going to deep in the first place.

This cant be to complicated but what about something like
PHP Code:
<if condition="$show['threadprefix'] = [Guests]">
<else>
<if 
condition="$show['threadprefix'] = [Members]" AND !$bbuserinfo[userid]>Members and pop up code</if> 
Reply With Quote
  #6  
Old 06-22-2007, 09:55 AM
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, what I was trying to explain is that if you were to use a JavaScript alert in the Prefix Markup, it's going to be executing it for every prefix on the page. I don't think 20 popups will be very user friendly? I can't be certain this will happen as I don't know the ins and outs of the code, but I'd say it's more than likely.

Alternately, you could try:
Code:
<if condition="$show['member']">{1}<else /><a href="register.php$session[sessionurl_q]" rel="nofollow">$vbphrase[register]</a></if>
I'm honestly not sure if the link will parse correctly, so you could also just do this:
Code:
<if condition="$show['member']">{1}<else />Register to View</if>

EDIT:
I think you're going to have to alter the plugins. Sorry. It didn't know what to do with the variables I used, so they'd need to be added into the plugin anyway.. OR whoever said conditionals would work in that markup box was wrong. Sorry.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:36 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04246 seconds
  • Memory Usage 2,226KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete