Commit cd159b32 authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4880 (Unsetting the active poll does not work)

parent a638be69
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -485,6 +485,10 @@ class Module_cms_polls extends Standard_crud_module

                    set_poll(intval($id));
                }
            } else {
                if ($is_current == 1) {
                    unset_poll(intval($id));
                }
            }
        }

+10 −0
Original line number Diff line number Diff line
@@ -354,3 +354,13 @@ function set_poll($id)
    $mail = do_notification_lang('POLL_CHOSEN_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape(get_translated_text($question)), $poll_url->evaluate());
    dispatch_notification('poll_chosen', null, $subject, $mail);
}

/**
 * Unset the poll.
 *
 * @param  AUTO_LINK $id The poll ID to unset
 */
function unset_poll($id)
{
    $GLOBALS['SITE_DB']->query_update('poll', ['is_current' => 0, 'date_and_time' => time()], ['id' => $id], '', 1);
}