XF2 [8WR] Discord Integration

XF2 [8WR] Discord Integration [Paid] 2.3.0.4

No permission to buy ($30.00)
As a side note: Posting new threads to Discord is broken if a custom message has been provided.

Fix:
\src\addons\EWR\Discord\Entity\Post.php lines 112-117:
PHP:
$content = str_ireplace(
    ['{user}', '{title}', '{node}', '{url}'],
    ['{user}', '{title}', '{url}'],
    [$thread->username, str_replace('@', '@𝅳', $thread->title), $thread->Forum->title, $url],
    $discord['threads']['message']
);
->
PHP:
$content = str_ireplace(
    ['{user}', '{title}', '{node}', '{url}'], // search
    [$thread->username, str_replace('@', '@𝅳', $thread->title), $thread->Forum->title, $url], // replace
    $discord['threads']['message'] // subject
);
The call to str_ireplace has the args in the wrong order. The 4th param gets passed in (which is the $count out param), and the replacement array repeats the placeholders instead of the values. Thus, $content becomes an array instead of a string, so Discord rejects the payload.
 
Back
Top Bottom