miniBB ® 


Support Forums
 | Start | Register | Search | Statistics | File Bank | Manual |
Master Class miniBB Support Forums / Master Class /  

Automatic post insertion (via cron job?..)

Author Anonymous
#1 | Posted: 12 Apr 2005 11:20 
I have a question/suggestion. I've read the manual and searched the forums already, and haven't found anything useful. So here's my question: Is there a way to automatically create a topic/post from outside of miniBB by passing the neccessary variables to correct functions?

Esentially, I have a website that runs a PHP script from a cron job. I want the script to create a new topic and then enter the first post for that topic. For example, I want to create a topic "Cronjob # 342", and in that topic, create a post containing the results of the cronjob, such as

"Processed log 1 - 4543b in 0.22s
Processed log 2 - 78Kb in 3.2s
Processed log 3 - 230b in 0.129 s
... etc "

I have figured out the table structure, and I can probably write my own functions to do so, but I'm afraid I might mess up the minibb_posts.topic_id and minibb_topics.topic_last_post_id fields. I also don't want to dive into the table locking issues, I rather miniBB's code do it automatically rather than writing my own functions over.

Could you tell me which function should I send my variables to? I think it may be the insertArray function, but I'm somewhat confused about the variables it takes. What is $Tt? Could you describe the locking and insertion functions in more detail, or provide an example how the desired behavior can be acheived?


Author Team
#2 | Posted: 12 Apr 2005 11:27 
Arman: it is more easier then you might imagine. Just check out the new topic form inside HTML and pass all necessary variables, which usually are typed from keyboard, via POST method.

Author Anonymous
#3 | Posted: 12 Apr 2005 11:29 
That would be a simple and beautiful solution if... If the PHP wasn't running from a console. The crontab initiates the PHP script, the script is not called from a browser.

Author Team
#4 | Posted: 12 Apr 2005 11:35 
Arman: if you work with such level scripts like CRON, you should know that POST method could be easily emulated from any space :-) It is just the matter of protocol. Nothing browser-related here.

Author Anonymous
#5 | Posted: 12 Apr 2005 11:41 
I appreciate your compliment, but to my shame I don't. If this is my script:

// do log processing here


// now let's post all that data to miniBB

What goes here?
I don't think that would work as a POST, maybe a $_GET, if it works at all.

What's the right way to do this?

By the way, thanks for instanteneous replies!


Author Team
#6 | Posted: 12 Apr 2005 13:07 
Hope you can get something from here:

Search in Google!


Author Paul
Lead Developer 
#7 | Posted: 28 Oct 2010 05:06 
Wow, this topic still has no proper answer :-)

If anybody will be interested, in PHP you just must assign everything which comes from a miniBB-form, in a $_POST array, they include bb_func_pthread.php or bb_func_ptopic.php, depends on the new reply or topic you would like to be posted. For example:

define ('INCLUDED776',1);




'topicTitle' => $title,
'postText' => $postText,
//'user_usr' => $val,
//'user_pwd' => $modzPwd,
//'mode' => 'login',
'queryStr' => '',
'forum' => $ft,
'topic' => $rndTopic,
'action' => 'pthread',
'anchor' => '0'


Author hemiltonfleming
#8 | Posted: 10 Apr 2011 05:48 
I am really very serious for a job. I need a job. I am trying for last few months for my careers in Africa. Please suggest me some ideas and advices. Thank you.

Author Paul
Lead Developer 
#9 | Posted: 11 Apr 2011 15:40 
This topic is not about such kind of jobs, pal.

Author calamr
#10 | Posted: 1 Jun 2011 10:10 
It works here fine, but i have an Problem:

$postText =" go to [ b ] domain [ /b ]";

Work, the Text is Bold

at the time the BB code for URL doesn't work.

Have you an Tip for me ?

Author Paul
Lead Developer 
#11 | Posted: 1 Jun 2011 10:11 
Obviously, the text is not converted, because some of the conditions is not met. In bb_codes.php, you must follow the path of $userUrlsAllowed variable. Executing the script from crontab, you will need to set this var to TRUE only somewhere in the script.

Master Class miniBB Support Forums / Master Class /
 Automatic post insertion (via cron job?..)
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message

Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.

Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.


miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.