Bug #9920
Comment UID is overwritten in 'aftercommentinsertion'
| Status: | Resolved | Start date: | 2010-09-26 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | Dmitry Dulepov | % Done: | 100% |
|
| Category: | Bug | |||
| Target version: | 1.1.0 | |||
| Votes: | 0 |
Description
I came upon a problem when using the 'aftercommentinsertion' hook inside T3BLOG. The UID of the comment that should be passed on in the parameters is lost, it is called twice with t3lib_DB::sql_insert_id(). The UID is lost because of updateRefIndex(). Which is called directly after insertion of the comment, but before the ID is retreived.
pi1/widgets/blogList/class.singleFunctions.php
744: $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $data); 745: $this->updateRefIndex($table, $GLOBALS['TYPO3_DB']->sql_insert_id());
A solution to this would be to store the UID of the new comment in a local variable before updateRefIndex() is called. And pass this on as hook parameter.
pi1/widgets/blogList/class.singleFunctions.php
$GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $data); $commentUid = $GLOBALS['TYPO3_DB']->sql_insert_id(); $this->updateRefIndex($table, $GLOBALS['TYPO3_DB']->sql_insert_id());
History
Updated by Dmitry Dulepov over 2 years ago
- Category set to Bug
- Status changed from New to Resolved
- Assignee set to Dmitry Dulepov
- Priority changed from Should have to Must have
- Target version set to 1.1.0
- % Done changed from 0 to 100
Thanks! :)