PDA

View Full Version : Any-forum News hack


JJR512
18 Dec 2001, 08:33
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:
http://www.jjr512.com/testvb/attachment.php?s=&postid=6

Here is the new permission setup (by default, for any new usergroups you create, this permission will be set to 'NO'):
http://www.jjr512.com/testvb/attachment.php?s=&postid=7

There is a working demo of this hack. The test forums is located here (http://www.jjr512.com/testvb/index.php?s=), and the news page is located here (http://www.jjr512.com/testvb/homeindex.php). 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/showthread.php?postid=210281#post210281

TheComputerGuy
18 Dec 2001, 11:20
Thats SWEET!!!!!...

i like it

bokhalifa
18 Dec 2001, 15:09
coool


good hack :D

Lesane
18 Dec 2001, 16:17
Fantastic! ;) Well done.

LuBi
18 Dec 2001, 17:05
Great! very well done!

KuraFire
18 Dec 2001, 18:01
Good hack. Not personally needed, but I can see the use of it. Good job :up:

ethank
18 Dec 2001, 18:25
Interesting hack. I might be using this :)

EThan

sianews
18 Dec 2001, 19:23
Looks great, will defintly be using that.

I was trying to modify another script to do the same thing, but here it was, already completed :).

I was having trouble creating a new field (like the checkbox). I want to create a "URL" filed under the title box. If the story has a link people would put the URL in the new field, then the front page (when clicking on the headline) would take you to the news source. Is there anyway to do that?

ThaSpecialist
18 Dec 2001, 20:39
Cool Hack! :D

SirSteve
18 Dec 2001, 20:41
I posted a request for this exact same thing a while back! Very cool! The only thing I can see is that I would like to be able to OK the submitted news threads before they are posted on my home page.

sianews
18 Dec 2001, 20:45
Steve, that's the exact same thing I would like. The news just goes into a queue and you can checkk "yes" or "no". Is that a possibility JJR512?

SirSteve
18 Dec 2001, 20:51
Originally posted by sianews
Steve, that's the exact same thing I would like. The news just goes into a queue and you can checkk "yes" or "no". Is that a possibility JJR512?

exactly...

:)

JJR512
18 Dec 2001, 23:17
sianews, about the URL thing, that should be pretty easy to add, I'll be able to get that done soon. This hadn't occured to me because I include a link to the source article in the message body itself anyway.

Now about the moderation queue for news items... that sounds like a good idea. I'll have to see if I can figure something out. Now do you want the thread itself to still get posted and be visible, while it waits to show up on the news page? Or do you want the thread to not show up at all while it's waiting for approval?

SirSteve
18 Dec 2001, 23:34
Originally posted by JJR512
Now about the moderation queue for news items... that sounds like a good idea. I'll have to see if I can figure something out. Now do you want the thread itself to still get posted and be visible, while it waits to show up on the news page?

Yes, thread gets posted while news awaits approval. Thanks! :D

sianews
18 Dec 2001, 23:54
Sounds great - looking forward to it.

I always put a link in my article too, but this way would eliminate a step. Alternativly, you could make the headline print our like:

"This is the headline" - Read Post

With the headline linking to the source and the read post linking to the post. Also, instead of a checkbox, how about of the URL field has something in it, that acts as the "yes" in order for it to be posted on the front page. But that might limit the usefulness to people doing other things. Maybe an option or something.

bigmattyh
19 Dec 2001, 01:48
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?

bigmattyh
19 Dec 2001, 03:14
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($gnpag etext,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.

bigmattyh
19 Dec 2001, 04:39
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:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

After this line, insert the following code:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


$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!

Goldfinger
19 Dec 2001, 09:06
Looks GREAT :).. one feature i'd like to see is maybe being able to include the person's avatar if they have one.

The Realist
19 Dec 2001, 16:50
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,

:D

JJR512
19 Dec 2001, 17:07
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?

The Realist
19 Dec 2001, 17:11
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?

JJR512
19 Dec 2001, 19:32
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?

The Realist
19 Dec 2001, 20:43
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?

The Realist
19 Dec 2001, 20:47
Followed the Instructions 110% and still not able to get the box to stay ticked.

Strange?

JJR512
19 Dec 2001, 21:00
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.

The Realist
19 Dec 2001, 21:08
On it's way to you.

;)

sianews
19 Dec 2001, 23:36
Any estimate on when you'll have the URL feature added?

JJR512
19 Dec 2001, 23:51
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.

floleb7
20 Dec 2001, 00:27
the count of #comments doesn't work i test on your forum test and in news page i see 0 comments

JJR512
20 Dec 2001, 00:36
Really? It worked fine for me:

http://www.jjr512.com/testvb/attachment.php?s=&postid=16

Which thread did you reply to?

floleb7
20 Dec 2001, 02:16
yes when i add my post there isn't any comments but now i see 1 comment so strange :p

JJR512
21 Dec 2001, 05:13
Just to let you all know, I am still working on the next version of this. I would say I'm about 2/3rds done.

In the meantime, anyone that has already installed the existing version, you can delete the field "summary" from the thread table. It isn't used at all, and I don't know how that part got in there! :o

sianews
22 Dec 2001, 15:32
Any news on the next release?

bigmattyh
22 Dec 2001, 23:28
In the meantime, anyone that has already installed the existing version, you can delete the field "summary" from the thread table.Does that mean that you're planning to get rid of the "summary" feature? If so, let me know. I'd be happy to take a crack at it.

JJR512
23 Dec 2001, 02:00
There is no summary feature. It's not part of the existing hack or the planned update to the hack; it was just one way I thought I was going to do something, then I decided to do it a different way, and forgot to take it out of the instructions.

Dockaych
23 Dec 2001, 17:28
I installed this hack, and I really like it. However, I have encountered some problems.

1. It seems to include the Admin forums on the sidebar. I would like to have some control as to elliminated certain forums from the latest posts.

2. The script right now seems to ignore my custom icons completely. Is there way to make these work?

3. I would really like an option to 'cut off' my news articles. Is there any way we could include a [snip] tag on the article and that would cut off the article right there (manually, rather than after X paragraphs).

JJR512
23 Dec 2001, 20:55
1. I'll be sure to fix it so it excludes forums a user does not have permission to view in the next release. (Does it do that with the main news, too?)

2. Are your custom post icons named the same way as the standard icons? In other words, with the file name being "iconx", where x is a number?

3. The next release will include a way to let you change what shows up in the news page, so that it does not have to be a direct copy of the thread's first post. So if you wanted to post an entire article to start the thread, but trim it down to the first two or three paragraphs for the news, you could do that, or if you put your articles in quote tags for threads but don't want the quote tags for the news, you could do that. Basically, when you submit a thread that you've checked to be a news item, you will be taken to a new form with a copy of the thread's first post (what you just typed out), where you can make separate edits to the message body to control what appears on the news page.

sianews
23 Dec 2001, 21:09
There will be an option to not have the summary - just the headline - show up, right?

And will the URL field be in the next release?

sianews
26 Dec 2001, 02:24
Any update? I'm a little anxious in case you can't tell :).

JJR512
27 Dec 2001, 09:45
I have the basic functionality of the new version working, I'm pretty sure. I still have some details to clean up, such as a way to edit a news item now that news items are stored separately from the thread/post. But I am about to go to bed now, and I would like for some people to test out the new version on a basic level, in case there's something I've missed that doesn't work right.

Let me briefly re-explain how the new version works, first of all.

The old version simply looked in the thread table for threads marked as news items, then found the first post for the thread and got the message body from that post and re-displayed it on a separate page, the news page. What was shown as the news item was always whatever was in the first post of a thread marked as a news item. What I didn't like about that was that for the thread (as seen the normal way in the message board), I might want to post the entire news article that I've copied from some other site, but for the news item (what shows up on the news page), I might only want one or two paragraphs to show up. Just an excerpt, to keep things brief.

Now I could have easily set it up so the news page only shows the first 500 characters, or some other number you choose, of the message body from the thread's first post. But this can throw off bbcode parsing, for example if the 500 characters ends in the middle of a vB code tag. I could just not bbcodeparse what goes on the news page, but then we lose the nice formatting that imparts. Another added bonus is that with the new way I am introducing here, you aren't limited to the first 500 characters; sometimes the second and third paragraphs are better to put on a news page, because the first few lines might just be sub-headline stuff you don't need there. This new method I am introducing here gives you much more flexibility, as you are about to see.

So what is this new method? Well, I described it in my previous post, but I'll reiterate. Basically, when you start a thread and check the box to make it a news item, now what will happen is you will go to a new page which looks a lot like the new thread or new reply page. This page will have the subject (or "headline") and message (or "article") areas already filled with the subject and message you already typed out in the new thread page. But this is where the magic is...you see, you can now edit what is in those areas, to make it different from what shows up in the thread as seen in the message board. What you leave here will show up on the news page. You don't have to make any changes, if you don't want to; you can just leave it as it is, and click the Submit button again, what goes on the news page matches what goes in the thread. But you can change it, you can shorten it, you can remove or add vB Code tags, whatever. If you really wanted to, you could even completely change the text; I don't know why you would want to, I'm just illustrating the independence of the news item from the thread.

Please go here: http://www.jjr512.com/testvb/index.php and test it out. Start a new thread (unregistered users should still have Super Moderator abilities), be sure to check it as a news item, and submit it. Then you see the new form; go ahead and change it, just so you see. After you submit the new form, you get taken to the news page; see how it has whatever you left in the previous form, before you submitted it. Then click the link that takes you to the thread, and see how it still has whatever you originally started the thread with, before you changed it for the news page.

I think all I have left to do is make a way for you to be able to edit the news item (what you see on the news page). Do not bother to do the Edit Thread process, because that now is not involved (the "is news" check box is still there, but that isn't used anymore, I just haven't taken it out yet).

Also, to sianews: You will notice the URL field is there on the new form. So yes, that feature will be there. But so far, I haven't fixed the template so it shows up on the news page yet, but rest assured, it will be there; that's just a cosmetic fix now, since the structure is set up for it.

So please go try it out and let me know what you think. I have to make that edit method I just mentioned, I have to fix back the Edit Thread screen, I have to add that URL field to the news page, I have a few other minor things to put back on the news page, like the nav links...if there is anything else I need to do, let me know.

Once I get those details worked out, I will re-release this hack. But I already have plans for the NEXT release: making it multi-page ready, so you aren't just limited to a hard number of news items, but rather to a number of news items per page, with a "next page" link that takes you to the next xx oldest news items. I also would like to add some type of search feature, that would search through the news items themselves. But we'll worry about these things later; let's focus on what we have now, see that the basic idea works OK, then I'll get those other details taken care of and we'll have us a new release in the next day or two. :)

Dockaych
27 Dec 2001, 11:14
I just tested out your system, and I have to say... it's a little strange. I completely understand how it works, but to me it just seems to overly complicate things!! The advantages of using a forum based news system over something like Newspro are that what will appear on the news listings will be exactly the same as the thread. Your system seems to introduce a completely new and seperate news management system (you will have to have archiving, news editing abilities, etc etc).

I'm not belittling the time and effort you've put into this, I'm just giving my genuine impressions of it.

Personally, I would have preferred to see something more intuitive and frankly less complicated, such as the option of news specific tags in the post, such as This is the summary which will appear on the news page, but will be hidden in the forum. Anyway, this is just my opinion.

The system you have is quite powerful I just hope that it's increased complexity doesn't cripple it's simplicity.

JJR512
27 Dec 2001, 20:26
I understand what you're saying. As with many things, there are multiple ways to accomplish the same overall basic result, and each way as its own set of advantages and disadvantages. I considered some choices and decided on what I felt was best for me; this hack is primarily for me and my own board. I just put it here in case anybody else, after considering what it does and how it does it, decides that this is right for him/her and his/her board, too. :)

But you seem to have uncovered a bug in my system...I'm assuming that you signed a news post with "dock" in bold. Then you deleted the original thread. As it is now, deleting the thread has no effect on the news item, and the news item relies on the threadid to get the forumid, and if the script can't get a forumid, it causes a database error.

I guess what would make the most sense here is for me to fix it so that when a thread is deleted, a news item with the same threadid also gets deleted. In other words, if you delete a thread, any news item from that thread also gets deleted. Anyone have any thoughts on that?

TheComputerGuy
29 Dec 2001, 15:16
I love this hack, and want to install it but all I get is this error

Database error in vBulletin 2.2.0:

Invalid SQL: INSERT INTO post (postid,threadid,title,username,userid,postcount,dateline,attachmentid,pagetext, allowsmilie,showsignature,ipaddress,iconid,visible,hidden) VALUES (NULL,'637','','TheComputerGuy','8','1009638606','0','thats cool','1','1','206.42.40.97','0','1','0')
mysql error: Column count doesn't match value count at row 1

mysql error number: 1136

Date: Saturday 29th of December 2001 10:10:06 AM


I even took a brand new copy of newthread.php and edited it

JJR512
29 Dec 2001, 21:44
It looks like you've done something with an "insert into post" query. My hack doesn't have anything to do with a query like that. I think you've edited in the wrong place.

I don't know how or why, but it looks like the postcount value is missing from this query. In the field names, postcount comes in between userid and dateline; in the values part, it goes right from 8, which I assume is more likely to be your userid and not your post count, to 1009638606, which is a dateline value. (Or if that is your postcount, then it's the userid value that's missing.)

TheComputerGuy
29 Dec 2001, 23:41
I will get a new copy of Vb and insert ur hack first...sorry for taking ur time up, but thanks for the hack

JJR512
30 Dec 2001, 10:28
I believe I have completed the functionality of the new release. There are a few cosmetic things to tidy up, I still have to display the source URL, but basically, it's done.

I would like some more testing/input before I wrap it up as a release...I'll wait a day or two before releasing it.

There are now methods to edit and delete news items, as well as create a new news item based on a thread that wasn't previously a news item.

To edit, click the edit link on a news post's dateline; this will take you to a screen just like an edit post screen. It has the familiar Delete bit at top, and the message below. It works exactly the same way as editing a post.

To make a new news item after you have already posted the thread, simply copy the URL to the thread, then click the link on the news page above all the news items that says, "Create new news item," and copy the URL into the appropriate field on the next screen. This is similar to vBulletin's Merge Threads funtion, the way the screen works. Just put in the URL and submit it; you are then taken to the same screen to edit your news item that you would see if you had done it the normal way, by submitting a new thread and checking the Make News Item box.

Please note that deleting a news item has absolutely no effect on the thread it was based on. However, deleting a thread will delete any news item based on it.

Test board: http://www.jjr512.com/testvb/index.php?s=

JJR512
01 Jan 2002, 07:27
OK, everything seems to work fine, so I'm going to release it now.

For the record, about Dockaych's issue of private forums being shown: I have added a permission-checking system so that any particular user will only see headlines and news items from forums he/she is able to view. This means an Admin will see headlines from admin forums, whereas a regular member will not. To test this, just post something in a private forum, see that you can see it, then log out, and see that you can't see it.

Please let me know if you have any problems with my installation directions or the hack itself.

If you have already installed the previous version, I highly recommend completely uninstalling it before installing the new version. This includes all database modifications, because they are not used by this new version.

EDIT: This hack has been updated; the latest version is here: http://www.vbulletin.org/forum/showthread.php?postid=210456#post210456

slideboxer
01 Jan 2002, 09:02
Awsome, I've been dying to set this up on my board but have been waiting for the release. Thanks, and great job!

slideboxer
01 Jan 2002, 09:37
At the risk of sounding ignorant let me ask this...

The instructions involve creating a new table in the sql database. How do I go about doing this? :stupid:

JJR512
01 Jan 2002, 09:43
Do you have access to a tool like phpMyAdmin, or can you telnet into your account?

slideboxer
01 Jan 2002, 09:44
Got the telnet... Have to check on that tool, though.

JJR512
01 Jan 2002, 09:48
I'm not exactly sure how to run queries via telnet, but maybe someone else can look in the instructions to see what needs to be done, and tell you exactly how to do it via telnet.

slideboxer
01 Jan 2002, 10:03
OKay, I went and found and installed phpMyAdmin.. now what? :stupid:

JJR512
01 Jan 2002, 10:12
Well, you select your database on the left side (if you have more than 1), click it to open the list of all the tables, then on the right side below the list of tables is a box that says Run SQL query/queries etc. Copy the query into that box and hit Go.

Don't forget to make a backup copy of your database first. You can do that through the admin cp.

slideboxer
01 Jan 2002, 11:08
I'm so proud of myself :D Got it up and running, no bugs, no problems. Thanks ofr your tie and help.

The Realist
01 Jan 2002, 11:42
Well done M8, Im glad you finaly have it up and running, especialy from the first version and problems you had.

One thing I like you have done and I hope all other hack makers take note of this is the fact that you state this in your instructions I QUOTE "Near the end of the line, before WHERE, right after "$cangetattachment", add this" in other words, other hacks ask you to totaly overwrite lines and therefore screw previous hacks up, you have asked users to add line rather than overwite.

Nice one.

Congrats M8.
;)

JJR512
01 Jan 2002, 11:53
Yeah, that was how I wrote the instructions originally (to overwrite the entire line), and that's what gave you the problems that you had earlier. It was 100% because of that which made me try to figure out a better way to write the instructions.

Most of the rest of the file modifications are just additions, not modifications of existing code, but there is one part that goes into newthread.php that modifies what's already there, and this will interfere with another hack...I know this because I wrote the other hack, too! It's the one that gives you a different redirect message for if you post a non-poll thread or a poll thread. You kind of have to look at what both hacks want you to do if you want them both to work...or I guess I will post what I, personally, am using on my board to solve it, if anybody needs me to.

Speaking of polls, there is still one thing that I haven't tested with this hack yet, and that's what happens when you check both to make a thread a poll and a news item. I know something not right is going to happen, because both polls and news items involve redirecting you to a different page after the thread gets posted. Either it will take you to the poll setup screen and you'll have to create the news item manually, or it will take you to the news item setup screen and not only will there be no poll in that thread, but it might not be visible, either, because when you check that poll box, the thread isn't made visible until after you setup the poll. I still need to look at this issue, see what happens, and figure out what to do about it. In the meantime, I suggest that nobody try to create both a poll and news item thread at the same time.

TheComputerGuy
01 Jan 2002, 15:29
YAY...

This hack is AWESOME!!!

TheComputerGuy
01 Jan 2002, 15:51
on homeindex.php line 29 it states
$editlink="<a href=\"http://www.jjr512.com/testvb/newspost.php?s=$session[sessionhash]&action=editnews&newsid=$gnresults[newsid]\">(edit this news item)</a>";

That needs to be edited for your site....


Other than that...maybe I missed the instructions for this great hack, as I waited for this version to come out!

slideboxer
02 Jan 2002, 03:08
Is there a way I can call the news from another page, a non-vb page?

JJR512
02 Jan 2002, 06:13
slideboxer, possibly, but I'm not sure what the results would be if you just used a simple include statement...you might need to reformat the templates.

***

After having this hack in operation for a day or so on my real board, I've fixed a few minor little details that escaped me earlier. Most critical, though, is an entire group of instructions that I forgot to include, that without doing, would leave some of the features of this hack unusable. This section of the instructions adds settings to your Admin CP (in the vBulletin Options section as a new group of settings) that allow you to turn on or off vB Code support in news items, the img tag, post icons, etc. It also allows you to set the maximum length of an article, as well as how many appear on the page.

Because there were some minor modifications to the two main code files (newspost.php and homeindex.php), I have attached a new ZIP file to this post. If you have already installed the second version of this hack (posted a day ago), please upload the two main files, and follow Part 5 in the Instructions (the first four Parts are the same and can be skipped). If you have installed the original version (from the first post), please uninstall it by reversing the directions, then just start with the new version from scratch.

EDIT: Hack updated; see Post #69

The Realist
02 Jan 2002, 11:28
How can I make a already made post a news Item, I see the option when you first make a post but when I go and edit a post an option is not there?

Other than that, great hack.

Owe, the second part worked well.

JJR512
02 Jan 2002, 18:18
On the news page (homeindex.php), to only people that have permission to post news, there should appear a link that says "Create New News Item" just above the list of news items (just above the first item). You should copy the URL to the thread you want to make a news item from, then click that link, and paste the URL into the form. From there, the process is just like if you did it when you posted the thread. Please note, this only allows you to make a news item from the first post in the thread...this is a limitation that just ocurred to me, and something I may work on for a future version.

The Realist
02 Jan 2002, 19:25
Regarding the below, Ummmmmm NO!

I dont know if Im doing something wrong but the link "Create New News Item" does not appear (see attached pic)

????? Lost

:confused:


Originally posted by JJR512
On the news page (homeindex.php), to only people that have permission to post news, there should appear a link that says "Create New News Item" just above the list of news items (just above the first item).

slideboxer
02 Jan 2002, 19:29
I'm having the same problem. No linkie :(

JJR512
02 Jan 2002, 21:34
In homeindex.php, please find:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


And change this to:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Also, please make sure that you installed the template main_news_showcreatelink with the contents from the text file of the same name, and that your usergroup permissions are set to allow posting news items.

The corrected homeindex.php is also in the ZIP file in the previous attachment.

The Realist
02 Jan 2002, 22:06
main_news_showcreatelink

I cannot find this template in my downloaded version?

JJR512
02 Jan 2002, 22:39
OK, sorry about that! That was a change I made to homeindex.php, to use a template for the link rather than having it hardcoded in the file. But I forgot to include the new template.

The new template is in the attached ZIP. Please add the new template, also please UPDATE the template main_newindex because it has changed as well (I moved the link to below the news items rather than above it, for cosmetic reasons; you do not have to make this change if you'd rather have the link above). May as well also re-upload the two .php files, too.

UPDATE: This hack has been updated, as mentioned below in Post #81, where the attachment is now located.

The Realist
02 Jan 2002, 23:32
I have another problem.

When I say yes to "Can post news items" the option called "Can post news items" changes to No and does the opposite if I say No it chages to yes.

Is this suposed to happen?

Also the option "Can post news items" never stays ticked when saved.

Strange?

:confused:

JJR512
02 Jan 2002, 23:38
You must have something backwards in your usergroup.php file...I'll take another look at it for you, if you want.

The Realist
02 Jan 2002, 23:46
Sent email asking for your addy M8.

Thanks again.

Brian

Originally posted by JJR512
You must have something backwards in your usergroup.php file...I'll take another look at it for you, if you want.

JJR512
03 Jan 2002, 00:27
Your direct email address doesn't seem to be working...so: webmaster@jjr512.com

JJR512
03 Jan 2002, 01:33
I have the file fixed for you, but am unable to send email to either of your two addresses; they're getting returned.

The Realist
04 Jan 2002, 03:14
Sorted the templates out and all seemed fine. I started to install a few news pages for members and in fact did 8 all 100%.

Here: http://www.skytronic-forums.com/homeindex.php

The problem I have now is it will not let me enter a 9th news post, coming back with a mysql error:

Database error in vBulletin 2.2.1:

Invalid SQL: SELECT forumid FROM thread WHERE threadid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

Date: Friday 04th of January 2002 03:13:35 AM
Script: http://www.skytronic-forums.com/newspost.php
Referer: http://www.skytronic-forums.com/newspost.php?s=&action=makenewnews

And now regardless of what post I try it comes back with the same error?

:confused:

JJR512
04 Jan 2002, 07:20
1. How were the first eight news items created...did you do it when you posted the threads, or afterwards using the Create New News link and a pre-existing thread URL, or a mix of both methods?

2. Which method were you using when this error first ocurred?

3. Does the method now happen all the time, regardless of which method you use, or are you able to post news items one way but not the other, and if so, please say which method works and which doesn't.

The Realist
04 Jan 2002, 12:25
Originally posted by JJR512
1. How were the first eight news items created...did you do it when you posted the threads, or afterwards using the Create New News link and a pre-existing thread URL, or a mix of both methods?

1) The first 8 news items were created using the "Create New News Item" and worked 100%.

2)They were made a news item after the posts were created and I did not mix both methods.

Originally posted by JJR512
2. Which method were you using when this error first ocurred?

1) The error now shows up when I try to create a news item via the link on the news page.


Originally posted by JJR512
3. Does the method now happen all the time, regardless of which method you use, or are you able to post news items one way but not the other, and if so, please say which method works and which doesn't.

1) If I use the create a new news item in the news page yes it does show up all the time, but it I make a post a news item when its first created it works 100%.

slideboxer
04 Jan 2002, 15:00
Also getting an error when posting polls. I added the following code to newthread.php



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



As per instructions but when I post a poll in the forums I get the standard "You will now be redirected, etc...) message and then the screen goes blank and sits at newthread.php

JJR512
04 Jan 2002, 21:21
The Realist, after the last time the link worked for you, but before it stopped working, did you do anything like re-upload the files, apply any other hacks, etc.? Just trying to figure out what would cause it to suddenly stop working, so I know where to look to fix it.

slideboxer, yes, it does not work with polls right now. I already pointed that out, and said that for now, you probably shouldn't check both boxes at the same time.

The Realist
04 Jan 2002, 21:27
No........

I was posting news and finished the 8th post and it would not let me do the 9th, thats it?

Simple!

:)


Originally posted by JJR512
The Realist, after the last time the link worked for you, but before it stopped working, did you do anything like re-upload the files, apply any other hacks, etc.?.

JJR512
07 Jan 2002, 17:59
The Realist, I don't know what to tell you...there's no logical reason it should work one minute, but not the next, unless it was some kind of problem that everyone was having. I don't have it, I know another website that uses this and they don't have it... If you'd like to discuss it further, please contact me via PM or email. I might like to look at your database or try posting a news item myself.

***

This hack has been updated to have the multi-page feature. This is just like a forumdisplay or showthread, so now instead of being limited to showing the most recent 10 (or whatever number you specified) news items, users can have access to older items by just going to the next page.

I will probably next try to see if I can come up with a date limiting option instead of just a hard number, so you can set it so all news items from the past day or two days or whatever show up, regardless of how many items that is.

If you already have installed the previous version, all you need to do is re-upload homeindex.php and update the main_newindex template, either with the one from the text file if you haven't modified it, or by adding $pagenav to an appropriate location (this is the variable that displays the page links).

DarkReaper
08 Jan 2002, 01:25
It'd be very helpful if you posted all updates in the main post, as well as a link to the attachment. I was re-routed 4 different times when trying to find the download... :)

slideboxer
08 Jan 2002, 05:05
When will you get the POLL function operating?

JJR512
08 Jan 2002, 05:31
Well, I just don't see that it's possible to post a poll and news item at the same time...each requires you to go to separate redirects for a setup screen. It's either one or the other. If you really want a news item from a poll thread, you should post the thread as a poll, then copy the URL and use it to make a new news item via the link on the news page.

I suppose what I need to do is put in a routine either like the one you made, which assumes that if the poll box is checked, to make it a poll and not a news item, or else the opposite version that assumes if the make news box is checked, to do that instead of making it a poll.

Comments?

slideboxer
08 Jan 2002, 05:44
What if it redirected to a template that contained the setups for both news and polls?

JJR512
08 Jan 2002, 05:50
I'm sure it's possible, it's just sounds more complicated than I want to think about right now. :stupid:

slideboxer
08 Jan 2002, 05:55
Don't let that stop you :D

Thanks for the hack, BTW.

Mutt
16 Jan 2002, 23:35
Originally posted by bigmattyh
Around line 20-ish, you'll see a line like this:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

After this line, insert the following code:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------




this didn't work for me

here's my copy of the script
http://www.ccdv.com/forum/homeindex.php?s=&styleid=1
I'm still working on it and would like to read more link.

I'm using the original simple multiforum news hack, not the newest one. bigmattyh, help me out! :)

NOTE : I didn't make your first change to allow html.

TECK
20 Jan 2002, 02:16
i made this little script to automatically install(remove) the set of templates with one click of a button.

i test it and it works great. :D let me know what you think

TECK
20 Jan 2002, 03:52
here it is:

dlst
23 Jan 2002, 09:27
Hi JJR512, thanks for all the hard work you've put into this.

I've installed the latest release, and have found the following problems/bugs that I haven't seen mentioned:

problem 1: SQL Error

Go to homeindex.php (stock, I have not modified it from newest release)
Click on "Create a new news item"
Without entering anything, click on "Submit thread URL"
The following error occurs:

Invalid SQL: SELECT forumid FROM thread WHERE threadid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

I guess because there is no threadid and therefore the select fails... While you're in "error-checking-mode" is there a way to verify the URL is valid, belongs to this site, etc. before continuing?

problem 2: Javascript Error in newspost.php

Start a new thread, making the thread a news item. You get redirected to newspost.php.
Click on "Submit" after making no changes to your input.
The following error occurs:

A javascript pop-up (via IE5.5) with "A run-time error has occurred, line 58 with the following error:
'subject.value' is null or not an object"

The script continues to process, and you end up at homeindex.php, but no news items show up. The page is otherwise complete, but without news items. I get the empty page you see here: http://207.235.6.72/forum/homeindex.php

problem 3: Permissions problem in forumpermission.php

If you go to the admin, under "Forums & Moderators", click on "Permissions"
If you set custom permissions for a forum here, it has the effect of DISallowing news posting privileges for the group whom you have just changed.

For example, if you click on Administrators-Edit, select "Use Custom Settings", leave ALL the settings alone, and submit... you will find that Administrators are no longer able to post news items to that board.

-------

Thanks again for this great hack.

-dlst

dlst
26 Jan 2002, 05:28
Hmmm... anybody home? Well in case anyone is reading this thread, I found the solution to the Javascipt error I found:

Originally posted by dlst

problem 2: Javascript Error in newspost.php

Start a new thread, making the thread a news item. You get redirected to newspost.php.
Click on "Submit" after making no changes to your input.
The following error occurs:

A javascript pop-up (via IE5.5) with "A run-time error has occurred, line 58 with the following error:
'subject.value' is null or not an object"

[/B]

