Duncan
Forum Replies Created
-
Forum: Plugins
In reply to: [Limit Login Attempts Reloaded] Plugin Conflict with WPS Hide Your LoginJust some feedback, I also use WPS Hide My Login to hide the default WordPress login (which I don’t use, using WooCommerce login instead) but things look okay.
I ran three login tests just now with the (moved) WordPress login and it went fine – two logins for one test account, one login using another test account. I’ve added RS Captcha to my login forms so completed the Captcha correctly, just to mention the test environment more fully.
I’m using Chrome for Windows and regularly clear the cache of all but cookies (because Chrome, gahh!!). There doesn’t seem to be a conflict, as far as I can tell, but perhaps my custom code for RS Captcha somehow bypasses the conflict?
Just adding in the hope it helps, both great plugins.
Forum: Plugins
In reply to: [Limit Login Attempts Reloaded] Cannot login with email addressLogging in with an email address works for me when the user_login field is, itself, an email address (which I have configured my site to use) e.g. login as [email protected]
Login also works when the user_login field is, say, user1 and the email address [email protected] is entered as the login name. e.g. login as user1.
I’m using plugin version 2.26.14 – login with email address appears to be working fine, if that’s helpful.
Removing the Otter AI block from Otter Options – Block Settings – AI block ‘visibility’ does not remove it from the block toolbar (at least on my system).
Would really appreciate the option to remove this from the toolbar, please, else I can’t use this plugin anymore – it’s too “in your face”.
Update:
To recap, if an accordion content – the description entry – has a backslash character then the accordion becomes corrupted and the error –Warning: foreach() argument must be of type array|object, bool given in D:\web\laragon\www\stellarbusinessenglish.com\wp-content\plugins\sbe-responsive-accordion-and-collapse\front\ac-content.php on line 57
– appears.
The content can still be retrieved in wp_postmeta with the post_id of the original accordion (as shown in the URL of the ‘edit accordion’) and copied into a new accordion, if needs be … minus the offending backslash, of course.
It would appear that the stripslashes() function which – as the name suggests – removes such characters is for some reason not working, at least in PHP 8.1.12 and Responsive Accordion 2.3.8.
As a workaround, locating plugin file /lib/admin/ac-save-data.php and adding the line after line 8 such that –
if($TotalCount) { $accordion_title = stripslashes(sanitize_text_field($_POST['accordion_title'] [$i]));
becomes –
if($TotalCount) { $_POST['accordion_desc'][$i] = str_replace("\\", "", $_POST['accordion_desc'][$i] ); $accordion_title = stripslashes(sanitize_text_field($_POST['accordion_title'][$i]));
– will fix the problem, removing backslash characters as desired. Accordion content with backslashes – which my own have several of, for reasons not relevent to this post, then have them removed and the accordion functions once more as intended.
There appears nothing at fault with the nice, clean, well-written plugin code itself. I can’t trace why this is happening, and post this in the hope it is valuable to the plugin developers and anyone else who encounters backslash-related issues with this lovely accordion plugin.
- This reply was modified 2 years ago by Duncan. Reason: syntax error around code snippet
- This reply was modified 2 years ago by Duncan. Reason: syntax error around code snippet
- This reply was modified 2 years ago by Duncan. Reason: Making post more understandable
- This reply was modified 2 years ago by Duncan. Reason: typo in coce
You lose the accordion description (content), yes, but also cannot edit it to remove the backslash. I had posted a workaround here but have withdrawn it as it wasn’t properly tested, apologies. If I get it to work, I’ll add it here.
Oops! Minor bug in my reply above which I can no longer edit. Here’s the code without the bug, sorry.
<?php /* Curcy filter - Fine control over where the CURCY plugin is displayed. - Removes from all pages/posts except those specified in line 25 below. - Place this file in wp-content/mu-plugins -- The file can have any name, but curcy-control.php is good choice. - This code is based on the superb article from Kinsta below (due thanks and respect there!) Ref: - https://kinsta.com/blog/disable-wordpress-plugins-loading/ Last Update: 18.02.2022 */ /* -- -- -- CONFIGURATION START -- -- --*/ /* Below you need to specify a list of URL paths where CURCY plugin SHOULD be loaded. For example: https://mysite.com/shop/ has allowed path of 'shop' https://mysite.com/cart/ has allowed path of 'cart' */ $allowed_paths = array("shop","pricing","cart","basket","product","checkout"); /* -- -- -- -- CONFIGURATION END -- -- -- */ // Get path i.e. after web server name $current_page_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); // Find out if user is accessing admin panel. If not, then can enable plugin filter safely. $is_admin= (strpos($current_page_path, 'wp-admin')) ? true: false; // If not admin panel ... if( !$is_admin ){ add_filter( 'option_active_plugins', function( $plugins ){ // Get this variable defined outside the function. global $current_page_path; /* Work out if on home page, which will not have anything after the server name. Little bit of a hack!:-) - Not used in the code below but if you need CURCY on the home page, you might need to do some homepage detection. */ $onhomepage = false; if ( ($current_page_path == '/') || ($current_page_path == '')){ $onhomepage = true; } /* - We create an array to holding active plugins that should be removed from the current post/page. - This only holds the CURCY plugin but you can add more plugins to remove if desired. - Refer to the KINSTA article reference at the start of this code to find out, easily, how to get the plugin path and name you see below. */ $plugins_to_remove = array(); $plugins_to_remove [] = "woo-multi-currency/woo-multi-currency.php"; // Set a default flag to remove the CURCY plugin. $remove_CURCY = true; /* Now cycle through allowed_paths and see if any match the current page. If so, set the 'remove_CURCY' flag to false and break out the allowed_paths loop. */ global $allowed_paths; // Pick up the paths from outside this function, set at the start. foreach ($allowed_paths as $allowed_path) { // Syntax: if (some condition) value if true : value if false $is_allowed_page = (strpos($current_page_path, $allowed_path)) ? true: false; if ($is_allowed_page){ $remove_CURCY = false; break; } } /* Remove CURCY (or not :-) */ if ( $remove_CURCY == true ) { $plugins = array_diff( $plugins, $plugins_to_remove); } // Finally return the filtered list of active plugins for this page/post, with CURCY removed if desired. return $plugins; } ); } ?>
I wrote a simple “Must Use” plugin to give fine-control of the (brilliant) CURCY plugin that you could also try. Works for me ??
It removes the CURCY plugin from all pages except those that you specify, so I leave the plugin’s own filters alone. I tested that it removes CURCY from the /my-account/ area as I also use this.
Here’s the self–documented code. It should work, I tested it quite deeply, but I only wrote it today so … give it a go if you need to ??
Duncan<?php /* Curcy filter - Fine control over where the CURCY plugin is displayed. - Removes from all pages/posts except those specified in line 25 below. - Place this file in wp-content/mu-plugins -- The file can have any name, but curcy-control.php is good choice. - This code is based on the superb article from Kinsta below (due thanks and respect there!) Ref: - https://kinsta.com/blog/disable-wordpress-plugins-loading/ Last Update: 18.02.2022 */ /* -- -- -- CONFIGURATION START -- -- --*/ /* Below you need to specify a list of URL paths where CURCY plugin SHOULD be loaded. For example: https://mysite.com/shop/ has allowed path of 'shop' https://mysite.com/cart/ has allowed path of 'cart' */ $allowed_paths = array("shop","pricing","cart","basket","product","checkout"); /* -- -- -- -- CONFIGURATION END -- -- -- */ // Get path i.e. after web server name $current_page_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); // Find out if user is accessing admin panel. If not, then can enable plugin filter safely. $is_admin= (strpos($current_page_path, 'wp-admin')) ? true: false; // If not admin panel ... if( !$is_admin ){ add_filter( 'option_active_plugins', function( $plugins ){ // Get this variable defined outside the function. global $current_page_path; /* Work out if on home page, which will not have anything after the server name. Little bit of a hack!:-) - Not used in the code below but if you need CURCY on the home page, you might need to do some homepage detection. */ $onhomepage = false; if ( ($current_page_path == '/') || ($current_page_path == '')){ $onhomepage = true; } /* - We create an array to holding active plugins that should be removed from the current post/page. - This only holds the CURCY plugin but you can add more plugins to remove if desired. - Refer to the KINSTA article reference at the start of this code to find out, easily, how to get the plugin path and name you see below. */ $plugins_to_remove = array(); $plugins_to_remove [] = "woo-multi-currency/woo-multi-currency.php"; // Set a default flag to remove the CURCY plugin. $remove_CURCY = true; /* Now cycle through allowed_paths and see if any match the current page. If so, set the 'remove_CURCY' flag to false and break out the allowed_paths loop. */ global $allowed_paths; // Pick up the paths from outside this function, set at the start. foreach ($allowed_paths as $allowed_path) { // Syntax: if (some condition) value if true : value if false $is_allowed_page = (strpos($current_page_path, $allowed_path)) ? true: false; if ($is_allowed_page){ $remove_CURCY = false; break; } } /* Remove CURCY (or not :-) */ if ( $remove_CURCY == true ) { $plugins = array_diff( $plugins, $plugins_to_remove); } // Finally return the filtered list of active plugins for this page/post, with CURCY removed if desired. return $plugins; } ); } ?>
- This reply was modified 2 years, 9 months ago by Duncan. Reason: Code update
You can create a really simple “Must Use” plugin that lists the pages you want CURCY to be active on.
I had the same issue as I needed much finer control of where to have the plugin active, and created the MU Plugin below.
You need only edit $allowed_paths – the first variable in the script. The code is self-documenting. Let me know if it works for you, it does for me ??
<?php /* Curcy filter - Fine control over where the CURCY plugin is displayed. - This code is based on the superb article from Kinsta below (due thanks and respect there!) - Place this file in wp-content/mu-plugins -- The file can have any name, but curcy-control.php is good choice. Ref: - https://kinsta.com/blog/disable-wordpress-plugins-loading/ Last Update: 18.02.2022 */ /* -- -- -- CONFIGURATION START -- -- --*/ /* Below you need to specify a list of URL paths where CURCY plugin SHOULD be loaded. For example: https://mysite.com/shop/ has allowed path of 'shop' https://mysite.com/cart/ has allowed path of 'cart' */ $allowed_paths = array("shop","pricing","cart","basket","product","checkout"); /* -- -- -- -- CONFIGURATION END -- -- -- */ // Get path i.e. after web server name $current_page_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ); // Find out if user is accessing admin panel. If not, then can enable plugin filter safely. $is_admin= (strpos($current_page_path, '/wp-admin/')) ? true: false; // If not admin panel ... if( false === $is_admin ){ add_filter( 'option_active_plugins', function( $plugins ){ // Get this variable defined outside the function. global $current_page_path; /* Work out if on home page, which will not have anything after the server name. Little bit of a hack!:-) - Not used in the code below but if you need CURCY on the home page, you might need to do some homepage detection. */ $onhomepage = false; if ( ($current_page_path == '/') || ($current_page_path == '')){ $onhomepage = true; } /* - We create an array to holding active plugins that should be removed from the current post/page. - This only holds the CURCY plugin but you can add more plugins to remove if desired. - Refer to the KINSTA article reference at the start of this code to find out, easily, how to get the plugin path and name you see below. */ $plugins_to_remove = array(); $plugins_to_remove [] = "woo-multi-currency/woo-multi-currency.php"; // Set a default flag to remove the CURCY plugin. $remove_CURCY = true; /* Now cycle through allowed_paths and see if any match the current page. If so, set the 'remove_CURCY' flag to false and break out the allowed_paths loop. */ global $allowed_paths; // Pick up the paths from outside this function, set at the start. foreach ($allowed_paths as $allowed_path) { // Syntax: if (some condition) value if true : value if false $is_allowed_page = (strpos($current_page_path, $allowed_path)) ? true: false; if ($is_allowed_page){ $remove_CURCY = false; break; } } /* Remove CURCY (or not :-) */ if ( $remove_CURCY == true ) { $plugins = array_diff( $plugins, $plugins_to_remove); } // Finally return the filtered list of active plugins for this page/post, with CURCY removed if desired. return $plugins; } ); } ?>