This topic has 16 replies, 2 voices, and was last updated 8 years by Radu.

  • Author
  • #137078
     jwchameleoncorp
    Participant

    Hello,

    When I try to upload a profile photo, the download shows successful, but there is no photo.

    Here’s a video of what happens: http://somup.com/cDQTDqC5P

    Any suggestions what might be wrong?

    Thanks!

    #137211
     Radu
    Moderator

    Hi,

    If you de-activate all plugins except BuddyPress this continue to happens ?

    If you de-activate child theme this continue to happens ?

    Cheers
    r.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #137761
     jwchameleoncorp
    Participant

    Hi @radu

    The problem was caused by this plugin:

    https://wordpress.org/plugins/rocket-lazy-load/

    Since the plugin helps with other parts of the site (mostly speed and caching) is there a way to exclude the buddypress profile photo script, so that the plugin does not interfere with it?

    Thanks!

    #137961
     Radu
    Moderator

    Try to put this files on exception list :

    wp-content/themes/kleo/assets/js/app.js
    wp-content/themes/kleo/assets/js/app.min.js

    Then purge caches

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #138514
     jwchameleoncorp
    Participant

    Hi @radu

    The plugin does not offer settings, as it simply works in the background.

    However I tried open and edit the plugin by located excepted language in the plugin, but didn’t find anything. The plugin code is below. Hopefully that helps. Thanks for taking a look. 🙂

    ———————————-

    <?php
    defined( ‘ABSPATH’ ) or die( ‘Cheatin\’ uh?’ );

    /*
    Plugin Name: Rocket Lazy Load
    Plugin URI: http://wordpress.org/plugins/rocket-lazy-load/
    Description: The tiny Lazy Load script for WordPress without jQuery or others libraries.
    Version: 1.0.4
    Author: WP Media
    Author URI: http://wp-rocket.me

    Copyright 2015 WP Media

    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, see <http://www.gnu.org/licenses/&gt;.

    */

    /**
    * Add Lazy Load JavaScript in the header
    * No jQuery or other library is required !!
    *
    * @since 1.0
    */
    add_action( ‘wp_head’, ‘rocket_lazyload_script’, PHP_INT_MAX );
    function rocket_lazyload_script() {
    if ( ! apply_filters( ‘do_rocket_lazyload’, true ) ) {
    return;
    }

    echo ‘<script type=”text/javascript”>(function(a,e){function f(){var d=0;if(e.body&&e.body.offsetWidth){d=e.body.offsetHeight}if(e.compatMode==”CSS1Compat”&&e.documentElement&&e.documentElement.offsetWidth){d=e.documentElement.offsetHeight}if(a.innerWidth&&a.innerHeight){d=a.innerHeight}return d}function b(g){var d=ot=0;if(g.offsetParent){do{d+=g.offsetLeft;ot+=g.offsetTop}while(g=g.offsetParent)}return{left:d,top:ot}}function c(){var l=e.querySelectorAll(“[data-lazy-original]”);var j=a.pageYOffset||e.documentElement.scrollTop||e.body.scrollTop;var d=f();for(var k=0;k<l.length;k++){var h=l[k];var g=b(h).top;if(g<(d+j)){h.src=h.getAttribute(“data-lazy-original”);h.removeAttribute(“data-lazy-original”)}}}if(a.addEventListener){a.addEventListener(“DOMContentLoaded”,c,false);a.addEventListener(“scroll”,c,false)}else{a.attachEvent(“onload”,c);a.attachEvent(“onscroll”,c)}})(window,document);</script>’;
    }

    /**
    * Replace Gravatar, thumbnails, images in post content and in widget text by LazyLoad
    *
    * @since 1.0
    */
    add_filter( ‘get_avatar’, ‘rocket_lazyload_images’, PHP_INT_MAX );
    add_filter( ‘the_content’, ‘rocket_lazyload_images’, PHP_INT_MAX );
    add_filter( ‘widget_text’, ‘rocket_lazyload_images’, PHP_INT_MAX );
    add_filter( ‘post_thumbnail_html’, ‘rocket_lazyload_images’, PHP_INT_MAX );
    function rocket_lazyload_images( $html ) {
    // Don’t LazyLoad if the thumbnail is in admin, a feed or a post preview
    if( is_admin() || is_feed() || is_preview() || empty( $html ) ) {
    return $html;
    }

    // You can stop the LalyLoad process with a hook
    if ( ! apply_filters( ‘do_rocket_lazyload’, true ) ) {
    return $html;
    }

    $html = preg_replace_callback( ‘#<img([^>]*) src=(“(?:[^”]+)”|\'(?:[^\’]+)\’|(?:[^ >]+))([^>]*)>#’, ‘__rocket_lazyload_replace_callback’, $html );

    return $html;
    }

    /**
    * Used to check if we have to LazyLoad this or not
    *
    * @since 1.0.1
    */
    function __rocket_lazyload_replace_callback( $matches ) {
    if ( strpos( $matches[1] . $matches[3], ‘data-no-lazy=’ ) === false && strpos( $matches[1] . $matches[3], ‘data-lazy-original=’ ) === false && strpos( $matches[2], ‘/wpcf7_captcha/’ ) === false ) {
    $html = sprintf( ‘<img%1$s src=”data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==” data-lazy-original=%2$s%3$s><noscript><img%1$s src=%2$s%3$s></noscript>’,
    $matches[1], $matches[2], $matches[3] );

    /**
    * Filter the LazyLoad HTML output
    *
    * @since 1.0.2
    *
    * @param array $html Output that will be printed
    */
    $html = apply_filters( ‘rocket_lazyload_html’, $html, true );

    return $html;
    } else {
    return $matches[0];
    }
    }

    /**
    * Replace WordPress smilies by Lazy Load
    *
    * @since 1.0
    */
    remove_filter( ‘the_content’, ‘convert_smilies’ );
    remove_filter( ‘the_excerpt’, ‘convert_smilies’ );
    remove_filter( ‘comment_text’, ‘convert_smilies’ );

    add_filter( ‘the_content’, ‘rocket_convert_smilies’ );
    add_filter( ‘the_excerpt’, ‘rocket_convert_smilies’ );
    add_filter( ‘comment_text’, ‘rocket_convert_smilies’ );

    /**
    * Convert text equivalent of smilies to images.
    *
    * @source convert_smilies() in /wp-includes/formattings.php
    * @since 1.0
    */
    function rocket_convert_smilies( $text ) {

    global $wp_smiliessearch;
    $output = ”;

    if ( get_option( ‘use_smilies’ ) && ! empty( $wp_smiliessearch ) ) {
    // HTML loop taken from texturize function, could possible be consolidated
    $textarr = preg_split( ‘/(<.*>)/U’, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); // capture the tags as well as in between
    $stop = count( $textarr );// loop stuff

    // Ignore proessing of specific tags
    $tags_to_ignore = ‘code|pre|style|script|textarea’;
    $ignore_block_element = ”;

    for ( $i = 0; $i < $stop; $i++ ) {
    $content = $textarr[ $i ];

    // If we’re in an ignore block, wait until we find its closing tag
    if ( ” == $ignore_block_element && preg_match( ‘/^<(‘ . $tags_to_ignore . ‘)>/’, $content, $matches ) ) {
    $ignore_block_element = $matches[1];
    }

    // If it’s not a tag and not in ignore block
    if ( ” == $ignore_block_element && strlen( $content ) > 0 && ‘<‘ != $content[0] ) {
    $content = preg_replace_callback( $wp_smiliessearch, ‘rocket_translate_smiley’, $content );
    }

    // did we exit ignore block
    if ( ” != $ignore_block_element && ‘</’ . $ignore_block_element . ‘>’ == $content ) {
    $ignore_block_element = ”;
    }

    $output .= $content;
    }
    } else {
    // return default text.
    $output = $text;
    }
    return $output;
    }

    /**
    * Convert one smiley code to the icon graphic file equivalent.
    *
    * @source translate_smiley() in /wp-includes/formattings.php
    * @since 1.0
    */
    function rocket_translate_smiley( $matches ) {
    global $wpsmiliestrans;

    if ( count( $matches ) == 0 )
    return ”;

    $smiley = trim( reset( $matches ) );
    $img = $wpsmiliestrans[ $smiley ];

    $matches = array();
    $ext = preg_match( ‘/\.([^.]+)$/’, $img, $matches ) ? strtolower( $matches[1] ) : false;
    $image_exts = array( ‘jpg’, ‘jpeg’, ‘jpe’, ‘gif’, ‘png’ );

    // Don’t convert smilies that aren’t images – they’re probably emoji.
    if ( ! in_array( $ext, $image_exts ) ) {
    return $img;
    }

    /**
    * Filter the Smiley image URL before it’s used in the image element.
    *
    * @since WP 2.9.0
    *
    * @param string $smiley_url URL for the smiley image.
    * @param string $img Filename for the smiley image.
    * @param string $site_url Site URL, as returned by site_url().
    */
    $src_url = apply_filters( ‘smilies_src’, includes_url( “images/smilies/$img” ), $img, site_url() );

    // Don’t lazy-load if process is stopped with a hook
    if ( apply_filters( ‘do_rocket_lazyload’, true ) ) {
    return sprintf( ‘ %s ‘, esc_url( $src_url ), esc_attr( $smiley ) );
    } else {
    return sprintf( ‘ %s ‘, esc_url( $src_url ), esc_attr( $smiley ) );
    }

    }

    #138616
     Radu
    Moderator

    I see, do you have tried to ask the plugin author if it’s q quick way to add exception files?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #139722
     jwchameleoncorp
    Participant

    No, I haven’t seen a way to contact them for that sort of support.

    #139724
     jwchameleoncorp
    Participant

    Hi @radu

    I checked the WP help forum for this plugin, and 3 days ago a gentlemen posted he had the same trouble. He offered this code as a solution:

    ***************

    add_filter(‘do_rocket_lazyload’, ‘disable_lazyload_own_profile’);
    function disable_lazyload_own_profile()
    {
    if (bp_is_my_profile()) {
    return false;
    }

    return true;
    }

    ****************

    You can find his post here: https://wordpress.org/support/topic/buddypress-compatibility-fix/

    However, he does not mention where to place the code. Do you have a suggestion where the code would go?

    Thanks!

    #139935
     Radu
    Moderator

    This code can be pasted on wp-content/themes/kleo-child/functions.php

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #140169
     jwchameleoncorp
    Participant

    Hi @radu

    Placed the code in the location you suggested, but no luck.

    Also contacted the gentleman who wrote the code…waiting for a reply.

    Any ideas?

    Thanks!

    #140328
     Radu
    Moderator

    Ok try to run the function from bp-custom file

    So go to /wp-content/plugins/ look for bp-custom.php and paste in it, if there is no file create it

    COPY CODE
    
    First, bp-custom.php runs from the /wp-content/plugins/ folder and is therefore independent from your theme. This is useful for adding code snippets that are BuddyPress-specific. Also, this code will always load regardless of what theme you are using.
    

    https://codex.buddypress.org/themes/bp-custom-php/

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #140407
     jwchameleoncorp
    Participant

    Hi @radu

    Okay, I tried it, but no luck. See the attached snapshots (webpage results and .php file I created w/ code)

    Pretty sure I did what you suggested. Do you see a mistake?

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #140519
     Radu
    Moderator

    Hi,

    I found this http://docs.wp-rocket.me/article/16-disabling-lazyload-on-specific-posts

    And you can try with this function

    COPY CODE
    
    add_filter( 'wp', '__deactivate_rocket_lazyload_if_page' );
    function __deactivate_rocket_lazyload_if_page() {
    	if( bp_current_component() ) {
    		add_filter( 'do_rocket_lazyload', '__return_false' );
    	}
    }
    

    Let me know

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution
    #141021
     jwchameleoncorp
    Participant

    Thanks for checking that out @radu

    Where should I put the code? In bp-custom.php?

    #141141
     Radu
    Moderator

    You can put that code in child theme functions.php wp-content/themes/kleo-child/functions.php

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution
    #141318
     jwchameleoncorp
    Participant

    Hi @radu

    That did the trick! You’re genius!

    Thanks again for all your help.

    Really really appreciate all you do!

    #141454
     Radu
    Moderator

    You’re welcome

    I appreciate you too if you appreciate our work!

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 17 posts - 1 through 17 (of 17 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?