ThemeFuse / Unyson

A WordPress framework that facilitates the development of WP themes
http://unyson.io
922 stars 217 forks source link

[bug] unique option does not work right on multisite #3365

Closed danyj closed 6 years ago

danyj commented 6 years ago

This is a big issue , @ViorelEremia @andreiglingeanu I have a function that reads post id and enqueues the builder shortcodes CSS

while this works perfect on normal install on multisites it is not enquing the shortcodes static

function does this

$pb_content = fw_ext_page_builder_get_post_content( $pb_id ); // post ID
fw_ext_shortcodes_enqueue_shortcodes_static( $pb_content );
danyj commented 6 years ago

OK this is not the fw_ext_page_builder_get_post_content but the unique option type that we use as hidden shortcode ID

        'id' => array(
            'type' => 'unique',
            'length' => 8
        ),

this is same option printed in view and static in section

http://prntscr.com/jib7k2

in view it changes on every refresh and in static it stays same as it was when page was saved

in both files we use

$id                     = fw_akg('id',$atts);
fw_print($id);
danyj commented 6 years ago

the content is outputed via

$pb_content = do_shortcode( fw_ext_page_builder_get_post_content( $pb_id ) );

danyj commented 6 years ago

in post meta I can see the correct ID

http://prntscr.com/jibdi4

but once it goes trough do_shortcode( fw_ext_page_builder_get_post_content( $pb_id ) );it comes out as random

danyj commented 6 years ago

commented this out https://github.com/ThemeFuse/Unyson/blob/master/framework/includes/option-types/simple.php#L1137-L1155

and regeneration stopped and the existing ID served ,

why is that working in frontend at all ? I tough this is supposed to be functional only when you save/change the options in backend and not check on every page load in frontend if there is a unique ID in post meta

danyj commented 6 years ago

Just retested , install theme demo on normal WP , no issues install same demo on multisite the uniqe is refreshing on every page load

danyj commented 6 years ago

@ViorelEremia bud can you please look at this.

ViorelEremia commented 6 years ago

Tomorrow in the morning.

ViorelEremia commented 6 years ago

I don't see any changes in the unique option type. I added an option type unique and I get it in the view.

add_action( 'wp_head', function() {
    echo do_shortcode( fw_ext_page_builder_get_post_content( 2 ) );
} );

in view:

echo '<pre style="overflow-y:scroll;background:#23282d;position:relative;z-index:11111;color:#78FF5B;line-height:16px;">';
print_r( fw_akg('unique_id',$atts) );
echo '</pre>';

Installation is multisite the id is the same.

danyj commented 6 years ago

on multisite?

ViorelEremia commented 6 years ago

Yes

danyj commented 6 years ago

dont do in wp head , the one I am using in wp head works

add this in page footer

echo do_shortcode( fw_ext_page_builder_get_post_content( 2 ) );

ViorelEremia commented 6 years ago

footer.php ?

danyj commented 6 years ago

yes

danyj commented 6 years ago

no action nothing , just that

ViorelEremia commented 6 years ago

no changes

ViorelEremia commented 6 years ago

it is the same

danyj commented 6 years ago

skype me let me give you the theme ,

youjoomla

ViorelEremia commented 6 years ago

send it on slack. I don't use skype

danyj commented 6 years ago

Tested now with The Core , bug is there it is related to unique ID and Woocomerce , if Woo plugin is off bug is gone .

How to test.

  1. Get the the-core theme I sent you and activate
  2. Download /activate Woo with products
  3. Create simple page with a text-block shortcode and note the page ID
  4. Change the page ID in these modified files;

line 21 in the-core-parent\theme-includes\static.php

and line 8 in themefooter.php

Go on any page and you should see the prints

the print from text-block static.php never changes where the one in footer.php changes on every page load.

I modified thetext-block shortcode to print the ID in view.php and static.php

danyj commented 6 years ago

And again , multisite only , I did not see this on normal installs

danyj commented 6 years ago

sent you backup demo with multi setup, should work I guess

danyj commented 6 years ago

did you had a chance to test?

danyj commented 6 years ago

@ViorelEremia can you please check this , I need to pack demos and cant because of this issue. Please.

ViorelEremia commented 6 years ago

Please test

ViorelEremia commented 6 years ago

it would be good to test everything you have with the that option type.

danyj commented 6 years ago

on it

danyj commented 6 years ago

every of my shortocdes is with it, it is the main element ID

ViorelEremia commented 6 years ago

is everything okay? I want to update the plugin. we have dozens of clients who write to us about the issue with zindix

danyj commented 6 years ago

yes was just about to respond , seems everything ok now

amjadr360 commented 6 years ago

Hi guys, I still facing this issue. Now it working fine on WP multisite with Woocommarce but not work on multisite without Woocommerce and not working on single site even with Woocommerce or without Woocommerce. Here is video. https://monosnap.com/file/u2z6vx0Q3hSzqL5JDF33PujJ5WVqac

amjadr360 commented 6 years ago

@danyj is it working fine for you? Did you check without Woocommerce or in the single site?

danyj commented 6 years ago

works fine on my end for now http://take.ms/0eeEs

that is no Woo and single site

amjadr360 commented 6 years ago

Ok I think the issue is I am not using this function fw_ext_page_builder_get_post_content( $pb_id ); to get data. I am using $option_type = fw()->backend->option_type('page-builder'); return str_replace('\\', '\\\\', // WordPress "fixes" the slashes $option_type->json_to_shortcodes( $content['json'] ) ); I can't use fw_ext_page_builder_get_post_content( $pb_id ); becuuse i am calling data from a post meta. @ViorelEremia @alexluncashu how can solve this problem? any quick guid will help full for me.

danyj commented 6 years ago

same thing , we are calling data from post meta also just processing it via fw_ext_page_builder_get_post_content and ID

amjadr360 commented 6 years ago

Thanks, @danyj I think this fw_ext_page_builder_get_post_content is only to call the_post_content data.

I have two page builder one is the default and another I created in post meta. Below in this image, you can see. fw_ext_page_builder_get_post_content Only call date from default page builder i want from second page builder too. How I can solve this problem or should I try a different approach?

image