Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

News to Forum

Asked Modified Viewed 1,727 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

Hello,

i remember - for long time - i saw a Mod or infusion that makes normaly news to forum entries so that users discuss in the forum about the new entrie. Is this for 7.02.007 aviable too?
0 replies

3 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Here is a start for you but please note this does not support if a news is edited, it does not support group access or news start and end dates so as soon as you post the news it will send to the forum and that is it.

If you wish for it to work along side edit, group access and start and end dates then you must figure that out.

Now in administration/news.php look for...

Around line 148....

if ($news_sticky == "1") { $result = dbquery("UPDATE ".DB_NEWS." SET news_sticky='0' WHERE news_sticky='1'"); }
      $result = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_cat, news_news, news_extended, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_cat', '$body', '$body2', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_image', '$news_image_t1', '$news_image_t2', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");


After that line paste this...

   $user = $userdata['user_id'];
      $forum_id = "14";
      
      $result = dbquery("INSERT INTO ".DB_THREADS." (forum_id, thread_subject,
      thread_author, thread_views,
      thread_lastpost, thread_lastpostid,
      thread_lastuser, thread_postcount,
      thread_poll)
      VALUES('".$forum_id."', '".$news_subject."',
      '".$user."', '0',
      '".time()."', '0',
      '".$user."', '1',
      '0')");
   
      $thread_id = mysql_insert_id();
   
      $result = dbquery("INSERT INTO ".DB_POSTS." (forum_id, thread_id,
      post_message, post_showsig,
      post_author, post_datestamp,
      post_ip, post_edituser,
      post_edittime)
      VALUES ('".$forum_id."', '$thread_id',
      '[b]".$news_subject."[/b]\n".$news_cat."\n".$body."', '0',
      '".$user."', '".time()."',
      '".USER_IP."', '0',
      '0')");
         
      $post_id = mysql_insert_id();
         
      $result = dbquery("UPDATE ".DB_FORUMS." SET forum_lastpost='".time()."', forum_postcount=forum_postcount+1, forum_threadcount=forum_threadcount+1, forum_lastuser='1' WHERE forum_id='".$forum_id."'");
      $result = dbquery("UPDATE ".DB_THREADS." SET thread_lastpostid='".$post_id."' WHERE thread_id='".$thread_id."'");
      $result = dbquery("UPDATE ".DB_USERS." SET user_posts=user_posts+1, user_lastvisit='".time()."' WHERE user_id='".$user."'");


Now see $forum_id = "14"; change 14 to the forum id you want the news to post to on your site.

Done.

Now when you post news it posts to the forum.
0 replies
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
answered
Senior Member

cool thank you very much - i will try it next time so my admins like it (hope so)
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Welcome! ;)
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 3 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet