Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons

Reply
 
Thread Tools
Import Unread News from a Forum Details »»
Import Unread News from a Forum
Version: 3.0, by antialiasis antialiasis is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Version: 3.5.4 Rating:
Released: 05-08-2006 Last Update: 06-23-2006 Installs: 16
Uses Plugins Template Edits
 
No support by the author.

This hack will allow you to specify one or more forum IDs in your Admin CP as "news forums". Every time a thread is created in these forums, all users will see an "Unread news" notification at the top of every page of the forum until they view the unread news thread. If many news threads are unread, they will all be shown in the notification and removed one by one as each thread is viewed.

This hack both serves to make sure all users are aware of posted news and to give users who return after a long absence a quick rundown of what has been going on in the forums since they last were there.

As of version 2.0, it is possible to specify:

- Time cutoff: all news older than x days will count as read
- Only check for read status on latest x threads: only the latest x news will be shown if unread; all older news will always be treated as read
- Maximum number of news to display at one time: if a user has more unread news (after the time cutoff and latest x filter) than the number specfied, only that number will actually be displayed on the page
- Whether to make users see news created before they joined as unread
- Whether to show the date and time when each news thread was made or just the date

Please note that you must have Paul_M's Display who has read a thread hack installed for this to function correctly! You don't need to actually have the people who have read the thread shown for anybody at all (heck, if you're completely uninterested in what that hack does, you don't even need to make the template edit for it), but as long as it's installed, this hack will work.

Version 3.0 adds the ability to have more than one news forum and to set a PHP condition for each forum which must be met in order for news from that forum to be imported.

Installation

Simply download the product attached to this post and import it via the Admin CP Product Manager. Then make one template edit: add

Code:
$unreadnews
to the bottom of the header template.

------------------------------------

