We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Asociate to (create) forum topic

Development and Programming

Ñuño Martínez's avatar
Ñuño Martínez
60 posts
16 years ago
Ñuño Martínez's avatar Ñuño Martínez

I’m developing a module that needs to associate items to forum topics, creating that topics. I was looking in the weblog and forum sources but I can’t find any clue in that long spaghetti-code.

Can somebody tell me what SQL commands I need to create a new forum topic?

Mod Edit: Moved to the Modules: Discussion and Questions Forum

       
Ñuño Martínez's avatar
Ñuño Martínez
60 posts
16 years ago
Ñuño Martínez's avatar Ñuño Martínez

Nobody answer so I did try next queries (“pseudo” SQL, of course):

INSERT INTO `exp_forum_topics`
  (`forum_id`, `board_id`,
   `author_id`, `ip_address`,
   `title`, `body`,
   `topic_date`, `thread_total`,
   `last_post_date`, `last_post_author_id`)
VALUES
  (%formums.forum_id%, %form_boards.board_id%,
   %members.member_id%, %$IP%,
   'Lorem', 'Lorem ipsum etc.',
   %time%, '1',
   %time%, members.member_id)
UPDATE `exp_forums`
SET `forum_total_topics` = %SELF.forum_total_topics + 1%,
    `forum_last_post_id` = %forum_topics.forum_id%,
    `forum_last_post_title` = 'Lorem',
    `forum_last_post_date` = %time%,
    `forum_last_post_author_id` = %members.member_id%,
    `forum_last_post_author` = %members.screen_name%
WHERE forum_id=%exp_forum_topics.forum_id%

Are they 0k? Should do something else?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.