Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Survey invitations keeps getting resent

5 months 1 day ago #233427 by colnect
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition Version 5.4.8+221024
Own server or LimeSurvey hosting: Own
Survey theme/template: default

Not sure this is the correct forum but this is about using the API to invite participants to surveys. We have the system running for years but it's been down for over a year until we managed to upgrade from Version 5.0.10+210723 to Version 5.4.8+221024. Now when our daily script is trying to send email invitations using the API, it crashes (message "Rollback failed. There is no active transaction." when adding participants to a survey which likely indicates DB disconnected after too long a launch script) and on the next launch it resends invitation to the same people again. Looking at the admin panel we can see that the people who got an email were not invited. The code is below and while the invitation and reminders are properly sent for the first survey and the script fails on add_participants of the second survey, somehow still all participants of the first survey aren't marked as invited and so it tries to send to them again on the next launch. What can we do?
        try {
            $sSessionKey = self::$limeAPI->get_session_key(self::LS_USER, get_special_key(self::LS_SECR_KEY));
            Echoer::p('Will try to add '.count($arParticipantData).' participants to survey '.$iSurveyID.'...');
            Echoer::p($limeAPI->add_participants($sSessionKey, $iSurveyID, $arParticipantData, false));
            UserOps::didAction($arUserIDs, $action);
            Echoer::p('Invite to '.$iSurveyID.'...');
            Echoer::p($limeAPI->invite_participants($sSessionKey, $iSurveyID));
            Echoer::p('Reminder to '.$iSurveyID.'...');
            $iMinDaysBetween = 7;
            $iMaxReminders  = 2;
            Echoer::p($limeAPI->remind_participants($sSessionKey, $iSurveyID, $iMinDaysBetween, $iMaxReminders));
        } catch (Exception $e) {
            Echoer::e('Lime invites err: '.$e->getMessage());
            if (!empty($sSessionKey)) $limeAPI->release_session_key($sSessionKey);

Please Log in to join the conversation.

5 months 1 day ago #233428 by colnect
To clarify, it seems like there are a few issues:
1/ Even though invitations and reminders are send, they are not marked as such and thus the process restarts.
2/ With a bigger amount add_participants fails altogether
3/ Even though people opt out of reminders, they still get sent the invitations. Where can I check in the DB if a person has opted out?


Please Log in to join the conversation.

5 months 1 day ago #233433 by colnect
1/ When looking at the admin panel, I could find that some users are properly marked but those who had the problem of not getting marked as invited can't be marked as invited with mass editing, seeing the error "language: Language code is invalid in this survey" but manually each one can be marked as invited. So, what's actually going on there? They get send the survey in English as their language doesn't exist but then not marked as invited?

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose