MyBB Community Forums

Full Version: Get the last thread ID created
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys.

I'd like to retrieve the last thread's ID that was created (for use in a plugin).

I'm current hooking into newthread_do_newthread_end and trying to use the function mysql_insert_id() to get the last ID inserted, but there must be a few other queries that are run before the hook is actually run, so I can't do it.

I'd prefer not to use the datahander hook (for my own reasons) but I will if there's no other way.

I'd also prefer not to use another query to simply find the last record in the threads table. I want to minimise queries.

Thanks Angel