Jaxel
Well-known member
I have two mods which extend the same model:
Then the other addon...
The problem is that the second listener is not called. Both listeners have a priority of 10. If I set the listener priority of the EWRcarta listener to 11, it works (but not 9)... Why doesn't it work at 10 or less? Where is the conflict?
Code:
<?php
class EWRporta_Listener_Post
{
public static function listen($class, array &$extend)
{
if ($class == 'XenForo_Model_Post')
{
$extend[] = 'EWRporta_Model_Post';
}
}
}
Code:
<?php
class EWRporta_Model_Post extends XenForo_Model_Post
{
public function getPostsInThread($threadId, array $fetchOptions = array())
{
$options = XenForo_Application::get('options');
if ($options->EWRporta_articleforum)
{
$limitOptions = $this->prepareLimitFetchOptions($fetchOptions);
$stateLimit = $this->prepareStateLimitFromConditions($fetchOptions, 'post');
$joinOptions = $this->preparePostJoinOptions($fetchOptions);
return $this->fetchAllKeyed('
SELECT post.*
' . $joinOptions['selectFields'] . '
FROM xf_post AS post
' . $joinOptions['joinTables'] . '
LEFT JOIN xf_thread AS thread ON (thread.thread_id = post.thread_id)
WHERE post.thread_id = ?
AND (((' . $stateLimit . ')
' . $this->addPositionLimit('post', $limitOptions['limit'], $limitOptions['offset']) . ')
OR post.post_id = thread.first_post_id)
ORDER BY post.position ASC, post.post_date ASC
', 'post_id', $threadId);
}
return parent::getPostsInThread($threadId, $fetchOptions);
}
}
Then the other addon...
Code:
<?php
class EWRcarta_Listener_Post
{
public static function listen($class, array &$extend)
{
if ($class == 'XenForo_Model_Post')
{
$extend[] = 'EWRcarta_Model_Post';
}
}
}
Code:
<?php
class EWRcarta_Model_Post extends XFCP_EWRcarta_Model_Post
{
public function getQuoteTextForPost(array $post, $maxQuoteDepth = 0)
{
$response = parent::getQuoteTextForPost($post, $maxQuoteDepth);
$response = str_ireplace('[wiki=full]', '[wiki]', $response);
return $response;
}
}
The problem is that the second listener is not called. Both listeners have a priority of 10. If I set the listener priority of the EWRcarta listener to 11, it works (but not 9)... Why doesn't it work at 10 or less? Where is the conflict?