• Resolved airdrummer

    (@airdrummer)


    if a poll has been changed from ‘Allow multiple answers=yes’ having previously set ‘Min/max answers’ > 1, to ‘Allow multiple answers=no’ the min/max is still enforced…one must reenable multiple answers to set min/max to 1.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author YOP

    (@yourownprogrammer)

    Hello

    Thank you for reporting this.

    We have released a new version that addresses this issue.

    Thread Starter airdrummer

    (@airdrummer)

    thanx, glad2b of service;-)

    i note u added yop_poll_vote_recorded_with_details

    got dox?

    Plugin Author YOP

    (@yourownprogrammer)

    it can be called like this …

    add_action(
        'yop_poll_vote_recorded_with_details',
         function( $poll_id, $vote_data ) {
            /*
            $vote_data is an object containing all the data
              for the vote
            */
            //do stuff here
         },
         10,
         2
    );
    Thread Starter airdrummer

    (@airdrummer)

    i’m writing to debug.log, but nothing seems to be output:-\

    Plugin Author YOP

    (@yourownprogrammer)

    Hello

    Are you testing the exact same code posted on this thread?

    Thread Starter airdrummer

    (@airdrummer)

    if (!function_exists('write_log')) {
    function write_log($log) {
    if (true === WP_DEBUG) {
    if (is_array($log) || is_object($log)) {
    error_log(print_r($log, true));
    } else {
    error_log($log);
    }
    }
    }
    } if (function_exists('yop_poll_vote_recorded_with_details'))
    {
    function cg_vote_recorded( $poll_id, $vote_data )
    {
    write_log("====yop-poll#". $poll_id);
    write_log($vote_data);
    }
    add_action(
    'yop_poll_vote_recorded_with_details',
    'cg_vote_recorded',
    10,
    2
    );
    }

    and of course i turned debug on:

    define('WP_DEBUG', true);
    define( 'WP_DEBUG_LOG', '/tmp/wp-errors.log' );
    define( 'WP_DEBUG_DISPLAY', false );

    logfile is empty after multiple votes

    Plugin Author YOP

    (@yourownprogrammer)

    You are writing to log only if a function called yop_poll_vote_recorded_with_details exists.

    And since this function does not exist, the rest of the code it’s not being executed.

    Can you give the code below a try?

    if (!function_exists('write_log')) {
    	function write_log($log) {
    		if (true === WP_DEBUG) {
    			if (is_array($log) || is_object($log)) {
    				error_log(print_r($log, true));
    			} else {
    				error_log($log);
    			}
    		}
    	}
    }
    
    function cg_vote_recorded( $poll_id, $vote_data ) {
    	write_log("====yop-poll#". $poll_id);
    	write_log($vote_data);
    }
    add_action(
    	'yop_poll_vote_recorded_with_details',
    	'cg_vote_recorded',
    	10,
    	2
    );
    Thread Starter airdrummer

    (@airdrummer)

    ah, i’d forgotten to consider loading order, thanx…unfortunately, i still see nothing in the error log:-\

    Plugin Author YOP

    (@yourownprogrammer)

    @airdrummer here are you adding this code?

    is it in a custom plugin?

    or … ?

    • This reply was modified 1 year, 8 months ago by YOP.
    Thread Starter airdrummer

    (@airdrummer)

    it is in my site-specific code plugin…i’ll try directly outputting to screen

    Plugin Author YOP

    (@yourownprogrammer)

    @airdrummer id you manage to get it to work?

    Or still having issues?

    Thread Starter airdrummer

    (@airdrummer)

    sorry havent gotten back to it yet

    Thread Starter airdrummer

    (@airdrummer)

    i just added echoes to the write_log function, and on submit, a spinner runs until the page is manually refreshed. the vote does get recorded, but nothing appears in error-log

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Min/max answers > 1 overrides Allow multiple answers’ is closed to new replies.