Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter cpoakl

    (@cpoakl)

    That issue looks solved with newer versions (currrently 1.1.24 on WP 6.6.2)

    Thread Starter cpoakl

    (@cpoakl)

    Thank you for fixing it. Issue now fully resolved!

    Thread Starter cpoakl

    (@cpoakl)

    Thank you, I confirm the CF7 shortcode issue is fixed with 1.6.0.
    And thank you for checking the multi step point.

    However I am afraid something broke the altcha widget on other places – at least on the login page. The altcha box is not shown anymore (although it is there in the HTML), so I can’t verify and can’t log in anymore.
    Following error message is displayed (which seems unrelated to login page):

    Error : Cannot submit your message.

    When reverting to 1.5.0, it works as intended.

    Thread Starter cpoakl

    (@cpoakl)

    Thank you for the feedback. Looking forward to hearing from you then, and let me know if you require more info.

    Thread Starter cpoakl

    (@cpoakl)

    So far I basically manually changed content: "." for content:" " in lightbox.min.css (which will get broken at next plugin update unless you can fix the master copy in that way).
    I have only one website example at disposal using this lightbox for one gallery, so that does not make a large sample, although I couldn’t notice any difference for the lightbox after the CSS modification.
    Thank you for the follow-up.
    Best.

    • This reply was modified 1 year, 5 months ago by cpoakl.
    Thread Starter cpoakl

    (@cpoakl)

    Hmm I eventually found out that it was due to a custom filter hooked to wpseo_title and which was messing up things, probably due to some settings changed in Yoast.

    Thread Starter cpoakl

    (@cpoakl)

    Thanks a lot for the debugging guidance.

    I was mistaken thinking it was standard WPDB property and as you said it is WP-Polls which adds it. However from what I can see in the plugin’s code, it simply consists of adding the prefix to the table name and is never redefined elsewhere $wpdb->pollsip = $wpdb->prefix.'pollsip';

    Yes sorry for the confusion but as you got it s72test() is functionally identical to mybuggytest().

    I did as you suggested – replaced the 2 occurrences of $wpdb->pollsip with hard-coded table name but it made no difference.

    I also tried firing the function with add_action('wp_loaded', 'S72_vote_activation'); instead of plugin activation’s hook AND THERE IT WORKS AS EXPECTED (just updated this answer as I was saying the opposite in the previous version due to a typo in the tested code).

    Below is the new plugin version with wp_loaded hook (I normalised a few names in it, but it remains functionally identical).

    <?php
    	defined( 'ABSPATH' ) or die( 'Hello world' );
    	
    	/**
    	* Plugin Name: 			     Plugin Test 
    	* Description: 			     https://www.ads-software.com/support/topic/how-comes-the-second-mysql-query-is-executed-before-the-first-one/#post-14844346
    	* Author:      				 Cpoakl
    	* Version: 	   				 1.0.1
    	*/
    
    	//register_activation_hook( __FILE__, 'run_my_buggy_test' );
    	
    	add_action('wp_loaded', 'run_my_buggy_test');
    	
    	function run_my_buggy_test() {
    		global $wpdb;
    		$my_buggy_test_debug = my_buggy_test();
    	}
    	
    	function my_buggy_test(){
    		global $wpdb;
    		$API_film_id = 112962;
    		$API_user_id = 1956461;
    		$API_answers_ids = array(46);
    		$result = '';
    		//$user_has_already_voted = array();
    		
    		//check vote status
    		$S72_user_record = $wpdb->get_col( $wpdb->prepare( "SELECT pollip_aid FROM wp_pollsip WHERE pollip_qid = 45 AND pollip_uid_s72 = %d", $API_user_id ) );
    		if ( $S72_user_record ) { //user has already voted 
    			$user_has_already_voted = $S72_user_record; //indexed array containing one integer as value in the test  					
    		} else { //user has not voted yet
    			$user_has_already_voted = false; //boolean false
    		}
    		
    		var_dump($user_has_already_voted); //check var content for debugging purpose
    		
    		//if not already voted, update DB with vote
    		if (empty($user_has_already_voted) || $user_has_already_voted == ''){
    			//die('stop now');
    			foreach ($API_answers_ids as $polla_aid) {
    														$wpdb->insert(
    															"wp_pollsip",
    															array(
    																'pollip_qid'		=> 45,
    																'pollip_aid'		=> $polla_aid,
    																'pollip_uid_s72' 	=> $API_user_id
    															),
    															array(
    																'%d',
    																'%d'
    															)
    														);
    			}			
    			$result = 'success'; //$user_has_already_voted was false, so DB entry was inserted
    		} else {
    			$result = 'failure'; //$user_has_already_voted was an array containing a value, so DB entry was NOT inserted
    		}
    		die($result); //output result if WP_DEBUG is set to true
    	}

    So the issue has to do with the registration hook, but how comes?

    EDIT: from that list, it works AS EXPECTED with all the hooks tested within the category “Front actions”, as early of ‘registered_taxonomy’ (the 3 previous ones do not execute the function at all)

    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    Thread Starter cpoakl

    (@cpoakl)

    You are right, I did as suggested and it worked as expected for me as well from default theme’s functions.php.

    I’ve just tried to reduce my plugin to the scope of the test in order to see what could be conflicting, but with as little as what is herebelow, it still has the unexpected behaviour and i don’t get why.

    Would you have any clue?

    
    <?php
    	defined( 'ABSPATH' ) or die( 'Hello world' );
    	
    	/**
    	* Plugin Name: 			     Plugin Test 
    	* Description: 			     https://www.ads-software.com/support/topic/how-comes-the-second-mysql-query-is-executed-before-the-first-one/#post-14844346
    	* Author:      				 Cpoakl
    	* Version: 	   				 1.0.1
    	*/
    
    	
    	register_activation_hook( __FILE__, 'S72_vote_activation' );
    	
    	function S72_vote_activation( $network_wide ) {
    		
    		// Require WP-Polls as parent plugin since it makes calls to many of its functions
    		if ( ! is_plugin_active( 'wp-polls/wp-polls.php' ) and current_user_can( 'activate_plugins' ) ) {
    			// Stop activation redirect and show error
    			wp_die();
    		}
    					$s72_debug = s72test();
    
    	}
    
    	
    	function s72test(){
    		global $wpdb;
    		$API_film_id = 112972;
    		$API_user_id = 1956471;
    		$API_answers_ids = array(46);
    		$result = '';
    		//$user_has_already_voted = array();
    		
    		//check vote status
    		$S72_user_record = $wpdb->get_col( $wpdb->prepare( "SELECT pollip_aid FROM $wpdb->pollsip WHERE pollip_qid = 45 AND pollip_uid_s72 = %d", $API_user_id ) );
    		if ( $S72_user_record ) { //user has already voted 
    			$user_has_already_voted = $S72_user_record; //answer ID is a positive integer 					
    		} else { //user has not voted yet
    			$user_has_already_voted = false;
    		}
    		var_dump($user_has_already_voted);
    		
    		//if not already voted, update DB with vote
    		if (empty($user_has_already_voted) || $user_has_already_voted == ''){
    			//die('stop now');
    			foreach ($API_answers_ids as $polla_aid) {
    														$wpdb->insert(
    															$wpdb->pollsip,
    															array(
    																'pollip_qid'		=> 45,
    																'pollip_aid'		=> $polla_aid,
    																'pollip_uid_s72' 	=> $API_user_id
    															),
    															array(
    																'%d',
    																'%d'
    															)
    														);
    			}			
    			$result = 'success';	
    		} else {
    			$result = 'failure';
    		}
    		die($result);
    	}
    	
    	

    Note that if I disable WP-Polls, the query with wpdb::$pollsip does not work anymore (not sure why, but that table was created by WP Polls).

    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    • This reply was modified 3 years, 2 months ago by cpoakl.
    Thread Starter cpoakl

    (@cpoakl)

    Thank you both for your reply.

    @bcworkz I am quite surprised it works as expected for you! Actually the simplified form of the function I posted hereinabove (and that is not having the expected behavior for me) is not making call to any of WP-Polls’ functions. For me the debugging output of the first pass (with emptied database) shows: $user_has_already_voted isarray(1) { [0]=> string(2) "47" } and result failure, THOUGH it creates the entry of the foreach loop in the DB.
    The second pass outputs the same but doesn’t create a new entry in the DB (which here is the expected behavior). I tried changing the value of $API_answer_ids for the second pass to see, and it is as expected the value of the database which is contained in $user_has_already_voted.

    So as this simplified function only calls WPDB class and apart from that is made out of standard PHP functions, the only difference I would see is the DB structure?! In my case:
    pollip_aid is int(10) NOT NULL DEFAULT 0
    pollip_qid is int(10) NOT NULL DEFAULT 0
    pollip_uid_s72 is int(10) NOT NULL
    None of those are the primary key of the table, but an index is created for the 2 first (creation of those fields and index was managed by WP-Polls, while I added the last field to the existing DB).

    Would this ring your bell ?!

    @mkarimzada I tried adding the OR condition you proposed but it makes no difference. Actually, at the time of evaluation by empty(), I don’t think $user_has_already_voted can be a string, I see it either as an array containing at least one entry or a boolean (false, in case no value was found by $wpdb->get_col).

    • This reply was modified 3 years, 2 months ago by cpoakl.
    Thread Starter cpoakl

    (@cpoakl)

    Thank you for your advice!

    Thread Starter cpoakl

    (@cpoakl)

    [EDIIT: je supprime ce commentaire sur nb2br() que j’ai résolu différemment sans rien modifier du plugin; les points de mon message précédent ci-dessus restent valables].

    • This reply was modified 3 years, 6 months ago by cpoakl.
    • This reply was modified 3 years, 6 months ago by cpoakl.
    • This reply was modified 3 years, 6 months ago by cpoakl.

    Bonsoir,

    En attendant une mise à jour du plugin corrigeant ce problème, vous pouvez éditer le fichier /wp-maintenance/themes/default/functions.php et remplacer la ligne 60 par $output .= nl2br(stripslashes($o['text_bt_maintenance']));. Les liens dans le footer fonctionneront ensuite normalement.

    Hi,

    Waiting for a plugin update, you can edit file /wp-maintenance/themes/default/functions.php and replace line 60 with $output .= nl2br(stripslashes($o['text_bt_maintenance']));. With this workaround, links in footer are working.

Viewing 13 replies - 1 through 13 (of 13 total)