Go to the "main_news_new" template and look for the following line (it's near the top of the file):

if (theform.message.value=="" || theform.subject.value=="") {

Replace that with:

if (theform.message.value=="" || theform.headline.value=="") {

That's it for this one! Easy. Author, if you're reading this you might want to update the zip to save others the trouble. Again, thanks for a great hack.

I'll post other solutions as I find them.

-dlst

//*************************
// "They must often change, who would be constant in happiness or wisdom."
//*************************

dlst
26 Jan 2002, 05:50
Man, I'm on a role... I fixed problem one (sort of). First, here's the problem (quoted from above):

Originally posted by dlst
problem 1: SQL Error

Go to homeindex.php (stock, I have not modified it from newest release)
Click on "Create a new news item"
Without entering anything, click on "Submit thread URL"
The following error occurs:

Invalid SQL: SELECT forumid FROM thread WHERE threadid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

I guess because there is no threadid and therefore the select fails... While you're in "error-checking-mode" is there a way to verify the URL is valid, belongs to this site, etc. before continuing?



AND *drumroll* the solution:

I rewrote the "main_news_newfromnothing" template to include a little javascript form validator to make sure something is in the form. Obviously, eventually some better checking will have to happen, because right now if you enter a URL that's NOT from the forum, it generates a MySQL error.

But for the moment, this is a start.

Attached is the modified template file. Just replace your "main_news_newfromnothing" template with the contents of the file below.

-dlst

dlst
26 Jan 2002, 06:37
Ok fine, I'll do my own homework! Sheesh. J/K :)

As I posted above, It would be nice to have the script verify the validity of the URL and present the user with a meaningful error message... and NEVER a MySQL error. Well, it's done, with a few modifications to newspost.php.

Originally posted by dlst
problem 1: SQL Error

Go to homeindex.php (stock, I have not modified it from newest release)
Click on "Create a new news item"
Without entering anything, click on "Submit thread URL"
The following error occurs:

Invalid SQL: SELECT forumid FROM thread WHERE threadid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

I guess because there is no threadid and therefore the select fails... While you're in "error-checking-mode" is there a way to verify the URL is valid, belongs to this site, etc. before continuing?



I've attached my new newspost.php to this post. (If you are using a stock newspost.php, this one should work fine... note the use of the word "should"-- ALWAYS backup and use common sense :) ).

I must admit I'm a little new to hacking vb, and consequently I had to jerry rig the error generating info... it will be clear the second you look at the code. If any of you gurus have any suggestions or tips for the "right" way to display error messages, let me know.

So, if you want an error message to display when a user tries to put in an invalid URL, you also have to modify the "main_news_newsfromnothing" template, as follows:

Find the following line:

<td bgcolor="#1C5780" width="27%"><normalfont><input type="text" class="bginput" name="newsthreadurl" value="" size="50"></normalfont></td>

and REPLACE it with:

<td bgcolor="#1C5780" width="27%"><normalfont><font color="red">$error_message</font><input type="text" class="bginput" name="newsthreadurl" value="" size="50"></normalfont></td>

Now do you see what I mean about jerry rigging? To all you PHP newbies out there, don't be alarmed, this solution works fine. To all you others, please excuse me *cough* :)

Ok, so that's it. JJR512, if you like these mods please let me know. If you have any suggestions, definitely let me know. Did I mention this was a great hack? Thanks, yet again.

-dlst

TECK
26 Jan 2002, 18:00
Originally posted by slideboxer
Is there a way I can call the news from another page, a non-vb page? 01. open homeindex.php. place:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


above:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


02. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and add in front of it your site location:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



03. replace all { imagesfolder } code with your actual folder location (http: //www.yoursite.com/forum/images) or simply edit the imagesfolder variable to point to the full url.

04. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace the homeindex.php with the name of your file, for example index.php.

**************************
01. open newspost.php. find the code:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace homeindex.php with the url of your main page (or use the variable $homeurlindex.php). this will make it look like:
http: //yoursite.com/index.php

02. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace homeindex.php with the url of your main page (or use the variable $homeurlindex.php).

03. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace homeindex.php with the url of your main page (or use the variable $homeurlindex.php).

slideboxer
26 Jan 2002, 19:39
Nakkid, thanks a bunch.

Mutt
28 Jan 2002, 01:39
Ok, I know you guys are all working with the new version of this hack, but I'm still using the original one and I love the results. the newer one just had too much going on. the original hack was simple and did a great job. make a post and mark it to be placed on the homepage. done and simple. I I have it ignore poll posts that have been marked as news. then copied the get news sub and have it ignore all non poll posts using differnt tempates for those.

now I have my news items donw the center, activbe topics off to the side, and polls in a small box to the side. you can vote from there or if you've already voted you see the results. I also added a modified version of the vbportal calendar and remake of the welcome panel.

anyway, just wanted to say thanks for the great any forum news hack. When I'm done with it, it's going to make for a real nice homepage

http://www.ccdv.com/forum/homeindex.php

PS - I'd still like to come up with a nice way to truncate the message without screwing up the vbcode and without this whole second post thing in the new version. bigmattyh had something that looked like it would work, but I couldn't get it to. :(

bigmattyh
28 Jan 2002, 01:43
Hey Mutt,

I think I'll go back and see if I can include a different version of the truncation process -- one that's much more flexible. Maybe tonight, or tomorrow?

Matt

slideboxer
01 Feb 2002, 05:06
I'm sure this is probably an easy fix but I'm simply no hacker - cut and paste? now that's a different story :) . I'm trying to include my welcome panel (from the welcome panel hack) in the main_newindex template. How do I get the welcome panel information to display in in this template the same way it does in the forumhome template?

Plus, any news on getting the polls to work?

SirSteve
01 Feb 2002, 14:45
Am I able to select/override what forums/subforums the "News" checkbox is in? Obviously, if I have a news forum, I don't need this checkbox to be displayed.

Pete
01 Feb 2002, 23:07
I've bounced all over the board following this hack ;)

Just wondering if the idea of an additional field for a brief description of the news made it into the hack. This would make sloppy pasting of headlines output much nicer to the front page!

slideboxer
02 Feb 2002, 03:43
Originally posted by slideboxer
I'm sure this is probably an easy fix but I'm simply no hacker - cut and paste? now that's a different story :) . I'm trying to include my welcome panel (from the welcome panel hack) in the main_newindex template. How do I get the welcome panel information to display in in this template the same way it does in the forumhome template?


Actually, I figured out how to do this. Took a bit of hacking (still far from calling myself one, though :D ) in the homeindex.php file. Pop on over to http://www.abudokan.com to see what I've done.

Now about getting the polls to work....

Mutt
05 Feb 2002, 00:54
Originally posted by bigmattyh
Hey Mutt,

I think I'll go back and see if I can include a different version of the truncation process -- one that's much more flexible. Maybe tonight, or tomorrow?

Matt

look forward to it

JJR512
06 Feb 2002, 03:57
Pete, not sure what it is you're looking for, I don't think I understood. ???

Just to let everyone know, I'm working on a little addition to this that lets you show a picture. Now you can already have a picture show up in the news item simply by using the img vB Code tag in the normal way. But what I don't like about that, personally, is that doing this, the text doesn't wrap around the image. So what I want to do is add another field to the create news page, where you can put in a URL to an image. If you leave it blank, nothing special happens. If you put a URL in, though, it causes new HTML code to go into the news item that is an <img ...> tag complete with wrapping instructions, probably align=left with the image on the left side, so that text will go around the right and bottom of the image.

Pete
06 Feb 2002, 14:23
I was doing some searching for this idea & landed in your thread. I'll try to explain what I had in mind, your idea from the original post was close: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.

Rather than adding a second page, I was just thinking an additional text field (to a new submit news template) limited to about 100 characters for a summary of the news article. The contents of this summary field would be output to the front page, versus the contents of the full post.

I'm using a fine workaround now, just set the character limit of the news display (in vBP) to about 100 & make the first paragraph my summary.

JJR512
08 Feb 2002, 19:02
Where is this additional text field supposed to go? Since you don't want to have a second page, I guess it's supposed to go on the newthread page, is that correct? My first impression of this idea is that if it's a new textarea on the newthread page, then you have to fill it out separately, whereas the way my hack works, on the second page, it's already filled out. You don't have to do anything to it, if you don't want; you could just submit it. Or if you want it to be shorter, you can shorten it manually, taking out whatever parts you don't want and leaving whatever you do want, which I feel is better than just being limited to the first xx-number of characters. (Sometimes I don't want the first few lines because it has redundant or unnecessary data.) It is what you leave in the textarea on the second page that goes to the front page.

slideboxer
08 Feb 2002, 19:20
Hey, JJR512, any news on getting the polls to work with this?

ptenthus
09 Feb 2002, 13:58
Polls don't work for anyone on my board since I put this hack in place. Everything else works fine, just anyone trying to post a poll goes to a blank white screen.

Ideas?

dlst
09 Feb 2002, 15:58
Originally posted by ptenthus
Polls don't work for anyone on my board since I put this hack in place. Everything else works fine, just anyone trying to post a poll goes to a blank white screen.

Ideas?

I'm having the same problem... so far no luck fixing it.

JJR512
09 Feb 2002, 18:26
No, I haven't had that problem, so I don't know how successful I'll be trying to fix it.

dlst
09 Feb 2002, 19:20
Originally posted by ptenthus
Polls don't work for anyone on my board since I put this hack in place. Everything else works fine, just anyone trying to post a poll goes to a blank white screen.

Ideas?

Fixed it. There is a line missing in newthread.php that prevents the correct redirect. Author, please check this out and update your release:

Find the following line in newthread.php. This is in the EDITED VERSION of newthread.php, according to the instructions in this hack!



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



And add the following line right below it:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Enjoy!

slideboxer
09 Feb 2002, 23:07
Awesome, this worked. Thanks.

dlst
10 Feb 2002, 01:20
Originally posted by slideboxer
Awesome, this worked. Thanks.

Cool! You're very welcome!

JJR512
10 Feb 2002, 03:24
UPDATE

I have updated this hack. Updates include a fix to the poll vs. news issue which goes a bit beyond what's just been discussed...Now you will be able to BOTH post a poll AND a news item at the same time! If you check both boxes, first you are redirected to the poll setup page, you do that as normal, then after submitting the poll you are redirected to the news item setup page, which again is done as normal. The new redirect scheme does work correctly now if you ONLY selected to post a poll, ONLY selected to post a news item, or selected BOTH. (The correct action or result will happen.)

I've also built in the image feature I mentioned earlier.

This news is FYI only at this time, as I am not releasing the updated hack just yet. I have only just completed testing of the new redirection and poll+news system; I still need to document it. Additionally, I am re-writing all of the variables used so that they more closely resemble the style of vBulletin (the $xxx[yyy] style). It is my hope that once I get all of that done, that we can get this out of beta and make it an official release. :)

dlst
10 Feb 2002, 03:33
I am SO ready to help beta test your new implementation... even, *sigh* help write/proof-read documentation (do you hate writing it as much as everyone else?). Whatever I can do to help.

Did I mention? THANKS for this hack.

JJR512
10 Feb 2002, 07:58
dlst, check your PMs! ;)

Dark_Wizard
11 Feb 2002, 18:19
I would love to help test this as well as I would like to port it to phpportals. Please let me know if your accepting any beta testers. TIA!

JJR512
12 Feb 2002, 03:41
OK, you have a PM too!

Just as an update to everyone else, unless I hear about any problems from the few pre-release beta testers of the new version, I will be publically releasing it in a few days. :)

pdaGuy
13 Feb 2002, 07:42
JJR512,
this is the best hack I've seen to date!! Congrats!
I'm setting up my site with it and I'll soon make a post here for everyone to see it.

I have a small problem though!
How can I use the include or require statement on the homeindex.php?
What I need to do is include a Poll (not a thread with a poll) on the homeindex.php
But I can't use php code on the vBulleting templates. Any ideas?

FYI the Poll that I want to include on the homeindex.php is a separate poll script and in its readme file it says to add the following on the page.
<?php
$newest_poll = 1;
require("http://www.mysite.com/poll/booth.php");
?>

I'd appreciate any help on this.
Thank you all in advance!

squawell
13 Feb 2002, 11:42
JJR512 see the attch file that's my problem!!

i want the blank part show something where should i edit??

and sorry use ur forum's pic to do my example!

JJR512
13 Feb 2002, 20:20
Sorry, please ignore the test forum for now. If you want to see the hack in action, please look at it on my production forums: http://forums.jjr512.com/homeindex.php

(This hack on the test forum is not currently working due to being in the middle of testing of something that isn't finished yet.)

squawell
13 Feb 2002, 20:29
so u mean the hack didn't finish yet~~

and i got that is normal!!

pdaGuy
13 Feb 2002, 21:09
JJR512,
I'd like to suggest something...
Wouldn't it be better if the "Headbits" didn't show the threads that are "News Items" too? I mean, what's the point of showing them in two places on the same page? What do you think?

P.S. Any idea on the include statement? (see post #119 (http://www.vbulletin.org/forum/showthread.php?postid=220097#post220097))

JJR512
14 Feb 2002, 03:37
Originally posted by squawell
so u mean the hack didn't finish yet~~

and i got that is normal!!
What's on my test forums is not the same thing as what's here. Please ignore and forget about my test forums. I was trying something out, decided the feature didn't make any sense, and left the test forums in an unfinished state. It has been like that for several weeks. What's there is basically a non-working version of the version of this hack that's already been posted above (version 2d). The newer version, which some people are beta testing privately, was developed and tested on my production forums, not my test forums, and what you see on my test forums in no way indicates or reflects on what the new version will have or be like. Again, please disregard my test forums for now, and if you want to see the current working version, you can look at it on my production forums using the link already provided, although you will not be able to use it to post news items. When the new version of this hack is released publicly, I will most likely fix my test forums to have it, so that people will be able to try it out first. Until that time, once again, please ignore my test forums.

pdaGuy, that could probably be done with another query. I'll see if I can figure out what the modification would be and let you know about it. But even though this is one hack, I kind of regard them as separate features. In fact, I believe there are some people who are just using the headlines part without the news part. They are totally separate sections of code...to only use the headlines, you can totally lose newspost.php, the news-specific templates, remove the news parts from the shared templates (which I think is only main_home now in the unreleased new verrsion) and the big block of code related to it in homeindex.php, leaving only the bit of code at the bottom that does the headlines.

pdaGuy
14 Feb 2002, 03:53
JJR512,
Thanks for considering my request and I look forward to see what you’ll come up with on the new version ;)
Is there any chance that you or someone else could let me know how to insert extra PHP code on the homeindex.php page?
For example, I want to include a separate Poll script that I found here (http://www.proxy2.de/), but the installation instructions say that I must add the following in order to have the Poll on my site.


<?php require "./booth.php"; ?>
<?php
echo $php_poll->poll_process(1);
?>

Buy when I add this code on the main_newindex template nothing happens:(
Anyone could help me on this please???

JJR512
14 Feb 2002, 23:22
You cannot add PHP code to templates. (Unless it's the phpinclude template, of course.) You must add the code to the file; in this case, homeindex.php file.

Because the file is entirely PHP to begin with, you can strip the PHP opening and closing tags, so you are left with these two lines:
require "./booth.php";
and
echo $php_poll->poll_process(1);

Without having read the instructions for that hack, I would assume you should put the require line below the line that requires global.php, and the echo line...well, I don't really know where to stick that, honestly. I think an echo statement will work in this file because all the HTML is generated by templates, and the output of the echo statement would need to go wherever in the HTML that you want it, which isn't possible this way. I think wherever you stick that echo statement in the homeindex.php file, the output will just end up at the top of the page, above the header and everything.

pdaGuy
15 Feb 2002, 04:38
Well.... I did what you said but it didn't work :(
When I added the echo... I received
echo (0); on the place that I wanted to poll to be.
I'm giving up on this right now because I've tried everything I could think of and any suggestions that I heard from everyone.
However, I believe that this is a cool idea for a future hack. The idea is to be able to post php code on all the vBulletin pages. Maybe it sounds weird for some of you, but for me it would make my life A LOT easier ;)

Anyway... thank you very much for your help ;)
And if you'd like to see your hack in action (on another site:D) check out PocketPCMinds.com (http://www.pocketpcminds.com) ;)

pdaGuy
16 Feb 2002, 02:05
Just so you know.. I find out how to include the poll script ;)
Everything needed to go on the phpinclude ;)

voogru
21 Feb 2002, 19:41
i want to be able to include the news hack on my non-vB page this is how i have it setup

main site is in the public_html/ folder
and my forums are in the public_html/forums/ folder

now what i want to do is simply modify my index.php to get the news and make working links to the posts. i dont know how to include it and keep my normal page up.

basicly heres what im looking for, this is a IMAGE EDIT just for your info :)

