WordPress.org

Ready to get started?Download WordPress

Forums

WP-Polls
[resolved] new shortcode [poll="id"] don't work (10 posts)

  1. tz-ua
    Member
    Posted 3 months ago #

    New shortcode doesn't process properly, so it always shows the latest poll.
    The function for processing it hadn't changed since last plugin update, so I made quick draft fixes to solve this situation untill plugin developers won't fix it.
    wp-polls.php (line 735)

    function poll_shortcode($atts) {
    	extract(shortcode_atts(array('id' => 0, 'type' => 'vote'), $atts));
    	if(!is_feed()) {
    		$id = intval($id);
    		/**/
    		$id_new = intval(trim($atts[0], '="\''));
    		if(!$id)
    			$id = $id_new;
    		/**/
    		if($type == 'vote') {
    			return get_poll($id, false);
    		} elseif($type == 'result') {
    			return display_pollresult($id);
    		}
    	} else {
    		return __('Note: There is a poll embedded within this post, please visit the site to participate in this post\'s poll.', 'wp-polls');
    	}
    }

    https://wordpress.org/plugins/wp-polls/

  2. Lester Chan
    Member
    Plugin Author

    Posted 3 months ago #

    Yes, [poll=1] was used long time back (and in 3.9, they remove support for it - i think)

    But going forward, it will be [poll id="1"] as mentioned in the docs https://wordpress.org/plugins/wp-polls/installation/. It is the proper way of doing it.

    There is still a bug that I forgot to fix which is the Poll button on the editor still inserts [poll=1], that bug has already fixed in the dev version https://github.com/lesterchan/wp-polls/archive/master.zip to change to [poll id="1"]

  3. martin.krcho
    Member
    Posted 2 months ago #

    Hi Lester, would it be possible to include the fix suggested above in the latest version of the plugin? You have changed the way the editor button inserts the shortcode, but this doesn't solve problem with older occurencies of the shortcode. Thanks.

  4. Mariam Talakhadze
    Member
    Posted 2 months ago #

    I have the same problem. The new posts display only latest polls not the poll I inserted in the post.

  5. Lester Chan
    Member
    Plugin Author

    Posted 2 months ago #

    Okie I will make the fix to the core =)

  6. Mariam Talakhadze
    Member
    Posted 2 months ago #

    I hope it's coming soon, because I had to disable my plugin and all my polls are now disappeared. :(

  7. Lester Chan
    Member
    Plugin Author

    Posted 2 months ago #

  8. Mariam Talakhadze
    Member
    Posted 1 month ago #

    Thank you! It helped a lot!

  9. martin.krcho
    Member
    Posted 1 month ago #

    Thanks, Lester. When are you planning to release the new version?

  10. Lester Chan
    Member
    Plugin Author

    Posted 1 month ago #

    No time frame yet. I will wait for a few more bugs report if there is any

Reply

You must log in to post.

About this Plugin

About this Topic