Getting “Page Not Found” When Attempting To Create A Top Level Page via Plugin
-
Howdy all. I’m attempting to write a plugin that adds a main level (next to members or blogs or groups) navigation tab. I managed to get the page not to redirect to the homepage and the tab shows up active on the page, but getting a “Page Not Found” in the content area.
I’ve reviewed this thread and others similar like it:
http://buddypress.org/community/groups/how-to-and-troubleshooting/forum/topic/writing-a-new-plugin-get-404-not-found-when-accessing-screen/But still stuck. I know how to add submenus to profiles and groups, etc. But this particular thing i’m working on has me stumped. Even looked at @DJPaul‘s achievement plugin for hints.
I have checked and I see my ‘cinvite’ in root_components and active_components when I do a print_r of $bp. I do have a index.php file in the /wp-content/plugins/bp-community-invite/includes/templates/ folder as well.Here are the trimmed down files:
/wp-content/plugins/bp-community-invite/loader.php
// You can override these in wp-config.php.
if ( !defined( ‘COMMUNITY_INVITE_SLUG’ ) )
define ( ‘COMMUNITY_INVITE_SLUG’, __( ‘cinvite’, ‘cinvite’ ) );function bpci_init() {
require( dirname( __FILE__ ) . ‘/includes/bp-community-invite-core.php’ );
do_action( ‘bpci_init’ );
}
add_action( ‘bp_include’, ‘bpci_init’ );
/wp-content/plugins/bp-community-invite/includes/bp-community-invite-core.php
function bpci_setup_globals() {
global $bp;
$bp->cinvite->id = ‘cinvite’;
$bp->cinvite->slug = COMMUNITY_INVITE_SLUG;
$bp->active_components[$bp->cinvite->slug] = $bp->cinvite->id;
}
add_action( ‘bp_setup_globals’, ‘bpci_setup_globals’ );function bpci_setup_root_component() {
bp_core_add_root_component( COMMUNITY_INVITE_SLUG );
}
add_action( ‘bp_setup_root_components’, ‘bpci_setup_root_component’ );function bpci_setup_nav() {
global $bp;
// Add ‘Achievements’ to the main navigation
bp_core_new_nav_item( array( ‘name’ => sprintf( __( ‘Invites (%s)‘, ‘cinvite’ ), ‘XXX’ ), ‘slug’ => $bp->cinvite->slug, ‘position’ => 80, ‘screen_function’ => ‘bpci_screen_waiting_list’, ‘default_subnav_slug’ => ”, ‘item_css_id’ => $bp->cinvite->id ) );}
add_action( ‘bp_setup_nav’, ‘bpci_setup_nav’ );function bpci_add_to_site_nav() {
global $bp;
?>
<licinvite->slug ) ) : ?> class=”selected”>
<a href="/cinvite->slug ?>/”><?php
}
add_action( ‘bp_nav_items’, ‘bpci_add_to_site_nav’ );function bpci_setup_nav_directory() {
global $bp, $is_member_page;if ( $bp->current_component == $bp->cinvite->slug ) {
// $bp->is_directory = true;
do_action( ‘bpci_setup_nav_directory’ );
bp_core_load_template( apply_filters( ‘bpci_template_directory’, ‘index’ ) );
return;
}
}
add_action( ‘wp’, ‘bpci_setup_nav_directory’, 2 );
I think i might be getting confused regarding screen functions. I did try to add the following code so that I have a function that matched the screen function i was referring to to bp_core_new_nav item:function bpci_screen_waiting_list() {
do_action( ‘bpci_screen_waiting_list’ );
bp_core_load_template( apply_filters( ‘bpci_template_directory’, ‘index’ ) );
}But that did nothing.
Open to suggestion. I bow before the mighty BuddyPress overlords on this one.
- The topic ‘Getting “Page Not Found” When Attempting To Create A Top Level Page via Plugin’ is closed to new replies.