FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Plugins and Code Hacks » adding a 'simple' thing to FUD
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
adding a 'simple' thing to FUD [message #20010] Tue, 21 September 2004 14:10 Go to previous message
johed802 is currently offline  johed802   Sweden
Messages: 24
Registered: September 2004
Karma:
Junior Member
Hi!

I'm trying to add some functionality to the forum. When a user registers to the forum, I want to create a new thread for this user at the same time. I added some code to the file register.php; a function called add_topic which is called right after add_user. In my function I use this object: $msg_post = new fud_msg_edit. An object that is used when posting.

This actually works to some extent. At least if I look in the DB afterwards I can see that it put new stuff in _threads, and _msg, and even put stuff on the file in the messages directory in the 'data_root'. My problem is that this new thread doesn't appear in the thread list. I noticed that no data was put into the table _thread_view. This might be the problem. Should I do this 'manually'or what? Did I miss some function from the msg object? My add_topic function can be seen here, I copied a lot of code from the file post.php.t:
function add_topic ($id)
{
    $msg_post = new fud_msg_edit;			
    /* Process Message Data */
    $msg_post->poster_id = $id;
    $msg_post->poll_id = $pl_id;
    $msg_post->subject = "welcome to the forum!";
    $msg_post->body = "bla bla bla ...";
    $msg_post->body = apply_custom_replace($msg_post->body);
    $msg_post->body = nl2br(htmlspecialchars($msg_post->body)); 
    fud_wordwrap($msg_post->body); //?
    $msg_post->subject = htmlspecialchars(apply_custom_replace($msg_post->subject));
  // trying to create a thread
    $create_thread = 1;
    $msg_post->add(1, 0, "N", "N", "N", FALSE);

    user_register_forum_view(1); 
    rebuild_forum_view(1, 1);  // do i need to?
}

Any ideas?
Thanx in advance!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message icon10.gif
Read Message icon5.gif
Read Message
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New script: fudbox.php
Next Topic: How do I get error messages?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri May 24 19:21:05 GMT 2024

Total time taken to generate the page: 0.04565 seconds