Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter mjdewitt

    (@mjdewitt)

    Well, it seems that Basic Authorization isn’t needed for the loopback requests. It is merely one of many possible authentications that WordPress will attempt to allow the edit to save.

    From what I can tell there are two issues with wp-admin/includes/file.php and the ability to edit PHP files as the Network Admin. The first is that WP does an SSL verification even on links that are on the same host. If you are using a self-signed certificate, this will fail unless you turn off sslverify. I’m still looking into the best way to do this as I want remote verification, but want to disable verifications to the hosts own IP addresses.

    The 2nd issue seems to be that the network admin url isn’t being used when creating the URL for the loopback request. Access logs were showing a 302 as the loopback attempted to request from /wp-admin/theme-editor.php rather than /wp-admin/network/theme-editor.php

    after putting this in place, PHP file editing started working:
    File.php
    if ( $plugin ) {
    if ( is_multisite() ) {
    $url = add_query_arg( compact( ‘plugin’, ‘file’ ), admin_url( ‘network/plugin-editor.php’ ) );
    } else {
    $url = add_query_arg( compact( ‘plugin’, ‘file’ ), admin_url( ‘plugin-editor.php’ ) );
    }
    } elseif ( isset( $stylesheet ) ) {
    error_log(‘editing theme’);
    if ( is_multisite() ) {
    $url = add_query_arg(
    array(
    ‘theme’ => $stylesheet,
    ‘file’ => $file,
    ),
    admin_url( ‘network/theme-editor.php’ )
    );
    } else {
    $url = add_query_arg(
    array(
    ‘theme’ => $stylesheet,
    ‘file’ => $file,
    ),
    admin_url( ‘theme-editor.php’ )
    );
    }
    } else {
    $url = admin_url();
    }

    What I don’t understand is how editing PHP files isn’t broken on every Multisite installation as I seem to be the only one raising this issue?

    Mike

    Thread Starter mjdewitt

    (@mjdewitt)

    I setup a self-signed certificate with NGINX with the following fastcgi_params:
    fastcgi_pass_header Authorization; <=throws undefined index error
    and
    fastcgi_param PHP_AUTH_USER $remote_user; <= value is NULL
    fastcgi_param PHP_AUTH_PW $http_authorization; <= value is NULL

    I believe these will only work if you authenticate against NGINX.

    Sorry to say this is still not working for me.

    Thread Starter mjdewitt

    (@mjdewitt)

    Happy New Year Shea,

    I am glad you agree that some notice of the ability to do search/replace within a Snippet is needed. For me, I tend to ignore stuff under the help tag as that is where all of the WP notices/nags appear.

    I would prefer to have the “link” to the keyboard shortcut list above the editing area. I think perhaps something as simple as “<Shortcuts>” with a low opacity that on hover, fades to full opacity as it displays the list of keyboard commands as “title” text. To be fancy, you could open a modal window.

    The other location that I think would work is above the “Description.” This can either be on the same line as “Run snippet everywhere” or it’s own line.

    I understand your concern over clutter and this is something that once you know it’s there, you don’t need to be reminded of it.

    I sent a PR and hope this helps.

    Mike

    Thread Starter mjdewitt

    (@mjdewitt)

    Shea,

    Apologies again on the confusion with the buttons.

    I just checked out the search and replace and they work great.

    Since this is new feature is hidden, it would be nice to have a note added to the UI (maybe under “Code?”) alerting people that (cntl-f) will search and (shift-cntl-f) will replace.

    Thank you for this awesome feature.

    Best,

    Mike

    Thread Starter mjdewitt

    (@mjdewitt)

    Hi Shea,

    I can understand your confusion since you don’t have the buttons. I emailed you a screenshot of my editor. This is how it has always been for me.

    Mike

    Thread Starter mjdewitt

    (@mjdewitt)

    Hey Shea,

    Thanks for looking into this. Is this ready as of 2.12.1? Or, did you meant the next release?

    When I mentioned broken before, I was referring to the key-bindings as both Chrome and Firefox already have key bindings for alt-f, ctl-f.

    I do see that this demo, https://codemirror.net/demo/search.html, works for me (now), but Snippets does not. But maybe it isn’t ready yet?

    Mike

    PS I noticed that the theme editor has buttons and responds to codemirror key bindings. Is it a big deal to implement the same interface for Snippet editing?

    Thread Starter mjdewitt

    (@mjdewitt)

    Hey Shea,

    I finally got around to checking it out and as much as I would like search and replace, I don’t think codemirror is going to deliver.

    I tried it out and modules loaded, no errors in the console, but just doesn’t seem to work. I decided to look for a working demo and can’t seeem to find one.

    Comments on git are less than encouraging.

    Mike

    mjdewitt

    (@mjdewitt)

    I am not sure if this is the same issue, but I ran into tax calculations being wrong when mixing a non-taxable item with a taxable. It seems that by default, the bundle is declared as taxable and the individual items tax_status did not come into play. My solution was to expose the tax_status and declare it for the bundle on the admin form.

    I am still playing with this, but the cart calculations are now correct for me.

    edit admin-form.php

    Add $tax_status here:

    
    		$on_product = wcpb_utils::get_wcpb_meta( $post->ID, '_wcpb_show_bundle_on_product', 'yes' );
    		$on_cart = wcpb_utils::get_wcpb_meta( $post->ID, '_wcpb_show_bundle_on_cart', 'yes' );
    		$on_order = wcpb_utils::get_wcpb_meta( $post->ID, '_wcpb_show_bundle_on_order', 'yes' );
    		$tax_status = wcpb_utils::get_wcpb_meta( $post->ID, '_tax_status', 'yes' );
    

    Add the WC tax form code here:

    
    		woocommerce_wp_checkbox( array( 'id' => '_wcpb_show_bundle_on_product', 'label' => __( 'Show on Product Page', 'wc-product-bundles' ), 'value' => 'yes', 'cbvalue' => $on_product, 'desc_tip' => 'true', 'description' => __( 'Un check if you want to hide the bundle on product page.', 'wc-product-bundles' ) ) );
    		woocommerce_wp_checkbox( array( 'id' => '_wcpb_show_bundle_on_cart', 'label' => __( 'Show on Cart Page', 'wc-product-bundles' ), 'value' => 'yes', 'cbvalue' => $on_cart, 'desc_tip' => 'true', 'description' => __( 'Un check if you want to hide the bundle on cart.', 'wc-product-bundles' ) ) );
    		woocommerce_wp_checkbox( array( 'id' => '_wcpb_show_bundle_on_order', 'label' => __( 'Show on Order', 'wc-product-bundles' ), 'value' => 'yes', 'cbvalue' => $on_order, 'desc_tip' => 'true', 'description' => __( 'Un check if you want to hide the bundle on order.', 'wc-product-bundles' ) ) );
    		
    		echo '</div>';
    		
    				if ( wc_tax_enabled() ) {
    
    //					echo '<div class="options_group show_if_simple show_if_external show_if_variable">';
    		echo '<div class="options_group pricing hide_if_virtual hide_if_grouped hide_if_external hide_if_simple hide_if_variable show_if_wcpb">';
    
    						// Tax
    						woocommerce_wp_select( array(
    							'id'      => '_tax_status',
    							'label'   => __( 'Tax status', 'woocommerce' ),
    							'options' => array(
    								'taxable' 	=> __( 'Taxable', 'woocommerce' ),
    								'shipping' 	=> __( 'Shipping only', 'woocommerce' ),
    								'none' 		=> _x( 'None', 'Tax status', 'woocommerce' )
    							),
    							'desc_tip'    => 'true',
    							'description' => __( 'Define whether or not the entire product is taxable, or just the cost of shipping it.', 'woocommerce' )
    						) );
    
    						$tax_classes         = WC_Tax::get_tax_classes();
    						$classes_options     = array();
    						$classes_options[''] = __( 'Standard', 'woocommerce' );
    
    						if ( ! empty( $tax_classes ) ) {
    							foreach ( $tax_classes as $class ) {
    								$classes_options[ sanitize_title( $class ) ] = esc_html( $class );
    							}
    						}
    
    						woocommerce_wp_select( array(
    							'id'          => '_tax_class',
    							'label'       => __( 'Tax class', 'woocommerce' ),
    							'options'     => $classes_options,
    							'desc_tip'    => 'true',
    							'description' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'woocommerce' )
    						) );
    
    						do_action( 'woocommerce_product_options_tax' );
    
    					echo '</div>';
    
    				}		
    
    mjdewitt

    (@mjdewitt)

    I changed two lines on admin-form.php:
    from
    add_filter( ‘product_type_selector’, array( $this, ‘wcpb_add_product_bundle_type’ ), 1, 2 );

    TO
    add_filter( ‘product_type_selector’, array( $this, ‘wcpb_add_product_bundle_type’ ), 1, 1 );

    and

    FROM
    function wcpb_add_product_bundle_type( $ptypes, $ptype ) {

    TO
    function wcpb_add_product_bundle_type( $ptypes ) {

    $ptype seems to have gone away? Not sure why this was needed in first place.

    Mike

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