Skip to:
Content
Pages
Categories
Search
Top
Bottom

Code visible on ‘change cover photo’ tab?


  • kodacollider
    Participant

    @kodacollider

    So after uploading a cover photo, or when viewing the ‘change cover photo’ tab of a users profile, the bottom portion of the page looks like this:

    This is the stock template file as far as I know. Any idea what’s going on here?

    Thanks.

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

  • kodacollider
    Participant

    @kodacollider

    Trying to take a look at the template file. Found it at: /wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/assets/_attachments/cover-images/index.php

    In that file, I see the code:

    <script id="tmpl-bp-cover-image-delete" type="text/html">
    	<# if ( 'user' === data.object ) { #>
    		<p><?php _e( "If you'd like to delete your current cover image but not upload a new one, please use the delete Cover Image button.", 'buddypress' ); ?></p>
    		<p><a class="button edit" id="bp-delete-cover-image" href="#"><?php esc_html_e( 'Delete My Cover Image', 'buddypress' ); ?></a></p>
    	<# } else if ( 'group' === data.object ) { #>
    		<p><?php _e( "If you'd like to remove the existing group cover image but not upload a new one, please use the delete group cover image button.", 'buddypress' ); ?></p>
    		<p><a class="button edit" id="bp-delete-cover-image" href="#"><?php esc_html_e( 'Delete Group Cover Image', 'buddypress' ); ?></a></p>
    	<# } else { #>
    		<?php do_action( 'bp_attachments_cover_image_delete_template' ); ?>
    	<# } #>
    </script>

    However, on my site itself, the source comes out missing the script tag, and the angle brackets are in the form of lt; gt; etc.

    Any ideas? Could use some help on this.


    shanebp
    Moderator

    @shanebp

    That is used by the backbone – javascript library which is included with WordPress.
    Perhaps something, maybe your theme, is preventing it from being loaded.
    Try switching to a WP theme like 2015.


    kodacollider
    Participant

    @kodacollider

    Thanks for the information. I’m using a child theme of Twenty Sixteen. Looking at the source of the page, I see:

    /wp-includes/js/backbone.min.js?ver=1.2.3
    /wp-includes/js/wp-backbone.min.js?ver=4.7.2

    Both being loaded. I don’t see any errors in my console either. Any ideas?


    kodacollider
    Participant

    @kodacollider

    I could really use a hand figuring this out, I can’t do much with my site while it’s printing out scripts as plaintext. This is the only page/component I’ve seen this issue on, and I’ve tried fiddling with the placement of my js files quite a bit to no avail.

    Could someone perhaps give me a bit more insight into what files are actually at work here so that I can narrow my focus a bit as I attempt to troubleshoot?

    Thank you.


    mrjarbenne
    Participant

    @mrjarbenne

    Did you attempt to view your site using one of the default themes? I recognize you mentioned you are using a child theme of a default, but a child theme can contain code that may disrupt functionality. That will at least narrow your scope to the theme, or a rogue plugin causing issues.


    kodacollider
    Participant

    @kodacollider

    Thanks for taking the time to check in — yes, I’ve tested it with a default theme and the problem isn’t there. So it’s something in my child theme, though I’m really not sure what.

    ‘Backbone’ is a bit vague to me, but I do see both of the scripts mentioned above being loaded. I’ve played a bit with the ordering of these and haven’t seen a difference, but it may have something to do with that. I’m just not sure how to tell. Like I mentioned, my console is clean when I load the page.


    kodacollider
    Participant

    @kodacollider

    Wow, I just found the culprit.

    It was this code in my child theme’s functions.php file that was intended to remove empty HTML tags:

    add_filter('the_content', 'remove_empty_tags_recursive', 20, 1);
    function remove_empty_tags_recursive ($str, $repto = NULL) {
            $str = force_balance_tags($str);
            if (!is_string ($str) || trim ($str) == '')
            return $str;
            return preg_replace (
                  '~\s?<p>(\s|&nbsp;)+</p>\s?~',
                 !is_string ($repto) ? '' : $repto,
               $str
            );
    }

    mrjarbenne
    Participant

    @mrjarbenne

    Cool. Glad it’s working for you now.

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Skip to toolbar