Creating new pages/tabs on groups/profile page – this isn't working! :(
-
Hi there.
This is the code I’m using:
<?php /* Plugin Name: Groups Links Description: Add links to the groups page. Author: Thomas Clayson */ function add_groups_links_page(){ global $bp; $groups_link = $bp->root_domain . '/' . $bp->groups->slug . '/' . $bp->groups->current_group->slug . '/'; bp_core_new_subnav_item( array( 'name' => 'Links', 'slug' => 'links', 'parent_url' => $groups_link, 'parent_slug' => $bp->groups->slug, 'screen_function' => 'group_links_function_to_show_screen', 'position' => 35, 'user_has_access' => $bp->groups->current_group->user_has_access, 'item_css_id' => 'group-links' ) ); } add_action( 'wp', 'add_groups_links_page'); function group_links_function_to_show_screen() { add_action( 'bp_template_title', 'group_links_function_to_show_screen_title' ); add_action( 'bp_template_content', 'group_links_function_to_show_screen_content' ); $templates = array('groups/single/plugins.php','plugin-template.php'); if( strstr( locate_template($templates), 'groups/single/plugins.php' ) ) { bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'groups/single/plugins' ) ); } else { bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'plugin-template' ) ); } } function group_links_function_to_show_screen_title() { echo 'Links'; } function group_links_function_to_show_screen_content() { echo "Rawr"; } ?>
but it’s not working! The tab comes up on the groups page (Links), but when you click it (even though it links to …/groups/the-group-slug/links) properly, as it should, the content dosen’t come up, and instead it redirects to the homepage!
What am I doing wrong?! The group-documents plugin is working properly, and I’ve been trying to copy that code as much as possible as well as anything I could find on the internet. As far as I can see I haven’t done anything wrong….
Thanks for any help you can give me.
- The topic ‘Creating new pages/tabs on groups/profile page – this isn't working! :(’ is closed to new replies.