Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Any-forum News hack Details »
Any-forum News hack
Mod Version: 1.00, by JJR512 (Member) JJR512 is offline
Developer Last Online: Jun 2006 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 2.2.x Rating: (0 vote - 0 average) Installs: 21
Released: 18 Dec 2001 Last Update: Never Downloads: 0
Not Supported Is in Beta Stage  

We've all seen plenty of news hacks here before. I'm talking about a hack that gets all new threads in a specific forum and shows the first post from the new threads on a separate, non-vB page. These hacks usually show a specific number of threads that you specify, or all threads from the past number of days that you specify. The forum that these threads come from is setup by you, by putting the forumid numbers in a variable in the hack's code file.

I feel that this is a limited system. You are limited to posting news items only in the one or few threads that you specify up front are to be used to get news items from, and then those forums are limited to only posting news items in (because every new thread in it becomes a news item). This just didn't seem like the best solution to me, because if I wanted to cover a particular topic, for example, computer hardware, I would have to have two separate forums: One to post hardware news, and one for non-news items like help and tips.

So what makes my hack different is that you can now post news items in ANY forum. When you post a new thread, there will be a new option in the same area as "parse urls" and "disable smilies"; this new option is called, "make a news item?" If you leave that box unchecked, the thread gets posted as normal. But if you check it, then not only does the thread get posted, but it will also show up on a separate page. So now, you can post news items and non-news items in the same forum, in any forum, and only the threads you want to be news items will show up as news items.

I have set up a permission for this checkbox, so it will only appear for the usergroups you want it to appear for. Setting this permission is just like setting any other usergroup permission, like the ability for the usergroup to post new threads, move threads, download attachments, etc.

You can change the news status of a thread, in other words, change a thread from being a news item to not a news item, or vice-versa, via a new option that appears on the Edit Thread screen from the Admin Tools.

This hack also includes a simple "latest threads" feature, that on the same page as the news items will show the most recently-replied to threads (the most recently active threads). I did these two things together because I knew they would be very similar to code, and would appear on the same page. However, each part is completely separate from the other part, and it is very easy to only use one part of the hack or the other.

Here is an image of the checkbox:


Here is the new permission setup (by default, for any new usergroups you create, this permission will be set to 'NO'):


There is a working demo of this hack. The test forums is located here, and the news page is located here. You can use the test forums as an unregistered user; I have set up the unregistered usergroup to have Super Moderator powers, so you should be able to play around with the Edit Thread admin tool, etc.

I'm posting this in the Beta forums because I'd like for some other people to let me know it works OK for them. It works fine for me, on two boards; I originally wrote it and developed it for my regular board, which was heavily hacked to begin with. I then setup a clean, unhacked, totally stock board as a testing grounds, and recreated the hack, and again, it worked fine. I want to confirm that it works fine for at least one other person, but I'm also hoping that someone more experienced than myself can take a look at it to see if I've coded it the best way possible.

The other issue I hope to address here in Beta relates to how the text from news item threads is formatted to appear on the news page. Currently, this hack gets the entire contents of the first post of a thread, and it is run through the bbcode parser, so what you see on the news page is just like what you see in the thread itself, including smilies, all vB Code tags converted, etc. Also, the entire post is used; it is not run through any process that limits it to a certain number of characters. The reason I did not set up a character limit was mainly so that the bbcode parser would not get confused if a closing tag was completely or partially cut out. I figured that since I included a permission system, that at least for me would limit the ability to make a thread a news item to Admins and Mods, I could teach my staff to keep news item threads short.

However, I have toyed with the idea (in my mind) of changing the hack so that if you check a box to make a thread a news item, when you submit the thread, instead of the thread being posted straight away, instead, first you are taken to another page with a textarea containing the contents of the post. In this second textarea, which contains what you just typed in the normal newthread screen, you can edit or change what you typed, and what you do here would get stored in an additional field added to the thread table, and this is what would get shown on the news page. That way, you could start a thread, put an entire news article in it or whatever, mark it to be a news item, submit it, then pare down the contents of the post to just a little blurb suitable for a news item display on the news page, while the original bit you typed gets saved as a post and shown in the thread as normal. (Hope that makes sense.) If I hear enough of a demand for something like this, or get any other ideas, I may consider it. The downside to this is it becomes a little more complicated to post a news item thread.

