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
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?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.