itguysconsulting
Forum Replies Created
-
In case it helps your debugging and searching for the answer, I’ve been having the same weird error:
“Something went wrong. Please try again or choose another payment source.”
but only when I have the PayPal Card Processing enabled, and I am trying to process a regular PayPal account payment (not a card payment) on subsequent orders to a first order. (PayPal account payments work fine with Card Processing turned off, as it’s a totally different button.)
With Card Processing enabled, I have found that if I place a first order and pay with PayPal account it will work – I have to log into the PayPal pop up window, and it processes.
Subsequent orders however, don’t even get as far as opening the PayPal pop up, they just give the error above. It presents as the gold pill PayPal button holding onto the email address of the test PayPal account I used from the first order (creepy). If I click this, it fails every time with the error above.
(Aside: I wish it did not remember this person’s PayPal account after the first order.)So, this new special PayPal Pill button (that ONLY shows when Card Processing is enabled), has a drop down that has an option to “Pay with a different account” – If I choose this option I do not get the error. It works to pop up the PayPal window, and allows me to log in using the same PayPal account.
Subsequent orders will fail, unless I chose “Pay with a different account” every time, from the Pill buttons’ drop down.
Now… If I turn OFF “Paypal Card Processing”, I get the old, reliable, PayPal pill button (with no drop down to change accounts) and this button works fine for processing PayPal orders. No problems at all. Subsequent orders process no problem and there is no “holding onto” the user’s PayPal account email in the button. I have to log into PayPal to complete each order. Which is great! I just wish introducing the Card Processing Option didn’t come with this PayPal session-button combo.
I do not use Vaulting. I tried clearing the browser cache, the local and session storage. Could not get that PayPal button to forget the email address of the PayPal account that was used on my store. Which is bad. I don’t want their personal PayPal email address showing up on my site, where they signed up with a different email address. That looks really really bad, from an optics perspective.
Using Storefront Theme latest, PHP 8.0, Latest version 1.5.1 of the PayPal Payments Plugin, Latest version of WordPress.
Forum: Developing with WordPress
In reply to: Should plugins close $wpdb via $wpdb->close()Thanks for the reply! I started to get the sense that this was the case, and that my code didn’t work anyway… $wpdb->prepare returns a string, not a prepared statement (I’m used to the JDBC Java world).
OK My plugin is purely obtaining some cart data, and updating a custom table. So it sounds like I should not bother closing any connections, as I am not doing anything funky with the database really. Thanks!
Yes after finding the option to turn off the pagination URLs as pointed out above, I was able to remove the offset=0. Thanks, again!!!
—-
Just in case anyone follows this post in the future, ignore the original code above.
It had a couple defects, one resulting in a “#” refresh of the page after the first review slider transition started. Below is my latest JavaScript/jQuery that I am using with SiteReview plugin v4.6.3This version also has a transitionCountLimit to prevent a page left open from constantly polling the site for the next review.
Also I should have mentioned that this code must be placed inside a document ready event handler:
jQuery(document).ready(function($) { ....... });
If you don’t have this already replace the ……. with the JavaScript code below, and ensure you enqueue jQuery with your script in functions.php as shown in bold below…
wp_enqueue_script('my-child-theme-script', get_stylesheet_directory_uri() . '/assets/js/MyChildThemeScript.js', <strong>array('jquery'), </strong>wp_get_theme()->get('Version'), true);
Revised ‘Text Widget’ Shortcode:
[site_reviews class="custom-footer-testimonials-slider" display="1" pagination="ajax" hide="response" fallback="No reviews yet."]
And below is the guts of the jQuery code, which handles the slider:
/* Slider for Footer Reviews */ // Settings: var timeOutLength = 2000; // Milliseconds between transitions var transitionCountLimit = 20; // Limit # of transitions // in case somebody leaves page open (prevents indefinite queries). // Set to 0 for indefinite (not advised) // Initializations: var customFooterReviewsSliderPaused = false; var customFooterTimeoutFunctionID = undefined; var currentFooterPageNumber = 1; var transitionCount = 0; // Pause the slider on mouse enter: $(".custom-footer-reviews-slider").on("mouseenter", function() { customFooterReviewsSliderPaused = true; if (customFooterTimeoutFunctionID != undefined) { // stop the next slide from appearing: clearTimeout(customFooterTimeoutFunctionID); } }); // Resume the slider on mouse leave, even if transitionoCountLimit reached: $(".custom-footer-reviews-slider").on("mouseleave", function() { customFooterReviewsSliderPaused = false; // Assuming the user is still interacting with the site and hasn't walked off. // So allowing another transitionCountLimit more slides to be shown. // Remove "transitionCount=1;" line below for a hard stop after transitionCountLimit is reached: transitionCount = 1; advanceCustomReviewsSlider(); }); // Advance the slider, by finding the next available page button and clicking it // Or go back to page 1: function advanceCustomReviewsSlider() { if (customFooterReviewsSliderPaused === false) { // Grab the set of navigation links: $navLinks = $(".custom-footer-reviews-slider .nav-links"); // Find the current page we are on. $currentLink = $(".page-numbers.current", $navLinks); // Find the next page # link following this current page: $nextPage = $currentLink.next("a.page-numbers"); if ($nextPage != undefined && $nextPage.length > 0) { // Click the next available page # link: $nextPage[0].click(); } else { // No more pages... Go back to page 1: $page1 = $("a.page-numbers[data-page=1]"); if ($page1 != undefined && $page1.length > 0) { $page1[0].click(); } else { // Something went wrong, just terminate return; } } // If slider isn't paused, then wait timeOutLength to show advance the slider: if (customFooterReviewsSliderPaused === false) { customFooterTimeoutFunctionID = setTimeout(function() { // Checks if there is a limit, and enforces, or if limit is 0 continues. if (transitionCountLimit > 0 && transitionCount < transitionCountLimit) { transitionCount++; advanceCustomReviewsSlider(); } else if (transitionCountLimit == 0) { advanceCustomReviewsSlider(); } else { return; } }, timeOutLength); } } } // Delay timeOutLength seconds after page load before executing: setTimeout(function() { // Do the first slider transition to the next review: transitionCount++; advanceCustomReviewsSlider(); }, timeOutLength);
Oh wow, sorry about that. I have found the setting you mentioned now.
I don’t know how I managed to miss that as I thought I looked everywhere.
Thanks for the tips!PS: For some reason I did have to set the offset to 0, as it was always landing on page 2. So I just included that to enforce it.
- This reply was modified 4 years, 4 months ago by itguysconsulting.
This problem is bad code in their plugin.
I have found that when you deactivate it and reactivate it you will see these entries in the logs.The offending line of code is $test[[‘test’] which is inside an sprintf method. The %s is expecting a STRING value in the statement below:
$function = sprintf( 'get_test_%s', $test['test'] );
However, $test[test] is an Array object that looks like this:
[test] => Array ( [0] => Health_Check_Site_Status Object ( [mysql_min_version_check:Health_Check_Site_Status:private] => 1 [mysql_rec_version_check:Health_Check_Site_Status:private] => 1 [is_mariadb] => 1 [mysql_server_version:Health_Check_Site_Status:private] => 10.3.23-MariaDB-log-cll-lve [health_check_mysql_required_version:Health_Check_Site_Status:private] => 5.5 [health_check_mysql_rec_version:Health_Check_Site_Status:private] => 10.0 ) [1] => get_test_timezone_not_utc )
My guess is that they are attempting to print out get_test_timezone_not_utc (or whatever test it is running. However if they attempt to just pull that from the data then this line:
'get_test_%s',
would result in get_test_get_test_timezone_not_utcSo I THINK the fix is to replace
$function = sprintf( 'get_test_%s', $test['test'] );
with
$function = sprintf( '%s', $test['test'][1] );
But this reveals another code issue at line 2020
} else { $results[] = call_user_func( $test['test']); }
which I attempted to fixed by adding the [1] to get the test name.
} else { $results[] = call_user_func( $test['test'][1] ); }
HOWEVER, whoever coded this still has old data model mixed in with the new data model, and there are tests which are NOT arrays, like the rest of the data model.
eg: ‘loopback_requests’ and ‘dotorg_communication’So their code needs some work, because $test[‘test’] has two differing data structures.
EDIT:
Here is how I fixed this for each block in my version of their plugin file class-health-check-site-status.php. It gets rid of the debug log errors… God only knows if it fixes their plugin though…foreach ( $tests as $test ) { if (is_array($test['test'])) { $function = sprintf( '%s', $test['test'][1] ); } else { $function = sprintf( 'get_test_%s', $test['test'] ); } if ( method_exists( $this, $function ) && is_callable( array( $this, $function ) ) ) { $results[] = call_user_func( array( $this, $function ) ); } else { if (is_array($test['test'])) { $results[] = call_user_func( $test['test'][1] ); } else { $results[] = call_user_func('get_test_' . $test['test']); } } }
- This reply was modified 4 years, 5 months ago by itguysconsulting.
- This reply was modified 4 years, 5 months ago by itguysconsulting.
- This reply was modified 4 years, 5 months ago by itguysconsulting.