OK, so install it or play with the demo, and let me know if it's ready for a full release!

Edit on Jan. 1, 2002: This hack has been updated to Version 2, with new features as discussed throughout this thread. Please go to this post: http://www.vbulletin.org/forum/showt...281#post210281

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Add-On Releases DnP AJAX Custom News Link - Offer the best news to your forum visitors silveryhat vBulletin 3.8 Add-ons 129 19 Mar 2013 05:15
Forum News (News in a Forum) JJR512 vBulletin 2.x Full Releases 91 17 Sep 2003 18:09

  #16  
Old 19 Dec 2001, 00:48
bigmattyh's Avatar
bigmattyh bigmattyh is offline
 
Join Date: Nov 2001
Hey, I've noticed that the news index file only seems to work on my system when I place it in the forums directory. Is there any way to fix this so that it works in any directory? Or did I mess something up?
Reply With Quote
  #17  
Old 19 Dec 2001, 02:14
bigmattyh's Avatar
bigmattyh bigmattyh is offline
 
Join Date: Nov 2001
Here's a little modification I made to fit my purposes:

FYI, if you want to use HTML in your news instead of vbcode, you can go into the homeindex.php file and replace
$gnpagetext=bbcodeparse($gnpagetext);
with:
$gnpagetext=bbcodeparse2($gnpagetext,1,1,1,1);
It's a little rough -- I guess ideally, you could have the code detect vbcode or html with regular expressions, and then have it do either the vbcode parser or the html parser. But that's beyond what I need!

Thanks for the hack -- I'm still looking forward to see if anyone else has the same problem with getting the homeindex.php file to work outside of the forums directory.
Reply With Quote
  #18  
Old 19 Dec 2001, 03:39
bigmattyh's Avatar
bigmattyh bigmattyh is offline
 
Join Date: Nov 2001
Okay, okay, I'm going crazy with my own customizations...

Hey JJR, I hope you don't mind, but since you created a hack that I really happened to need -- at the moment I needed it -- I made a couple of customizations that really suited my purposes.

This is one I think a lot of people might be interested in.

I've always liked being able to cut short a news article on the main page, say, to a paragraph or two. Then you can click on a "READ MORE" link or something to that effect, so you don't end up taking up so much space on your home page.

So, I've modified the aforeposted hack to add this functionality.

This extra little bit of code will read the post, separate out the paragraphs, and if the post runs longer than your preset maximum number of paragraphs, it adds a "MORE >>" link at the end of the text.

Around line 20-ish, you'll see a line like this:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

After this line, insert the following code:
Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

$maxpars (in case you couldn't guess) is the maximum number of paragraphs you want to show. If you set it to 1, you'll only see one paragraph of the news, etc. etc. etc.

And you'll have to add $gnmorelink after $gnpagetext in the templates.

Please test it out! Enjoy!

Last edited by bigmattyh; 19 Dec 2001 at 22:41.
Reply With Quote
  #19  
Old 19 Dec 2001, 08:06
Goldfinger's Avatar
Goldfinger Goldfinger is offline
 
Join Date: Oct 2001
Looks GREAT .. one feature i'd like to see is maybe being able to include the person's avatar if they have one.
Reply With Quote
  #20  
Old 19 Dec 2001, 15:50
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
Installed this beta hack for a test and Im not able to keep the Can make new threads a News item ticked on the option I need.

Its ticked on (NO) as default, but when I go to change the option to (YES) it does not save it, so therefore the option does not appear in the bottom table of the post.

Also, were does the homeindex.php file go, is it into root of the forum or admin?.............. does not say? and were is the newspages called from/viewed by the members or must a link be placed in a template?

Thanks,

Reply With Quote
  #21  
Old 19 Dec 2001, 16:07
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Real name: Justin J. Rebbert
The file homeindex.php goes in the forums folder. So far, I haven't gotten it to work outside of it, although it should be a simple matter of changing the path to global.php at the top of the file.

As for your other problem, I'm not sure I understand...is it that the checkbox does not stay checked? Or the option itself does not show up at all?
__________________
-Justin J. "JJR512" Rebbert
www.JJR512.com: Chat about anything!
Reply With Quote
  #22  
Old 19 Dec 2001, 16:11
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
The option shows ok, but when checked it does not stay checked but reverts back to its original setting.

;(


Originally posted by JJR512
The file homeindex.php goes in the forums folder. So far, I haven't gotten it to work outside of it, although it should be a simple matter of changing the path to global.php at the top of the file.

As for your other problem, I'm not sure I understand...is it that the checkbox does not stay checked? Or the option itself does not show up at all?
Reply With Quote
  #23  
Old 19 Dec 2001, 18:32
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Real name: Justin J. Rebbert
If the checkbox isn't staying checked, I would suspect something is wrong with the installation of the hack. Possibly related to Step 2-B-2...it sounds like the setting isn't getting stored in the database. Can you run through the installation steps again, comparing what it says to do with what you actually did?

Unless you find any problems there, can you use something like phpMyAdmin or some other way to look at the database? If so, start a test thread, mark it to be news, and post it. Then look in the database, in the threads table, find the new thread (look for the threadid), and see if the isnews column for that thread is 0 or 1 (should be 1).

Anybody else having this problem?
__________________
-Justin J. "JJR512" Rebbert
www.JJR512.com: Chat about anything!
Reply With Quote
  #24  
Old 19 Dec 2001, 19:43
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
Did what was said (below) but Im not getting the link to show that enables me to post the thread, see attached.

Strange?




Originally posted by JJR512
If the checkbox isn't staying checked, I would suspect something is wrong with the installation of the hack. Possibly related to Step 2-B-2...it sounds like the setting isn't getting stored in the database. Can you run through the installation steps again, comparing what it says to do with what you actually did?

Unless you find any problems there, can you use something like phpMyAdmin or some other way to look at the database? If so, start a test thread, mark it to be news, and post it. Then look in the database, in the threads table, find the new thread (look for the threadid), and see if the isnews column for that thread is 0 or 1 (should be 1).

Anybody else having this problem?
Reply With Quote
  #25  
Old 19 Dec 2001, 19:47
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
Followed the Instructions 110% and still not able to get the box to stay ticked.

Strange?
Reply With Quote
  #26  
Old 19 Dec 2001, 20:00
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Real name: Justin J. Rebbert
I guess part of my problem understanding your problem has been some communication difficulties... specifically, you talking about the check box, when what I see you really meant was the radio button. You see, square boxes that you put a checkmark into are called "check boxes", while round circles that you put a dot into are called "radio buttons" (don't ask me why it's called a "radio button" when it's not a button). Now see this creates a problem when you are talking about a check box, and the only check box related to this hack is the one that makes a thread a news item, so that's what I think you are talking about. Please understand, I don't mean this as an attack against you, I just mean this as helpful advice, to create better understanding.

You can send me a copy through email (do not attach it to a message here!) of your usergroup.php file to webmaster@jjr512.com and I will see if I can figure out what's out of whack. Also, include in the email a copy of the structure of your usergroup table (just the structure, not the data!).

I'd still like to hear from anyone else that has installed this hack if they have or have not had this problem... I know some people have installed it, and since I'm not hearing any other complaints, I'm assuming it's working fine for everybody else; I just want to be sure.
__________________
-Justin J. "JJR512" Rebbert
www.JJR512.com: Chat about anything!
Reply With Quote
  #27  
Old 19 Dec 2001, 20:08
The Realist's Avatar
The Realist The Realist is offline
 
Join Date: Oct 2001
Real name: Brian
On it's way to you.

Reply With Quote
  #28  
Old 19 Dec 2001, 22:36
sianews sianews is offline
 
Join Date: Dec 2001
Any estimate on when you'll have the URL feature added?
Reply With Quote
  #29  
Old 19 Dec 2001, 22:51
JJR512's Avatar
JJR512 JJR512 is offline
 
Join Date: Oct 2001
Real name: Justin J. Rebbert
Soon! Within a day.

The Realist, I'm having trouble replying to your email...I'm getting return error messages, saying my email cannot be delivered.
__________________
-Justin J. "JJR512" Rebbert
www.JJR512.com: Chat about anything!
Reply With Quote
  #30  
Old 19 Dec 2001, 23:27
floleb7's Avatar
floleb7 floleb7 is offline
 
Join Date: Oct 2001
the count of #comments doesn't work i test on your forum test and in news page i see 0 comments
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 17:11.

Layout Options | Width: Wide Color: