Skip to:
Content
Pages
Categories
Search
Top
Bottom

Problem with Members/Single/Plugins Template

  • Avatar of thecutter
    thecutter
    Participant

    @thecutter

    Hi,

    I just started developing a buddypress component using:

    https://github.com/boonebgorges/buddypress-skeleton-component

    But I have a problem with showing the example screens inside the user profile.
    It keeps searching for the template in the plugin directory:
    Warning: require_once([...]\wp-content\plugins\buddypress-skeleton-component-master/includes/templates/members/single/plugins.php): failed to open stream: No such file or directory in [...]\wp-includes\template.php on line 441

    If I click on the new settings tab added by the example component it works and the correct template from buddypress\bp-templates\bp-legacy\buddypress\members\single is used!?

    What is wrong with it?

    THX!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Avatar of @modemlooper
    @modemlooper
    Moderator

    @modemlooper

    The skeleton component is just an example and can be outdated at times. It’s not something you take and then edit to create a new component. From what you posted it would be hard to tell what is wrong.

    Did the skeleton plugin work when you first activated it?

    Avatar of natb19
    natb19
    Participant

    @natb19

    This seems to be a problem with how the skeleton component setup is handling the loading of screens:

    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );
    

    tries to load a template file within the plugin folder – not (as I think it’s meant to) from the standard BP template folder, or the current themes’ buddypress template (if overridden).

    @modemlooper, any idea how to get the screen page to display in the standard wordpress/buddypress template system, or why it’s not working?

    It’s not something you take and then edit to create a new component.

    It certainly reads like something you take and edit to create a new component!

    Avatar of natb19
    natb19
    Participant

    @natb19

    Ok, so it’s pretty easy if you’re not familiar to buddypress (as I am) to make bad assumptions here. (as I am, and did)

    @thecutter

    Your first problem is that in the example, the code is looking for a screen template (plugins.php) in this case that’s not in your template directory. It won’t look for or use any templates in the standard buddypress templates folder (as I assumed) and so you will need to make sure that any templates needed are within the [plugin]templates/[pathtotemplate] path.

    I also assumed that any of these pages would automatically assume the standard buddypress layout and page template, using the supplied template as the content for the page – which was a mistake. What gets served is a vanilla page, using the standard wp header and footer tags (well, if you use the screen-one.php as a template).

    If you want the buddypress profile header add
    <?php locate_template( array( 'buddypress/members/single/member-header.php' ), true ) ?>
    to your template. You can do this for all of the items on your standard bp page, have a look through the other templates in bp as a guide.

    This is not a bad thing, and you can do this stays completely flexible when combined with the standard wp templating. When overriding bp component templates remember to put the [templatepath] file into your theme templates folder, not the theme templates/buddypress folder.

    For example, my ‘Achievements’ summary template (‘achievements/screen-summary’) goes into ‘achievements/screen-summary.php’ in my theme’s template folder.

    Hope this helps, I was confused for a while, but it’s all good now ;)

    Avatar of natb19
    natb19
    Participant

    @natb19

    After playing, I think

    <?php bp_get_template_part( 'members/single/member-header' ); ?>

    maybe better than what I suggested above.

    Avatar of patelsaurabh333
    patelsaurabh333
    Participant

    @patelsaurabh333

    i want to load member-header.php file in certain template file for my customization but it does not load.so help me asap…

    Avatar of patelsaurabh333
    patelsaurabh333
    Participant

    @patelsaurabh333

    how can i load member-header.php file’s code in certain template file and template file is in page-templates folder .is this possible? plz ans me asap

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

You must be logged in to reply to this topic.