Skip to:

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

  • fishbowl81


    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?




    * 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’ ) )



    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:

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

    Thanks for any feedback


Viewing 1 replies (of 1 total)

  • fishbowl81


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


    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: NOT */

    define( ‘BP_CORE_ROOT_COMPONENTS’, ‘samples,search,groups,blogs’ . ‘,’ . MEMBERS_SLUG . ‘,’ . REGISTER_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,


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