Skip to:
Content
Pages
Categories
Search
Top
Bottom

Cannot Upload Image if BuddyPress plugin is activated.


  • jowyds
    Participant

    @jowyds

    Hello guys, recently I came across an issue of failing to upload media (image) to my wordpress site. I came across other forums:

    error occurred in the upload, please try again

    I have tried to disable my plugin 1 by 1 (as per the forum recommendation) and found out that BuddyPress is culprit. I have no idea on where I can troubleshoot this. Is there any help on this?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Haven’t seen this before. Is there anything in your PHP error logs? Your host may be able to help you get this data.


    jowyds
    Participant

    @jowyds

    I believe it was not php error. Rather than the wordpress itself. The chunking still goes on and on. I checked the directory image was uploaded. But wordpress just give the error. Perhaps I need to reinstall and try again.


    jowyds
    Participant

    @jowyds

    Hello guys, I am running with Ampps locally before I try to have my website upload in the actual server. I have recently find out that BuddyPress is the culprit. It only happens if BuddyPress is activated.

    Screenshot

    You can see the beside animation keeps going round and round and never really stop. How can this be solved?

    I am using latest WordPress 4.6.1 and also latest buddypress 2.6.2


    danbp
    Participant

    @danbp

    Hi,

    the screenshot is empty. But no importance as it doesn’t help anyway.

    You’re on a local install and it depends of many parameters if you have an issue.
    Could be the browser or some settings in your local server, a missing php library, some JS conflict and so on… Really difficult to diagnose from here.

    Uploading media has two options: by drag n drop or file selection on your hard drive.
    Which one is not working ?


    jowyds
    Participant

    @jowyds

    Good day dan, thanks for your reply.

    It doesn’t work for both whereas I am trying to browse and upload and also drag and drop.
    Actually when I goes to my library, I can’t even display the items that I have uploaded. It is just keep on loading and loading.


    jowyds
    Participant

    @jowyds

    Sorry for double posting. It seems that list view is fine. Only grid view keep loading on and on. Even there is error displayed, I can still see my files uploaded successfully.


    danbp
    Participant

    @danbp

    Which error message do you see ?


    jowyds
    Participant

    @jowyds

    Hello Dan,

    The error is: “error occurred in the upload, please try again”. I cannot check from media library if the file is there. However, when I go to wp-content I can see the file is already being transferred to the folder. It is very weird.

    I have seeing other people having the issue, but not just from BuddyPress.
    https://wordpress.org/support/topic/media-library-cannot-display-images/

    I have tried but no luck. It seems mine is stucked with buddypress. I have cleared all my plugins and even only just installed and activate buddypress. I am not sure why this happens.

    I haven’t try to deactivate “loginizer” and also “akismet” as they seems to come with the default wp installation. Moreover, it happens when I activate the buddypress. I am also running on default wordpress 2016 theme just to test things out.


    danbp
    Participant

    @danbp

    Loginizer is a third party plugin, it is not part of WordPress.

    Afaik you have to check WordPress alone as very first debug step.
    Rename the complete plugin folder (this will deactivate all plugins) and test WP with a twenty theme.
    Keep also define('WP_DEBUG', true); in wp-config while testing.


    jowyds
    Participant

    @jowyds

    hello danbp, thanks for your reply.

    I have tried the suggestion to use define('WP_DEBUG', true); in conjuction with define('WP_DEBUG_LOG', true); with a twenty theme. It works fine when buddypress is not activated. No error or logfile whatsover. Then after I tried to activate buddypress, and test again. The media library still cannot load out. I have tried to check for error log and I can’t seems to find any.

    Nevertheless I found the culprit can be my bp-custom.php in which I put it just under /wp-content/plugins/[here]

    if I remove the file and everything seems works fine again with buddypress activated.

    This is the content for my bp-custom.php

    
    <?php
    // hacks and mods will go here
    
    /**
     * Make a site Private, works with/Without BuddyPress
     * 
     * @author sbrajesh
     * @global string $pagenow
     * 
     */
     
     /*
    function buddydev_private_site() {
        
        //first exclude the wp-login.php
        //register
        //activate
        global $pagenow;
        
        //do not restrict logged in users
        if( is_user_logged_in() ) {
            return ;
        }
        //if we are here, the user is not logged in, so let us check for exclusion
        //we selectively exclude pages from the list
        
        //are we on login page?
        if( $pagenow == 'wp-login.php' ) {
            return ;
        }
        
        //let us exclude the home page
        if( is_front_page() ) {
            return ;
        }
        
        $exclude_pages = array( 'register', 'activate', 'excelportfolio' );//add the slugs here
        
        //is it one of the excluded pages, if yes, we just return and don't care
        if( is_page( $exclude_pages ) ) {
            return ;
        }
        
        $redirect_url = wp_login_url( site_url('/') );//get login url,
        
        wp_safe_redirect( $redirect_url );
        exit( 0 );
    }
    
    */
     
    //add_action( 'template_redirect', 'buddydev_private_site', 0 );
    
    ?>
    
    <style type="text/css">
    
    #wp-admin-bar-bp-login {
    	display:none; /* JOWY: hide login link for buddypress. */
    }
    
    #wp-admin-bar-bp-register {
    	display:none; /* JOWY: hide register link for buddypress. */
    }
    
    #adminloginform {
    	color: #ffffff; /* JOWY: text color on form. */
    }
    
    #wpadminbar {
    	opacity: 0.7; /* JOWY: Opacity for wpadminbar. */
    }
    
    </style>
    

    what can possible went wrong?


    danbp
    Participant

    @danbp

    I’m unable to reproduce your issue on a single install with over 20 plugins active and plenty of custom functions active in bp-custom.php
    I can upload medias without problem with different 3th party themes or Twenty’s

    Try to upload a fresh copy of WordPress and BP and see if it makes a difference.

    Now about the snippet.
    It works more or less, no code error. You commented the action, so it is deactivated if someone copy/paste it without correcting this.

    That said, what is the reason behind using a redirection to login if the site, or at least the buddyPress parts, should be private ?

    Wouldn’t it be more logic to redirect visitors to an anonymous page with some important information, from which the first one could be Sorry, but this site is private ? Followed by some informations how to register or pay a fee or whatever the reason.

    A private site has two type of visitors: those invited to join and the others. Don’t give the opportunity to those who are there by chance to enter the site so easily.

    I let you think about this and eventually create an appropriate page and template.
    Here a code example redirecting to a page called Intranet and the correct calls to slugs for all components (including bbPress).

    function bpfr_guest_redirect() {
    global $bp;
    // enter the slug or component conditional here
    	if ( bp_is_activity_component() || bp_is_groups_component() || bp_is_blogs_component() || bp_is_page( BP_MEMBERS_SLUG ) || is_bbpress() ) {
    	
    // not logged in user are redirected to - comment/uncomment or add/remove to your need
    		if( !is_user_logged_in() ) { 
    			//wp_redirect( get_option('siteurl') ); //back to homepage
    			//wp_redirect( get_option('siteurl') . '/register' ); // back to register page	
    			wp_redirect( get_option('siteurl') . '/intranet' ); // back to whatever page
    		} 
    	}
    }
    add_filter( 'get_header', 'bpfr_guest_redirect', 1 );

    Add it to child-theme’s functions.php


    danbp
    Participant

    @danbp

    Forgot to mention that for a complete privacy, you may also lock access to the rss feeds !

    As all this was already handled in a past topic, see here how to do that.

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