vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   Dynamic Announcements: Programmable Forum Home Announcement/Message with conditionals (https://vborg.vbsupport.ru/showthread.php?t=97073)

Konstantinos 08-26-2008 09:12 AM

Quote:

Originally Posted by morrow (Post 1024489)
Nice hack... had it installed for a while but unfortunately, Photopost no longer functions when this product is enabled. Once I disabled the product, Photopost fired right back up again.

I noticed someone else asked about this but didn't get a response. Does anyone have this working with VBA/Photopost?

Thanks

*I'll leave it installed until tomorrow night. I'll fool around with it a little and if I figure anything out, I'll be sure to post the results. Too bad, I really liked this one!

this conflicts with photopost when the hack is configured to be used in all pages. can u fix it ?

Ransy72560 01-18-2009 08:07 PM

Great mod, thanks so much for this! Installed!

JoeBOBBillyTed 02-12-2009 12:24 PM

For the guy wanting the img code, I believe you can use HTML.

<img src="Img URL GOES HERE" />

JoeBOBBillyTed 02-15-2009 02:39 PM

[[($bbuserinfo[lastvisit]<='1234704000' AND strtotime("now") < '1235258206')]]<a href='http://www.sportscardfreaks.com/forums/contests/137396-new-guess-ending-price-contest-free-cards-join.html'>New Contest For All</a> - Check it out, if you collect another sport, a replacement prize will be offered :)[[/($bbuserinfo[lastvisit]<='1234704000' AND strtotime("now") < '1235258206')]]

I am trying to make it so that this message shows up only to people that haven't visited the site since a certain date, and I want the messages to stop showing up at a certain date. Finally, I want the message to show up 1 time only.

JoeBOBBillyTed 02-17-2009 02:06 PM

No one?

tafreeh 08-09-2009 03:42 AM

does it work with 3.8?

ruchemist 12-27-2009 07:14 PM

Quote:

Originally Posted by tafreeh (Post 1863895)
does it work with 3.8?

Yes, it works. Version 3.8.4 - tested

dhaimy 01-20-2010 06:39 PM

thanks
an update vb4

TexArkana 06-19-2010 05:23 AM

FWIW... I'm using this in vB 3.8.5, along with the hack to make the announcement appear on every forum page, not just FORUMHOME. Works fine. (Nice mod BTW. Thanks!)

imedic 02-16-2011 08:02 AM

Quote:

Originally Posted by dc3dreamer (Post 827831)
Update #2 (final!): All is well now. Here is the code for dynamic_a() which implements nested conditionals:
Code:

function dynamic_a($logician_dfa_incoming1)
{
    extract ($GLOBALS);

    // Prevent successive conditionals on separate lines from generating
    // spurious <br /> after running thru BbCode parser. You might not
    // like this, it's optional.
    $logician_dfa_incoming1 = ereg_replace("\]\][\r\n\f \t]*\[\[", "]][[", $logician_dfa_incoming1);
    // Recursively process nested conditionals
    $logician_dfa_incoming1 = trim(dynamic_b($logician_dfa_incoming1));
    // Finish up by running result through BbCode parser
    if (trim($logician_dfa_incoming1))
    {
        $parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
        $logician_dfa_incoming1 = $parser->do_parse($logician_dfa_incoming1, 1, 1, 1, 1, 1, 1);
    }
    return $logician_dfa_incoming1;
}

function dynamic_b($dc3dreamer_dfa_incoming1)
{
    extract ($GLOBALS);

    while (preg_match("/\[\[(.*)\]\](.*)\[\[(\/\\1)\]\]/siU", $dc3dreamer_dfa_incoming1, $matches14))
    {
        @eval ('if ('.stripslashes($matches14[1]).') { $eval_deger= "1"; } else { $eval_deger= "0"; }');
        if ($eval_deger == 1)          //if conditional applied, replace with inner text
        {
            $dc3dreamer_dfa_incoming1 = dynamic_b(str_replace($matches14[0], $matches14[2], $dc3dreamer_dfa_incoming1));
        }
        else                            // Conditional not applied, delete the whole chunk
        {
            $dc3dreamer_dfa_incoming1 = dynamic_b(str_replace($matches14[0], '', $dc3dreamer_dfa_incoming1));
        }
    }
    return $dc3dreamer_dfa_incoming1;
}

The recursion continues until there are no conditionals found, at which point the final result is passed through the BbCodeParser at the end of the first method. The trick was to remove line endings from conditionals that follow one another with just newlines between. They generated extra breaks and line spacing after going through the BbCode parser. You might want to remove the * in the regexp for the call to ereg_replace(). Er, do I really have to name my parameter variable like it might exist in the host page? I hope not, but I copied Logician's style. I would have used sumpin' like $src for the parameter var :nervous:

I'm slowly coming up to speed on PHP :nervous: I was killed by the $bbuserinfo[membergroupids] variable testing against values, till my ancient Perl tablets fell out on the ground. Yumba! It can be an array and it may not even exist! Well, rookie me! I got it now.

This is so nice! Nested conditionals open up a whole new world of possibilities, but ... Thank you Logician Thank you Logician Thank you Logician ...

I have read almost all of this thread but can't figure out where to put this code ....
Does it goes in the window where you put the announcements, or you need to do some file editing?
A short how to use description would be v appreciated. :)

Very good mode, mostly for the pop up. The conditional announcement can be done easyer with other mods however this one gives maximum flexibility.
For example I need to make an anouncement show if you have not selected aditional usergroup and probably this one can help.
Thanks for the mod. Will install soon.


All times are GMT. The time now is 03:07 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.01437 seconds
  • Memory Usage 1,751KB
  • 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
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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