vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Beta Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=5)
-   -   Any-forum News hack (https://vborg.vbsupport.ru/showthread.php?t=33314)

JJR512 12-27-2001 07:45 AM

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 12-27-2001 09:14 AM

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 [summary]This is the summary which will appear on the news page, but will be hidden in the forum[/summary]. 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 12-27-2001 06:26 PM

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 12-29-2001 01:16 PM

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,d ateline,attachmentid,pagetext,allowsmilie,showsign ature,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 12-29-2001 07:44 PM

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 12-29-2001 09:41 PM

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 12-30-2001 08:28 AM

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-01-2002 05:27 AM

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: https://vborg.vbsupport.ru/showthrea...456#post210456

slideboxer 01-01-2002 07:02 AM

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-01-2002 07:37 AM

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-01-2002 07:43 AM

Do you have access to a tool like phpMyAdmin, or can you telnet into your account?

slideboxer 01-01-2002 07:44 AM

Got the telnet... Have to check on that tool, though.

JJR512 01-01-2002 07:48 AM

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-01-2002 08:03 AM

OKay, I went and found and installed phpMyAdmin.. now what? :stupid:

JJR512 01-01-2002 08:12 AM

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-01-2002 09:08 AM

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-01-2002 09:42 AM

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-01-2002 09:53 AM

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-01-2002 01:29 PM

YAY...

This hack is AWESOME!!!

TheComputerGuy 01-01-2002 01:51 PM

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 01-02-2002 01:08 AM

Is there a way I can call the news from another page, a non-vb page?

JJR512 01-02-2002 04:13 AM

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 01-02-2002 09:28 AM

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 01-02-2002 04:18 PM

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 01-02-2002 05:25 PM

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:


[QUOTE]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 01-02-2002 05:29 PM

I'm having the same problem. No linkie :(

JJR512 01-02-2002 07:34 PM

In homeindex.php, please find:
PHP Code:

  $permissionssql=$DB_site->query_first("SELECT canmakenews FROM usergroup WHERE usergroupid=$bbuserinfo[usergroupid]");
  
$permissions=$permissionssql[canmakenews];
  if (
$permissions==1) {
    eval(
"\$showcreatelink = \"".gettemplate("main_news_showcreatelink")."\";");
  } else {
    
$showcreatelink="";
  } 

And change this to:
PHP Code:

  $permissions=$DB_site->query_first("SELECT canmakenews FROM usergroup WHERE usergroupid=$bbuserinfo[usergroupid]");
  if (
$permissions[canmakenews]==1) {
    eval(
"\$showcreatelink = \"".gettemplate("main_news_showcreatelink")."\";");
  } else {
    
$showcreatelink="";
  } 

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 01-02-2002 08:06 PM

main_news_showcreatelink

I cannot find this template in my downloaded version?

JJR512 01-02-2002 08:39 PM

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 01-02-2002 09:32 PM

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 01-02-2002 09:38 PM

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

The Realist 01-02-2002 09:46 PM

Sent email asking for your addy M8.

Thanks again.

Brian

[QUOTE]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 01-02-2002 10:27 PM

Your direct email address doesn't seem to be working...so: webmaster@jjr512.com

JJR512 01-02-2002 11:33 PM

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 01-04-2002 01:14 AM

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/news...on=makenewnews

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

:confused:

JJR512 01-04-2002 05:20 AM

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 01-04-2002 10:25 AM

[QUOTE]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?

slideboxer 01-04-2002 01:00 PM

Also getting an error when posting polls. I added the following code to newthread.php

PHP Code:

            // redirect
      
if ($postpoll) {
        
$goto="poll.php?s=$session[sessionhash]&threadid=$threadid&polloptions=".intval($polloptions);
      } elseif (
$visible) {
        if (
$makenewsitem) {
          
$goto="newspost.php?s=$session[sessionhash]&action=createnews&threadid=$threadid";
          eval(
"standardredirect(\"".gettemplate("redirect_postnews-create")."\",\"$goto\");");
        } else {
          
$goto="showthread.php?s=$session[sessionhash]&threadid=$threadid";
          eval(
"standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");
        }
      } else {
        
$goto="forumdisplay.php?s=$session[sessionhash]&forumid=$forumid";
        eval(
"standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");
      }
    }
  }


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 01-04-2002 07:21 PM

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 01-04-2002 07:27 PM

No........

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

Simple!

:)


[QUOTE]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.?.


All times are GMT. The time now is 04:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01256 seconds
  • Memory Usage 1,893KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete