News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Auto Respond

Started by Suki, April 14, 2011, 10:41:42 PM

Previous topic - Next topic

clubkadettspain

Hi first thanks for your work. I have a problem with this mod, it shows error 500 when i try to add a new message, i dont know how to fix this, can you help me?

Update: The problem only happens when i leave empty "The message's title" if i type something there everything works..

Suki

500 error means something happen at your server, do you have access to the server logs?

The message's title field is suppose to take the topic's title if you leave it empty, which means probably you have some security configuration that prevents sending empty values.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Lucarella

Hi Suki, the mod works fine but I found out that it creates this problem discussed here https://www.simplemachines.org/community/index.php?msg=4182389

Is there a way to solve it?

Thanks

Suki

Hi, thanks for the report. It is indeed a typing issue, I more often than not forget to cast SMF variables before using them on typed code.

However, the issue uncovers something more, the mod will try to create a response topic for redirecting topics which is not something we want, thankfully, there is a handy $topicOptions['redirect_topic'] variable we could use for those cases.

Heres a potential fix, open you Sources/AutoRespond/AutoRespond.php  file, find the line 33
and replace the entire handleRespond function with this one:


public function handleRespond(array $msgOptions, array $topicOptions, array $posterOptions): void
    {
        if (!$this->service->isModEnable() ||
            $this->isRecursive((int) $topicOptions['id']) ||
            !empty($topicOptions['redirect_topic'])) {
            return;
        }

        $this->msgOptionsSubject = $msgOptions['subject'];
        $this->posterOptionsName = $posterOptions['name'];

        $data = $this->service->getEntriesByBoard((int) $topicOptions['board']);

        foreach ($data['entries'] as $entry)  {
            $this->createResponse($entry, (int) $topicOptions['id']);
        }
    }

please let me know if that solves the issue and also if it prevents creating responses from redirected topics.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Lucarella

Thanks Suki,
I made the change you suggested, did a couple of tests and the problem seems to have disappeared, everything works fine.

Thanks again for your availability

Suki

Mod has been updated:

2.1.1 Nov 2024
- Fix typed parameters
- Prevent creating a response on redirecting topics
- Fix licensing mixup
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Advertisement: