• Hello everybody,

    i am new in plugin development and i cant find the solution for the following problem:

    I am working on a plugin for buddypress. After including a php file via include() into the main plugin file i am getting the status critical error at the frontend.

    The php file contains html and php functions. The content inside the php file should be displayd after a certain element is clicked.

    The code of the main plugin file looks like this:

    <?php
    /*
    Plugin Name: CGTpushGroup
    
    */
    
    include_once(plugin_dir_path( __FILE__ ) . 'CGTgroups.php' );
    
    add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );
    
    function my_plugin_assets() {
        wp_enqueue_style( 'CGTstyle', plugins_url( '/public/CGTOverlaygroups.css' , __FILE__ ), null, null, true);
        wp_enqueue_script( 'postGroup', plugins_url( '/public/CGTpostGroupActivityStream.js' , __FILE__ ), null, null, true);
        wp_enqueue_script( 'sessionStorage', plugins_url( '/public/CGTsessionStorageRecipe.js' , __FILE__ ), null, null, true);
        wp_enqueue_script( 'clickOverlay', plugins_url( '/public/CGTclickOverlay.js' , __FILE__ ), null, null, true);
    }
    
    ?>

    And the code / markup in the including php file looks like this:

    <?php
    <div id="CGToverlay">
        <div id="text">
            <?php if ( bp_has_groups('user_id=true') ) : ?>
                <ul id="groups-list" class="item-list">
                    <?php while ( bp_groups() ) : bp_the_group(); ?>
    
                        <li>
                            <div class="item-avatar">
                                <a href="<?php bp_group_permalink() ?>"><?php bp_group_avatar( 'type=thumb&width=50&height=50' ) ?></a>
                            </div>
    
                            <div class="item recipeclick" style="border:1px solid #CCC; background: green;">
                                <div class="item-title"><a href="<?php bp_group_permalink() ?>"><?php bp_group_name() ?></a></div>
    
                                <div class="item-desc"><?php bp_group_description_excerpt() ?></div>
    
                                <?php do_action( 'bp_directory_groups_item' ) ?>
                            </div>
    
                            <div class="clear"></div>
                        </li>
    
                    <?php endwhile; ?>
                </ul>
    
                <?php do_action( 'bp_after_groups_loop' ) ?>
    
            <?php else: ?>
    
                <div id="message" class="info">
                    <p><?php _e( 'There were no groups found.', 'buddypress' ) ?></p>
                </div>
    
            <?php endif; ?>
        </div>
    </div>
    ?>

    I will be very grateful if anybody could help me.

    Best regards
    Thomas

Viewing 1 replies (of 1 total)
  • Dion

    (@diondesigns)

    Your second PHP file contains numerous (very basic) errors. You have extraneous <?php and ?> tags, and you are missing semicolons in most of the PHP statements.

Viewing 1 replies (of 1 total)
  • The topic ‘Critical Error after Including php File into Plugin Main File’ is closed to new replies.