![]() |
Sitewide Announcement.
This was one of my first hacks, but I've learned so much since then so as to completely invalidate the old code. Not that it didn't work, but it's clumsy.
This template mod (there is no code to hack) generates an announcement in the variable of $announcement that you can then put in you're header or you're navbar if you're so inclined. The announcement changes based on the usergroup but also on whether or not registered users have posted or posted recently. The key to the code goes in the PHPINCLUDE_START template. You can put this at the very start or the very end of you're template so long as you don't drop it into the middle of something else. PHP Code:
announcement_all announcement_guest announcement_pending announcement_staff announcement_noposts announcement_noposts14days announcement_registered Ok, that's it and ready to run. You can plug $announcement into your header or the like, though you might want to frame it in a table or layer. You can turn that framing table or layer off when the $announcement is empty like so... <if condition="!empty($announcement)"> <table><tr><td>$announcement</td></tr></table> </if> Now, you can of course do all of the above with raw template conditionals HOWEVER, this approach has the advantage that the $announcement templates are easier to read and modify by someone with very little HTML experience. So, this approach comes in handy for making modification easy for someone else. However, for the curious, here is the SAME system, entirely as a template conditional done in HTML. HTML Code:
<if condition="is_member_of($bbuserinfo, 1)"> Anyway, if you absolutely must do some hacking, you can perform the following hack to optimize this template modification. In your global.php file look for this code PHP Code:
PHP Code:
I'll leave you with EN World's contents of each of these messages to give you some ideas on what to put in each one in order to encourage folks to post and join you're community. ANNOUNCMENT_GUEST HTML Code:
<b>Welcome to EN World, one of the busiest <i>Dungeons & Dragons</i> and HTML Code:
Welcome!! You're seeing this message because you have successfully completed your registration but you've never posted. We'd love to hear from you. <a href="newreply.php?do=newreply&noquote=1&p=1828845">Click here</a> to say Hello and maybe even post a few details about yourself<br /> HTML Code:
Hello. You're seeing this message because you haven't posted in the last 14 days. While participation in the forums isn't required, it is encouraged. We'd love to hear your comments and opinions on all things gaming related. HTML Code:
Welcome to EN World! You have registered a new account, but you still HTML Code:
<b>Welcome to EN World! Please consider becoming a <a href="http://www.enworld.org/forums/subscriptions.php?">community supporter</a>. A community supporter is somebody who has donated to EN World in order to help cover the costs of very server-intensive, and thus expensive features (in particular, the search feature). The features available only to community supporters are Search, Private Messaging, Custom User Titles, Who's Online and EN World's in-built RPG. Note that you can also get these features separately.</b> |
Screenshots please :0
|
Ok, these are two of the three messages we have (the third is a reminder to users awaiting email confirmation about what they need to do to activate their account fully - since it's annoying to log out and make up a dummy account, then delete that account after the screen shot, I'll skip it).
|
Where in $phpinclude_start does your code go, it does not say in the instructions?
|
Quote:
|
You could do this with just conditionals in the header template. :)
|
Quote:
|
Quote:
|
Quote:
But specficly you can use <if condition="$bbuserino[usergroupid] == X"> Or <if conditon="is_member_of($bbuserinfo, X)"> |
Bumping this up after a long dormancy. I complete rewrote the first message here, so the replies between this post and the start probably don't make much sense.
|
All times are GMT. The time now is 10:53 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|