http://www.voogru.com/images/homepage.jpg

i attached my index.php if someone could lead me in the right direction that would be great :)

-voogru

TECK
22 Feb 2002, 05:34
i posted here on this thread how to make homeindex.php your home page. ;) search through..

timbob
03 Mar 2002, 09:17
Is this wonderful piece of software ready for full release yet?

ForKmaN
03 Mar 2002, 10:37
Ok I want this hack..exactly which link do I get :P

is it fully out yet?

juno
05 Apr 2002, 10:37
JJR512,
Could you send me the latest version? I'd like to try and convert this over to vbportal.

John
06 Apr 2002, 02:40
I'm confused. I can't access newspost.php because I don't have the rights - even though I'm the admin (of course). And homeindex.php is nice, there's a news bar down the right hand side. But isn't something supposed to go in the middle?

<newbie>

Help?

Okiewan
10 Apr 2002, 03:06
Originally posted by nakkid
i posted here on this thread how to make homeindex.php your home page. ;) search through..
I think he's looking for a way to include the news in an existing html home page... NOT a template created one. I'd like to see the same thing :)

wintz
13 May 2002, 18:36
Can anyone let me know if/where i can get this hack or one that dose the same thing it`s just what i have been looking for thanks

Lionel
30 Jun 2002, 17:13
if there is an image as attachment is there a way to also have it displayed on homeindex, as a thumb, using php resize function?

BigJohnson
15 Jul 2002, 11:06
I can't get this to work for my site. My board is at www.website.com/forums/
and i want to put the homeindex at www.website.com

Not at /forums/

How would i go ahead to do this. Can someone please tell me in detail because i am not to good at this. Thanks

JJR512
15 Jul 2002, 20:21
I know I've never been able to get it to work outside of the forums directory, and I don't recall anyone else saying they did it, either. So that's where I kept it. At first, I changed my root index.html to instantly redirect to homeindex.php. Eventually, I just moved my entire forums to the root web level.

Lethal
16 Jul 2002, 19:43
does this work on vb 2.2.6?

JJR512
16 Jul 2002, 20:40
It should. It does for me, and I don't remember having to modify it.

Lethal
17 Jul 2002, 18:25
thank you

Lethal
18 Jul 2002, 20:39
This is a great hack. I have a little problem. I have 5 different sections in my site and each of them have a different news forum. Is it possible to use this hack and have the news from each news forum show up and their respective index pages. Meaning I will need to have basically a different homeindex.php for each index page. Is something like this possible for this hack? Also, why is the news posted on the right sidebar and not in the middle? I hope this is possible to do this. Maybe not with this hack but maybe there is another one here that I haven't found yet. I tried pluhnews but i didn't like that because I couldnt' get that to use the current style of my board and I had to edit it with html and what if I have a different style then the colors won't match and stuff like that. Help please.

Tarion
18 Jul 2002, 22:24
i think i found a Bug:

when i make a new thread, mark this thread as news and would start a poll, i got a with page, i fgured it out that the poll function now work but only when i don't try to do both makr as news and start a poll.

Any idears or is this only my problem???

I use VB 2.2.4

BigJohnson
19 Jul 2002, 05:04
I get this as an error please help

Warning: ChDir: No such file or directory (errno 2) in /usr/local/psa/home/vhosts/url.com/httpdocs/index.php on line 6


Originally posted by Nakkid
01. open homeindex.php. place:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


above:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


02. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and add in front of it your site location:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



03. replace all { imagesfolder } code with your actual folder location (http: //www.yoursite.com/forum/images) or simply edit the imagesfolder variable to point to the full url.

04. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace the homeindex.php with the name of your file, for example index.php.

**************************
01. open newspost.php. find the code:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace homeindex.php with the url of your main page (or use the variable $homeurlindex.php). this will make it look like:
http: //yoursite.com/index.php

02. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace homeindex.php with the url of your main page (or use the variable $homeurlindex.php).

03. find:

Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

and replace homeindex.php with the url of your main page (or use the variable $homeurlindex.php).

BigJohnson
20 Jul 2002, 15:00
Can someone please help me. Read above. PLEASE@!!!!!