If using PHP version 4.x (or if you are getting an error message that looks something like Fatal error: Call to undefined function: array_combine() in /public_html/global.php(359) : eval()'d code on line 139), you additionally need to find this line in the Import News plugin on the hook global_start:

PHP Code:
   $newsarray array_combine($newsids$newsinfo); 
Replace it with

PHP Code:
   $newsarray = array();
foreach (
$newsids AS $key => $id)
{
   
$newsarray["$id"] = $newsinfo["$key"];

If using PHP 5 or later (which is the case if you don't get that error message), you will not need to make this edit.

------------------------------------

Afterwards, go to your vBulletin options, find the News Import System setting group, specify your news forum(s), set the other settings if you want, and turn the system on.

Don't forget to click Install if it's working for you. Enjoy!

Version 3.0: Added ability to have multiple news forums and use conditionals.
Version 2.23: Important bugfix from version 2.22
Version 2.22: Bugfixes
Version 2.21: Cutting off on the user's join date has been made an optional feature specified in the admin CP, and some unnecessary code has been removed. Also added alternative templates for no particular reason.
Version 2.2: Fixed uncached template, added "More..." link that links to the news forum when unread news are cut off by "Maximum number of news to display at one time" option, and all news created before the user registered will now count as read for that user. (Imagine registering and having twenty "unread news" notifications you have to plough through...)
Version 2.01: Added template edit information (I'm an official idiot for forgetting that) and fixed table prefixes.
Version 2.0: Added functionality (see above)

----------------------------

EXTRA: Alternative templates

If you don't like the way the current unread news box looks, I've got some more standard-looking templates you can use instead if you want. This also allows you to collapse the unread news, which might be useful. Just replace the templates, see how it looks, and revert the templates again if you liked the other look better.

Alternative custom_unreadnews template:

Code:
<if condition="$show['unreadnews']">
<br />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
   <thead>
      <tr>
         <td class="tcat"><a href="#top" style="float:$stylevar[right]" onclick="return toggle_collapse('unreadnews')"><img id="collapseimg_unreadnews" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_unreadnews].gif" alt="" border="0" /></a> Unread News</td>
      </tr>
   </thead>
   <tbody id="collapseobj_unreadnews" style="$vbcollapse[collapseobj_unreadnews]">
      $newsitems
      <if condition="$show['importnewscutoff']">
      <tr>
         <td class="alt1"><a href="forumdisplay.php?$session[sessionurl]f={$vbulletin->options['importnewsforum']}" class="smallfont">More...</a></td>
      </tr>
      </if>
   </tbody>
</table>
</if>
Alternative custom_newsbit template:

Code:
      <tr>
         <td class="alt1">$timestamp: <strong><a href="showthread.php?$session[sessionurl]t=$id">$info[title]</a></strong></td>
      </tr>

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 05-10-2006, 06:11 PM
rmxs rmxs is offline
 
Join Date: Apr 2006
Posts: 419
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

DISAPEARD..
i make this change byt if i refresh my page i dont see the block like the attach file,also the global attachment block missing
Reply With Quote
  #23  
Old 05-10-2006, 06:21 PM
Snake's Avatar
Snake Snake is offline
 
Join Date: Mar 2005
Location: Cleveland, OH
Posts: 3,832
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is very nice!
Reply With Quote
  #24  
Old 05-10-2006, 06:31 PM
rmxs rmxs is offline
 
Join Date: Apr 2006
Posts: 419
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I try many times and i cannot make the news appeard on the header..
Also take a look maybe there is a bug with the Global Announcement 1.2 Displays an announcement of choice on the index page of your forum.

Because after install its GONE
Reply With Quote
  #25  
Old 05-10-2006, 06:38 PM
DJ XtAzY DJ XtAzY is offline
 
Join Date: Feb 2005
Posts: 204
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i got this error

Code:
Database error in vBulletin 3.5.4:

Invalid SQL:

      SELECT threadid
      FROM +++++ad
      WHERE userid = 1 AND threadid IN (12778,12574,11841,11611,11289,11192,10878,10713,10361,9777,9576,9319,8612,8448,8282,8252,7909,7908,7830,7637,6856,6750,6590,6476,5666,5576,4546,4413,3878,3771,3720,3453,3381,3338,3275,3248,3100,2882,2717,2714,2550,2494,2452,2317,2291,2036,1923,1778,1673,1668,1550,1409,1397,1363,939,933,755,745,735,655,650,595,568,567,541,538,537,529,520,486,478,460,429,406,399,398,374,372,348,317,281,218,183,177,176,175,174,173,157,134,130,122,113,107,99,95,94,78,74,57,55,25,10,2);

MySQL Error  : Table 'forums.+++++ad' doesn't exist
Error Number : 1146
Date         : Wednesday, May 10th 2006 @ 03:36:53 PM
Reply With Quote
  #26  
Old 05-10-2006, 06:57 PM
antialiasis's Avatar
antialiasis antialiasis is offline
 
Join Date: Jan 2006
Location: Iceland
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rmxs
I try many times and i cannot make the news appeard on the header..
Also take a look maybe there is a bug with the Global Announcement 1.2 Displays an announcement of choice on the index page of your forum.

Because after install its GONE
I still don't get it... do you mean the global announcement block is gone, not attachment? In that case, this hack can't have anything to do with it - I just skimmed the global announcement product file and there don't seem to be any clashing settings or variables or anything, and the template edits don't even edit the same template.

And do you definitely have some unread news (remember, any news that *you* create are read, so you either need to make a test account or get somebody else to create a new news item), are you logged in, have you made the template edit I added to the first post a while ago, and have you turned the system on in the Admin CP?

XtAsY, it looks like you haven't installed Paul_M's 'Display who has read a thread' hack (linked to in the first post).
Reply With Quote
  #27  
Old 05-10-2006, 07:02 PM
monkeywarplane monkeywarplane is offline
 
Join Date: Sep 2005
Location: Bay Area
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would love this plugin, will check this out later when the bugs are fixed.

Good luck

Stuart
Reply With Quote
  #28  
Old 05-10-2006, 07:09 PM
rmxs rmxs is offline
 
Join Date: Apr 2006
Posts: 419
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by antialiasis
I still don't get it... do you mean the global announcement block is gone, not attachment? In that case, this hack can't have anything to do with it - I just skimmed the global announcement product file and there don't seem to be any clashing settings or variables or anything, and the template edits don't even edit the same template.

And do you definitely have some unread news (remember, any news that *you* create are read, so you either need to make a test account or get somebody else to create a new news item), are you logged in, have you made the template edit I added to the first post a while ago, and have you turned the system on in the Admin CP?

Everything look correct byt the BLOCK OF GLOBAL ANNOUCEMENT GONE if i unistall your Plugin appeard again...

(remember, any news that *you* create are read, so you either need to make a test account or get somebody else to create a new news item)

I forget that

EDIT: i check again byt nothing happent with new user(No Block)


i make again the install byt still THE BLOCK GONE


Try plz to install to your system to check this out
Reply With Quote
  #29  
Old 05-10-2006, 07:23 PM
antialiasis's Avatar
antialiasis antialiasis is offline
 
Join Date: Jan 2006
Location: Iceland
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

monkeywarplane: Oh, it DOES work if you do everything correctly. I now installed the exact product that's attached to the first post on a test forum, making exactly that template edit exactly as said, and it worked fine. XtAsY was having problems due to not having installed the plugin you need to have first, and rmxs's problem was that he didn't have any unread news. You're safe installing it as it is now.

rmxs: I installed Global Announcements on my test forum with this hack and it worked fine... =/ I don't know what's different on your forum, but it's clearly not a problem with the hack itself.
Reply With Quote
  #30  
Old 05-10-2006, 10:34 PM
TomasDR TomasDR is offline
 
Join Date: Feb 2006
Posts: 121
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by antialiasis
Oh, crap... more screw-ups...

What you're supposed to do is add $unreadnews to the bottom of the header template. It sounds odd that $unreadnews wouldn't be working, though. (You were testing it as logged in, right? And enabled the hack in the Admin CP, specified a news forum and all that?)
Maybe I had only tried $newsitems in the header template, it is working now.

Don't forget to add the " . TABLE_PREFIX . " to your select statements.
Reply With Quote
  #31  
Old 05-10-2006, 10:39 PM
antialiasis's Avatar
antialiasis antialiasis is offline
 
Join Date: Jan 2006
Location: Iceland
Posts: 346
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did, unless something screwed up in attaching the new XML file.

But it's a good thing that it's working for somebody other than me at last. I can breathe now.
Reply With Quote
Reply

Thread Tools

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 11:33 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.05008 seconds
  • Memory Usage 2,314KB
  • Queries Executed 25 (?)
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
  • (4)bbcode_code
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete