Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

post_unique_id

Quote Reply
post_unique_id
I want to import some old "News" stuff into my "Announcements" forum, but I don't want my users to notice that straight away. So I was thinking of just manually adding posts to the "Post" table (with the dates when the "News" were actually new...).

In order to to that, I need a way to compute "post_unique_id", so what is the algorithm used for this?

Would there be any other things I have to do? (Probably also update the "forum_total" and "forum_total_threads" fields in the "Forum" table.

Thanks for your help.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] post_unique_id In reply to
Hi,

Easiest thing to do is:

my $post_db = $DB->table('Post');
my $fields;
$fields->{post_username} = 'USERNAME';
$fields->{user_id_fk} = 123;
$fields->{forum_id_fk} = 456;
$fields->{post_root_id} = 0;
$fields->{post_father_id}= 0;
$fields->{post_depth} = 0;
$fields->{post_time} = time;
$fields->{post_subject} = 'subject';
$fields->{post_style} = 2; # Markup
$fields->{post_message} = 'message body';
$fields->{post_ip} = '0.0.0.0';
$post_db->insert($fields) or warn "can't insert: $GT::SQL::error";

will insert a post for you and handle all extra tables properly.

Cheers,

Alex
--
Gossamer Threads Inc.