Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom Directory Pages? Why isn’t this code working?

  • @fishbowl81

    Participant

    I’m in the process of building a collection of plugins for my site, and want to replicate the directories as seen in blogs and groups for my custom content.

    After carefully reviewing the code, I found the file bp-groups-directory-groups.php, and used it as a outline to build this sample file. the file doesn’t load correctly, it shows “The page you were looking for was not found. ” and “Sorry, that page was not found”. Here is my php code, hopefully it will post ok into the forum. I understand this a minimal example, but it should work? What am I missing?

    /wp-content/mu-plugins/bp-sample.php

    <?php

    /*

    * Created on Jan 13, 2009

    *

    * Project Buddypress Addons

    *

    * File bp-sample.php

    *

    */

    function samples_directory_samples_setup() {

    global $bp, $current_blog;

    $bp = array( ‘slug’ => ‘samples’ );

    if ( $bp == $bp && $bp == ” ) {

    add_action( ‘bp_template_content’, ‘samples_directory_samples_content’ );

    add_action( ‘bp_template_sidebar’, ‘samples_directory_samples_sidebar’ );

    if ( file_exists( TEMPLATEPATH . ‘/plugin-template.php’ ) )

    bp_catch_uri(‘plugin-template’);

    else

    wp_die( __( ‘To enable the sample directory you must drop the “plugin-template.php” file into your theme directory.’, ‘buddypress’ ) );

    }

    }

    add_action( ‘wp’, ‘samples_directory_samples_setup’, 5 );

    function samples_directory_samples_content() {

    echo “sample content”;

    }

    function samples_directory_samples_sidebar() {

    echo “sample sidebar”;

    }

    ?>

    If I edit bp-groups-directory-groups.php, and change it to this:

    add_action( ‘bp_template_content’, ‘gifts_directory_gifts_content’ );

    add_action( ‘bp_template_sidebar’, ‘gifts_directory_gifts_sidebar’ );

    You can see the results here:

    http://gorgeousgamers.com/beta/groups

    Now it shows the gifts, and not the groups. What is different, that my sample isn’t working? Any suggestions?

    Thanks for any feedback

    Brad

    http://www.gorgeousgamers.com/beta/

Viewing 1 replies (of 1 total)
  • @fishbowl81

    Participant

    After a few more hours of head banging, I have figured it out.

    bp-core.php

    starting at line: 18

    /* These components are accessed via the root, and not under a blog name or member home.

    e.g Groups is accessed via: http://domain.com/groups/group-name NOT http://domain.com/andy/groups/group-name */

    define( ‘BP_CORE_ROOT_COMPONENTS’, ‘samples,search,groups,blogs’ . ‘,’ . MEMBERS_SLUG . ‘,’ . REGISTER_SLUG . ‘,’ .

    ACTIVATION_SLUG . ‘,’ . NEWS_SLUG );

    by adding in samples to the list, it made all the difference.

    Thank you Andy for the good job commenting, without your quality code we would all be lost.

    Good Luck All,

    Brad

    http://gorgeousgamers.com/beta/

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Directory Pages? Why isn’t this code working?’ is closed to new replies.
Skip to toolbar