Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-22-2004, 01:36 AM
stalk stalk is offline
 
Join Date: Jun 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Manually add threads and posts

One possible use is having a user enter in the url of a news story and then a generic user "newsman" or something will automatically create a new thread with that news story for people to comment on. Since I am just dealing with 1 user and no moderation (in my case), then I believe all I have to do is add-to/modify the following tables:

forum
user (optional because it's a fake user, but I'll do it anyway)
thread
post
posthash

Does that seem right? Does postindex come into play at all? I realize that I'll still have to do the dupecheck before posting.

Any comments, suggestions, and ideas are welcome. Thank you.
Reply With Quote
  #2  
Old 06-22-2004, 02:24 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm.. an automated concept might be more useful.

If I had time, I'd code it. An "articlebot", like Sitepoint.com has for their forums when new articles are added.

Although, your method of fetching articles is somewhat broad and unclear, if you plan if you intend to grab the content from a news article by a user-submitted URL.

A better idea is to read a news feed XML from an XML parser. Not sure if you're familar with PHP's PEAR, but there is a great package by Stephan Schmidt known as XML_Serializer that easily parses XML data to arrays. Another of course is XML_Parser.

Then you just find XML news feeds, e.g.

http://www.securityfocus.com/rss/news.xml
http://www.computerworld.com/news/xml/50/0,5009,,00.xml
http://rss.news.yahoo.com/rss/tech

And have the "ArticleBot" display the URL and description inside the post.

Something to think about.

This would be a most useful hack though.
Reply With Quote
  #3  
Old 06-22-2004, 02:33 AM
stalk stalk is offline
 
Join Date: Jun 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Velocd,

Thank you for the information. I was just using news articles as an example, but I have no problem parsing information.. in fact, I already wrote the parser for what I need, now I need to stick it in the forum.

Is what I said about manually adding threads/posts correct?

Thank you in advance. :up:
Reply With Quote
  #4  
Old 06-22-2004, 03:13 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You would need to assign a forum for where ever the bot is to post, and also a "bot user", and then have a human user upload the file. What ever you're using to do the parsing (I just remembered XML_RSS) will run through the file and then insert a new row into the `thread` table, associated with `forum` and its "bot user", and also insert a `post` associated with `thread` and its "bot user".
Reply With Quote
  #5  
Old 06-22-2004, 03:47 AM
stalk stalk is offline
 
Join Date: Jun 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Velocd,

Thank you for your reply. Now to ask you 2 questions that I'm almost sure about but just want to make sure...

1) It would also be necessary to fill out the posthash table (and check it) to make sure I don't get duplicate submissions, correct?

2) To make the post searchable, all I have to do is call build_post_index from functions_databuild.php with the correct args, correct?
Reply With Quote
  #6  
Old 06-22-2004, 04:36 AM
Velocd's Avatar
Velocd Velocd is offline
 
Join Date: Mar 2002
Location: CA University
Posts: 1,696
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Stalk,

I'm assuming you are stepping through the build_new_post() function that is in newthread.php and newpost.php.

If not, it's located in /includes/functions_newpost.php, and should have all the necessary steps to completing a thread.

I'll check back tomorrow if you still need help.
Reply With Quote
  #7  
Old 06-22-2004, 10:16 AM
stalk stalk is offline
 
Join Date: Jun 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Velocd
I'm assuming you are stepping through the build_new_post() function that is in newthread.php and newpost.php.
Actually, yes. I just always liked reassurance. Since my board is still not in use, I guess it wouldn't hurt to play around with the threads/posts tables. I'll let you know how it all turns out. Thanks for your help.
Reply With Quote
  #8  
Old 06-25-2004, 05:03 AM
ethank's Avatar
ethank ethank is offline
 
Join Date: Oct 2001
Location: Toluca Lake, CA
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you post your code when its through? I have to bulk load 8 years of news articles as posts for my interim website...
Reply With Quote
  #9  
Old 06-29-2004, 04:40 AM
stalk stalk is offline
 
Join Date: Jun 2004
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's actually really simple if you are just going to create a new thread and add a post.

You can just call the build_new_post function from includes/functions_newpost.php like this:

PHP Code:
build_new_post('thread'$foruminfo, array(), 0$newpost$errors); 
If you look in the source of the functions_newpost.php file, you'll see what you need to fill in for the $newpost array. $foruminfo you'd just do something like:

PHP Code:
$foruminfo fetch_foruminfo(10
Replace 10 with the forumid you want to insert it in.
Pick a user to be a bot, get their id, and do:
[PHP]$bbuserinfo = fetch_userinfo(2)[/PHP

You use that to build the posthash.

look in newthread.php for an example of how to call build_new_post. Let me know if you need more info.

Hm... I'm not sure what you are trying to do, but I had to modify some of the vb files because the forums I want the bot to post to are moderated and a regular user won't have permissions to post.. build_new_post will grab YOUR permissions (I believe).

So yeah.. just let me know if you have any questions/problems.
Reply With Quote
  #10  
Old 06-29-2004, 05:11 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by stalk
build_new_post will grab YOUR permissions (I believe).
I think you're wrong

PHP Code:
// ###################### Start newpost #######################
function build_new_post($type 'thread'$foruminfo$threadinfo$parentid, &$post, &$errors)
{
        
//NOTE: permissions are not checked in this function 
This is quite useful if you use this function for automated purposes where there actuallyy is no "user".
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:50 PM.


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.04420 seconds
  • Memory Usage 2,265KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete