• Resolved Rogyw

    (@turtleline)


    Hi, It looks like Events Manager is stripping all page_content for a buddypress group-page and wrapping the resulting empty page_content with the <div id="em-wrapper">.

    My test system:
    WordPress 4.7.1
    Events Manager version 5.6.6.1
    BuddyPress Groups Extra Version 3.6.9.1
    BuddyPress 2.7.4
    plus various other plugins

    Here is the html output of a group-sub page:

    
    <div role="navigation" id="subnav" class="item-list-tabs no-ajax">
    	<ul>
    		<li>
                    <a href="/groups/mygroupname/gpages/group-info">Group Info</a>
                </li><li class="current">
                    <a href="/groups/mygroupname/gpages/group-news">Group News</a>
                </li>	</ul>
    </div>
    <div class="gpage">
    
    	<div id="em-wrapper"></div>
    	<div class="edit_link">
                    <a target="_blank" title="Edit link for group admins only" href="/groups/mygroupname/admin/extras/pages-manage/?edit=40408">[Edit]</a>
                </div>
    </div>
    

    em-events.php line 123.

    I think it looks like a conflict with “Events Manager” consuming the page_content for posts that have content. The function em_content($page_content) is generating the <div id="em-wrapper"></div> , which is meant to be wrapping the page content if its an event. It’s taking in the page_content “BuddyPress Groups Extra” is attempting to output to the page and stripping it completely.

    Link to BuddyPress Groups Extras Support Thread for this issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • +1

    Thread Starter Rogyw

    (@turtleline)

    I did some debugging to check the values em-manager is receiving in
    wp-content/plugins/events-manager/em-events.php

    
    print_r($post);
    print_r(array($events_page_id,
        $locations_page_id,
        $categories_page_id,
        $edit_bookings_page_id,
        $edit_events_page_id,
        $edit_locations_page_id,
        $my_bookings_page_id,
        $tags_page_id));
    
    $content = apply_filters('em_content_pre', '', $page_content);
    print_r($page_content);
    print_r($content);
    

    and the output is as follows:

     
    WP_Post Object
    (
        [ID] => 0
        [post_author] => 0
        [post_date] => 0
        [post_date_gmt] => 0
        [post_content] => 
        [post_title] => 
        [post_excerpt] => 
        [post_status] => publish
        [comment_status] => closed
        [ping_status] => 
        [post_password] => 
        [post_name] => 
        [to_ping] => 
        [pinged] => 
        [post_modified] => 0
        [post_modified_gmt] => 0
        [post_content_filtered] => 
        [post_parent] => 0
        [guid] => 
        [menu_order] => 0
        [post_type] => page
        [post_mime_type] => 
        [comment_count] => 0
        [filter] => raw
        [is_404] => 1
        [is_page] => 
        [is_single] => 
        [is_archive] => 
        [is_tax] => 
    )
    
    Array
    (
        [0] => 24
        [1] => 
        [2] => 
        [3] => 
        [4] => 321
        [5] => 
        [6] => 
        [7] => 
    )
    
    $page_content = <h1>This is the group info page.</h1>
    $content =
    

    The change I suggest as a possible solution is an additional check for $post->ID being 0 i.e. changing line 13 of events-manager/em-events.php to:

    
    if( empty($post) || empty($post->ID) ) return $page_content; //fix for any other plugins calling the_content outside the loop
    

    It resolves the issue for me – but does anyone know if there are any cases this change will cause other problems?
    Thanks.

    • This reply was modified 7 years, 3 months ago by Rogyw.

    Sorry for the delay in getting back to you. I’ve passed this on to the Dev team for their feedback.

    +1

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    @turtleline – thanks for debugging this and providing a solution.

    I’ve seen reports of this error a couple times over the years but was never able to reproduce it locally, and I guess I now know why; You have one or more EM pages that aren’t assigned, whereas I never did.

    I now have managed to reproduce finally, and it’s pretty clear now. The fix you proposed is correct and I don’t see it causing any side-effects, so it’ll go into the next update.

    Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conflict with BuddyPress Groups Extras – em_content() removing $page_content’ is closed to new replies.