Skip to content
This repository was archived by the owner on Aug 13, 2022. It is now read-only.
This repository was archived by the owner on Aug 13, 2022. It is now read-only.

Pollid is not found for the block of Polls #6

@KratorD

Description

@KratorD

Zikula 1.3.10 and Polls 3.0.1
Select the option "Latest poll" in block options for this module. Select the option "Only one vote. No recurrence" for "How soon can a user vote for each poll?"
Register a vote from the block.
Refresh page.
The poll is showed again for register a new vote for your user.

The problem is in the method "display" of the file "Polls\Block\Poll.php". When it get variables from content block:
$vars = BlockUtil::varsFromContent($blockinfo['content']);
Then use the variable "$vars['pollid']" for pollid, but this variable is "-1" (for the value for option "lastest poll").
So, when the module try to get if the user is allowed to vote
// Check if the user is allowed to vote (meaning he has already voted in this poll) $allowedtovote = (bool)ModUtil::apiFunc('Polls', 'user', 'allowedtovote', array('pollid' => $vars['pollid']));
The module response: "yes, you can vote"

it's necessary change the logic for this case, where the pollid must to be retrieve with the function
// Get the poll $item = ModUtil::apiFunc('Polls', 'user', 'get', array('pollid' => $vars['pollid']));
This function is prepare to get the last poll if $vars['pollid'] is "-1" value.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions