Philip K Meadows
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Roids] NGINX?To follow up on this;
As WP Roids edits and relies upon
.htaccess
it should work if using NGINX as a reverse proxy, keeping Apache functionalityIf NGINX is used standalone I doubt it would work, unless you can duplicate the rewrite rules from
.htaccess
onto the serverReference: https://codex.www.ads-software.com/Nginx
Forum: Plugins
In reply to: [WP Roids] WP Roids Plugin won’t get Activate.Is there anything in your server error logs?
I’d be happy to see if I can fix for you, but would require an admin WP login and FTP access
It is 01:00am here in UK, so going to bed
Back in a few hours…
Forum: Plugins
In reply to: [WP Roids] Does it work with CDN?It goes through all scripts and styles registered via the usual
wp_enqueue_
methodsIf any aren’t local, it will ignore them and process as usual
However, it is currently assuming jQuery and jQuery-migrate are local, so disable these via CDN if they are served this way
Let me know how this goes and we’ll go from there…
Forum: Plugins
In reply to: [WP Roids] NGINX?THAT, is a good question
I don’t have access to test on NGINX, so invite you to try it
WP Roids doesn’t make any database edits except for one scheduled task being registered
It edits
.htaccess
too. Those are the only two intrusions it makesActivate and see is all I can say. If s**t hits fan, simply deactivate and all should be well
Then let me know what happened and I can look to incorporate NGINX…
Forum: Plugins
In reply to: [WP Roids] WP Roids Plugin won’t get Activate.Yeah, the top log in WP does that, even if my script kills activation :/
But, it should give a message. The checks it does are;
- PHP is at least 5.4
- cURL is enabled on server
.htaccess
is writable- Other popular caching plugins are NOT active
It doesn’t check for Wordfence Falcon caching (soon to be depreciated), I’ll add in next release
Do any of these sound possible issues for you?
Forum: Plugins
In reply to: [WP Roids] WP Roids Plugin won’t get Activate.Hi there
Thanks for downloading.
Do you receive any error messages when trying to activate?
Phil
I had similar problem
The problem for me was caused by iThemes Security, which I know a lot of you may use
In the iThemes Security Settings page > System Tweaks, uncheck the box marked “Filter Long URL Strings”
Phil ??
I had similar problem
The problem for me was caused by iThemes Security, which I know a lot of you may use
In the iThemes Security Settings page > System Tweaks, uncheck the box marked “Filter Long URL Strings”
Phil ??
Update!!!
I had this issue on WP 4.2.2
My problem was that I have another plugin that sends mail via SMTP, but the “from” address set in s2Member was a Gmail account
The solution was to change the “from” address from Gmail to an address on the same domain as the SMTP plugin uses (which is also my client’s site domain)
It now works ??
HTH, Phil
Update!!!
I had this issue on WP 4.2.2
My problem was that I have another plugin that sends mail via SMTP, but the “from” address set in s2Member was a Gmail account
The solution was to change the “from” address from Gmail to an address on the same domain as the SMTP plugin uses (which is also my client’s site domain)
It now works ??
HTH, Phil
Forum: Plugins
In reply to: [Postcode Based Order Restriction for WooCommerce] Postcode wildcardsYou’re welcome
I may even put it in the WP Plugin repo, if I get time / can be bothered!
Phil ??
Forum: Plugins
In reply to: [Postcode Based Order Restriction for WooCommerce] Postcode wildcardsDownload: pkm-wc-local-shop.zip – save to your Desktop / wherever
Go to Plugins > Add New > Upload Plugin
Forum: Plugins
In reply to: [Postcode Based Order Restriction for WooCommerce] Postcode wildcardsHi guys
Try this code as a new plugin…
Note: No warranties implied, use at own risk, yadda yadda yadda
<?php /* Plugin Name: WooCommerce Local Shop Description: Make WooCommerce only serve customers in/not-in certain Postcodes/ZIP codes Version: 1.0 Author: Phil Meadows Author URI: https://www.philmeadows.com License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ // Exit if accessed directly if( ! defined( 'ABSPATH' ) ) exit; // Check class not defined if( ! class_exists( 'WoocommerceLocalShop' ) ) { // Define our class class WoocommerceLocalShop { private static $instance = NULL; private $className; private $pluginName; private $textDomain; private $locale; private $codeType; private $enabled; private $addressType; private $mode; private $postcodes; private $message; /** * Create or return instance of this class */ public static function instance() { $className = get_class(); if( ! isset( self::$instance ) && ! ( self::$instance instanceof $className ) && ( self::$instance === NULL ) ) { self::$instance = new $className; } return self::$instance; } // END instance() /** * Our constructor */ public function __construct() { $this->className = get_class(); $this->pluginName = 'WooCommerce Local Shop'; $this->textDomain = 'pkmwcls'; $this->locale = get_option( 'woocommerce_default_country' ); $this->codeType = $this->locale === 'US' ? 'Zip Code' : 'Postcode'; $this->enabled = get_option($this->textDomain.'_enabled'); $this->addressType = get_option($this->textDomain.'_restrict_address'); $this->mode = get_option($this->textDomain.'_restrict_mode'); $this->postcodes = get_option($this->textDomain.'_postcodes'); $this->message = get_option($this->textDomain.'_message'); if( ! $this->checkRequirements() ) return; add_filter( 'woocommerce_general_settings', array( &$this, 'addSettings' ) ); if( $this->enabled === 'yes' ) add_filter( 'woocommerce_order_button_html', array( $this, 'run' ) ); } // END __construct() /** * Check dependencies */ public function checkRequirements() { require_once(ABSPATH.'/wp-admin/includes/plugin.php'); if( !is_plugin_active( 'woocommerce/woocommerce.php' ) ) { add_action( 'admin_notices', array( &$this, 'requirementsNotice' ) ); deactivate_plugins( plugin_basename( __FILE__ ) ); return FALSE; } return TRUE; } // END checkRequirements() /** * Display requirement message */ public function requirementsNotice() { echo '<div id="message" class="error"><p><strong>'; echo __( 'Sorry, ' . $this->pluginName . ' requires WooCommerce to be installed and active. Please resolve this', $this->textDomain ); echo '</strong></p></div>'; } // END requirementsNotice() /** * Add our settings to the general options page */ public function addSettings($settings) { $newSettings = array(); foreach( $settings as $k => $setting ) { // Add our new section at the bottom of the general options if( $setting['id'] == 'general_options' && $setting['type'] == 'sectionend' ) { // end the general options section $newSettings[] = array( 'type' => 'sectionend', 'id' => 'general_options'); // Start new section "Postcode / ZIP Code Order Restriction" $newSettings[] = array( 'title' => __( $this->pluginName.': '. $this->codeType.' Order Restriction', 'woocommerce' ), 'type' => 'title', 'id' => $this->textDomain.'_postcode_restriction', ); // Enable Postcode / ZIP Code Order Restriction $newSettings[] = array( 'title' => __( 'Enable / Disable', 'woocommerce' ), 'desc' => __( 'Enable '.$this->codeType.' Order Restriction', 'woocommerce' ), 'id' => $this->textDomain.'_enabled', 'type' => 'checkbox', 'default' => 'No', ); // Restriction mode either allow or disallow $newSettings[] = array( 'title' => __( 'Restriction Mode', 'woocommerce' ), 'desc' => __( 'Do you want to allow or disallow certain '.$this->codeType.'s?', 'woocommerce' ), 'id' => $this->textDomain.'_restrict_mode', 'type' => 'select', 'class' => 'chosen_select', 'default' => 'allow', 'options' => array( 'allow' => __( 'Allow', 'woocommerce' ), 'disallow' => __( 'Disallow', 'woocommerce' ), ) ); // Which address(es) are we applying this to? $newSettings[] = array( 'title' => __( 'Base Restriction Upon', 'woocommerce' ), 'desc' => __( 'Which customer address do you wish to apply the restriction on?', 'woocommerce' ), 'id' => $this->textDomain.'_restrict_address', 'type' => 'select', 'class' => 'chosen_select', 'default' => 'shipping', 'options' => array( 'shipping' => __( 'Shipping Address', 'woocommerce' ), 'billing' => __( 'Billing Address', 'woocommerce' ), 'both' => __( 'Either Address', 'woocommerce' ), ) ); // Postcodes / ZIP Codes $newSettings[] = array( 'title' => __( $this->codeType.'s', 'woocommerce' ), 'id' => $this->textDomain.'_postcodes', 'type' => 'text', 'class' => 'regular-input', 'desc' => __( '<br>Separate codes with a comma. Accepts wildcards, e.g. <code>P*</code> will match a postcode of PE30 and PO1.<br>Also accepts a pattern, e.g. <code>NG1___</code> would match NG1 1AA but not NG10 1AA', 'woocommerce' ), 'placeholder' => 'e.g. WD23*,90210', ); // Message for customers who get jilted $newSettings[] = array( 'title' => __( 'Message to Customer', 'woocommerce' ), 'id' => $this->textDomain.'_message', 'css' => 'width:94%;', 'type' => 'text', 'default' => __('Sorry, we are not accepting orders for that'.($this->addressType !== 'both' ? ' '.$this->addressType : '').' address '.$this->codeType.'.', 'woocommerce' ), ); // end our settings section $newSettings[] = array( 'type' => 'sectionend', 'id' => $this->textDomain.'_postcode_restriction'); } else { $newSettings[] = $setting; } } return $newSettings; } // END addSettings() /** * Bust the postcodes/ZIP codes into an array */ private function getPostcodes() { $codes = array(); if ( $this->postcodes !== '' ) { foreach( explode( ',', $this->postcodes ) as $code ) { $codes[] = strtoupper( trim( $code ) ); } } return $codes; } // END getPostcodes() /** * Sanitise a postcode/ZIP code */ private function cleanPostcode( $code ) { return str_replace( '-', '', sanitize_title( $code ) ) . ( strstr( $code, '*' ) ? '*' : '' ); } // END cleanPostcode() /** * is a postcode/ZIP code valid? */ private function isValidPostcode( $postcode ) { $codes = $this->getPostcodes(); $postcode = $this->cleanPostcode( $postcode ); $formattedPostcode = wc_format_postcode( $postcode, $this->locale ); if ( in_array( $postcode, $codes ) || in_array( $formattedPostcode, $codes ) ) { return TRUE; } // Pattern matching foreach ( $codes as $c ) { $pattern = '/^' . str_replace( '_', '[0-9a-zA-Z]', preg_quote( $c ) ) . '$/i'; if ( preg_match( $pattern, $postcode ) ) { return TRUE; } } // Wildcard search $wildcardPostcode = $formattedPostcode . '*'; $postcodeLength = strlen( $formattedPostcode ); for ( $i = 0; $i < $postcodeLength; $i++ ) { if ( in_array( $wildcardPostcode, $codes ) ) { return TRUE; } $wildcardPostcode = substr( $wildcardPostcode, 0, -2 ) . '*'; } return FALSE; } // END isValidPostcode() /** * edit the Place Order button */ public function disablePaymentButton() { $output = ''; if( $this->message == '' ) { $output = '<ul class="woocommerce-error"><li>'. __('Sorry, we are not accepting orders for that'.($this->addressType !== 'both' ? ' '.$this->addressType : '').' address '.$this->codeType.'.', 'woocommerce' ) .'</li></ul>'; } else { $output = '<ul class="woocommerce-error"><li>'. __($this->message, 'woocommerce' ) .'</li></ul>'; } return $output; } // END disablePaymentButton() /** * is the transaction allowed? */ private function isOrderAllowed() { global $woocommerce; $shippingPostcode = $woocommerce->customer->shipping_postcode; $billingPostcode = $woocommerce->customer->postcode; if ( $this->addressType !== '' && $this->mode !== '' && $this->postcodes !== '' && $billingPostcode !== '' && $shippingPostcode !== '' ) { switch ( $this->addressType ) { case 'shipping': $outcome = $this->isValidPostcode( $shippingPostcode ); if ( $outcome === TRUE && $this->mode === 'allow' ) return TRUE; if ( $outcome === TRUE && $this->mode === 'disallow' ) return FALSE; if ( $outcome === FALSE && $this->mode === 'allow' ) return FALSE; if ( $outcome === FALSE && $this->mode === 'disallow' ) return TRUE; break; case 'billing': $outcome = $this->isValidPostcode( $billingPostcode ); if ( $outcome === TRUE && $this->mode === 'allow ') return TRUE; if ( $outcome === TRUE && $this->mode === 'disallow' ) return FALSE; if ( $outcome === FALSE && $this->mode === 'allow ') return FALSE; if ( $outcome === FALSE && $this->mode === 'disallow' ) return TRUE; break; case 'both': $outcomeA = $this->isValidPostcode( $shippingPostcode ); $outcomeB = $this->isValidPostcode( $billingPostcode ); if ( ( $outcomeA === TRUE || $outcomeB === TRUE ) && $this->mode === 'allow' ) return TRUE; if ( ( $outcomeA === TRUE || $outcomeB === TRUE ) && $this->mode === 'disallow' ) return FALSE; if ( ( $outcomeA === FALSE || $outcomeB === FALSE ) && $this->mode === 'allow' ) return FALSE; if ( ( $outcomeA === FALSE || $outcomeB === FALSE ) && $this->mode === 'disallow' ) return TRUE; break; } // END switch } // END if vars set } // END isOrderAllowed() public function run() { if ( ! $this->isOrderAllowed() ) { return $this->disablePaymentButton(); } else { $btnText = apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) ); $btn = '<input type="submit" class="button alt" name="woocommerce_checkout_place_order" id="place_order" value="'.esc_attr( $btnText ).'" data-value="'.esc_attr( $btnText ).'">'; return $btn; } } } // END class WoocommerceLocalShop // fire her up! WoocommerceLocalShop::instance(); } // END if no class
Forum: Plugins
In reply to: [Pagely MultiEdit] Does not workI second the recommendation of ACF
There is a free version: https://www.ads-software.com/plugins/advanced-custom-fields/
Hi Cédric
Did you ever get to the bottom of this?
I am having similar issues. Seems to only happen when using “Hide Backend” feature along with having the s2Member plugin installed.
Many thanks
Phil ??