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.
 
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.
So this explains why whenever we make a new thread/post after updating (all of our messages with threads and posts are a bit modified from the ones that are set by the addon itself) suddenly we're not seeing any of them get pushed through to Discord anymore....

How do we re-order or fix this...?? @Jaxel or @SeToY would certainly appreciate your insight...

Thanks all!
 
Hmm... it looks like I fixed the bug in my internal files on 2024-12-05... I just never released the update.

I'll release the update soon.
 
Back
Top Bottom