how to pick post id on thread insert
#1
hi all,

the mybb flow is as following on new thread post:

it makes a thread. mean inserts data in db
then it makes a post of same thread subject and description.

i need the same post id on thread post insert.

which hook or which code line will be help full.

currently i am using this hook but i get nothing. it is returned on thread insert in db but no post created yet.

datahandler_post_insert_thread_post


$plugins->add_hook("datahandler_post_insert_thread_post", "cron_thread_post_saveintodb"); # Insert data in cron tab on new thread post entry

function cron_thread_post_saveintodb(&$posthandler){

$post_id = null; # i need this , how to extract from this array
print_r($posthandler);

exit;
}

the out put is :


PostDataHandler Object
(
[language_file] => datahandler_post
[language_prefix] => postdata
[action] => thread
[post_insert_data] => Array
(
[tid] => 32
[fid] => 8
[subject] => 9 feb
[icon] => 0
[uid] => 3
[username] => userAa
[dateline] => 1328772271
[message] => this is new thread test
[ipaddress] => 127.0.0.1
[longipaddress] => 2130706433
[includesig] => 0
[smilieoff] => 0
[visible] => 1
[posthash] => dumb
[mobile] => 0
)

[post_update_data] => Array
(
)

[pid] => 0
[thread_insert_data] => Array
(
[fid] => 8
[subject] => 9 feb
[prefix] => 0
[icon] => 0
[uid] => 3
[username] => userAa
[dateline] => 1328772271
[lastpost] => 1328772271
[lastposter] => userAa
[views] => 0
[replies] => 0
[visible] => 1
[notes] =>
)

[thread_update_data] => Array
(
)

[tid] => 32
[data] => Array
(
[fid] => 8
[subject] => 9 feb
[prefix] => 0
[icon] => 0
[uid] => 3
[username] => userAaa
[message] => this is new thread test
[ipaddress] => 127.0.0.1
[posthash] => dumb
[savedraft] => 0
[options] => Array
(
[signature] => 0
[subscriptionmethod] =>
[disablesmilies] => 0
)

[modoptions] =>
[dateline] => 1328772271
)

[is_validated] => 1
[errors] => Array
(
)

[admin_override] =>
[method] => insert
)





With Regards and many thanks.
------------------------------------------
Reply


Messages In This Thread
how to pick post id on thread insert - by zbaig - 02-09-2012, 07:42 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)