• Resolved Jon

    (@freshyjon)


    After updating PB SEO Friendly Images to version 4.X.X (from 3.X.X), it causes our Ultimate Member “Member Directory” page to appear broken:

    Our Member Directory page is now looking like: https://i.imgur.com/ogLbPLE.gif

    This is the error in the Dev Console: https://i.imgur.com/oVtL8oS.png

    Uncaught SyntaxError: Unexpected token ‘)’
    at new Function (<anonymous>)
    at Function.v.template (underscore.min.js:1)
    at wp-util.min.js:1
    at Object.success (um-members.min.js?ver=2.1.3:1)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at Object.<anonymous> (wp-util.min.js:1)
    at i (jquery.js:2)
    at Object.fireWith [as resolveWith] (jquery.js:2)
    at x (jquery.js:4)
    v.template @ underscore.min.js:1
    (anonymous) @ wp-util.min.js:1
    success @ um-members.min.js?ver=2.1.3:1
    i @ jquery.js:2
    fireWith @ jquery.js:2
    (anonymous) @ wp-util.min.js:1
    i @ jquery.js:2
    fireWith @ jquery.js:2
    x @ jquery.js:4
    c @ jquery.js:4
    XMLHttpRequest.send (async)
    send @ jquery.js:4
    ajax @ jquery.js:4
    (anonymous) @ wp-util.min.js:1
    a.Deferred @ jquery-migrate.min.js:2
    send @ wp-util.min.js:1
    um_ajax_get_members @ um-members.min.js?ver=2.1.3:1
    (anonymous) @ um-members.min.js?ver=2.1.3:1
    each @ jquery.js:2
    each @ jquery.js:2
    (anonymous) @ um-members.min.js?ver=2.1.3:1
    i @ jquery.js:2
    fireWith @ jquery.js:2
    ready @ jquery.js:2
    J @ jquery.js:2

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author PascalBajorat

    (@pascalbajorat)

    Hey,

    you can simply exclude your page with a filter, change XXX with your Post Id:

    function custom_is_optimization_allowed($val, $data) {
        if($data['post_id'] == 'XXX') { return false; }
        return $val;
    }
    add_filter('is_optimization_allowed', 'custom_is_optimization_allowed', 10, 2);
    Thread Starter Jon

    (@freshyjon)

    Understood, but it would be ideal if this wouldn’t be necessary; as it only happened once we updated your plugin. It would be preferred if we didn’t have to manually exclude certain pages after updating.

    Plugin Author PascalBajorat

    (@pascalbajorat)

    The plugin is using DomDocument a PHP standard library. I think that can’t handle JavaScript Templates for React or Angular inside the HTML.

    Thread Starter Jon

    (@freshyjon)

    This is what Ultimate Member mentioned:

    If the “PB SEO Friendly Images” plugin adds React or Angular code to the pages where our templates are used it may cause an error. The “Ultimate Member” plugin and some of its extensions use default WordPress templates. The React and Angular frameworks must not be used with the WordPress templates because they use similar syntax. Please read the article “Javascript Reference/wp.template” for details.

    • This reply was modified 5 years, 1 month ago by Jon.
    Thread Starter Jon

    (@freshyjon)

    This is another response, after they looked into it more:

    We have investigated the code of the plugin “PB SEO Friendly Images”. The method “optimize_html” in the class “pbsfi_frontend”, which is attached to the hook “the_content” with the priority 9999, changes the page’s content and breaks our functionality.
    This issue can’t be solved from our side. Please ask the “PB SEO Friendly Images” support team for assistance.

    As a temporary solution I recommend you to disable HTML optimization for these pages:

    • Group
    • Members Directory
    • Profile

    The plugin “PB SEO Friendly Images” has the hook ‘is_optimization_allowed’ that allows you to disable HTML optimization for certain pages. See code example below. Add this code snippet to the end of the functions.php file in the active theme directory.

    The code snippet:

    /**
     * Check if content could be optimized
     *
     * @see    /wp-content/plugins/pb-seo-friendly-images/inc/pbsfi_optimizer.php
     *
     * @param  boolean $is_optimization_allowed
     * @param  attay   $data
     * @return boolean
     */
    function my_is_optimization_allowed( $is_optimization_allowed, $data ) {
    
    	// Disable content optimization for the Members page
    	if ( um_is_core_page( 'members' ) ) {
    		$is_optimization_allowed = false;
    	}
    
    	// Disable content optimization for the Profile page
    	if ( um_is_core_page( 'user' ) ) {
    		$is_optimization_allowed = false;
    	}
    
    	// Disable content optimization for the Group page
    	if ( get_post_type() === 'um_groups' ) {
    		$is_optimization_allowed = false;
    	}
    
    	return $is_optimization_allowed;
    }
    if ( defined( 'ultimatemember_version' ) ) {
    	add_filter( 'is_optimization_allowed', 'my_is_optimization_allowed', 20, 2 );
    }
    • This reply was modified 5 years, 1 month ago by Jon.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conflicts with Ultimate Member’ is closed to new replies.