Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

Support: Creating & Extending

Existing and new plugins/components and themes.

Adding Component to Groups Tab results in 404 (2 posts)

Started 6 months, 2 weeks ago by: bludragon

  • Profile picture of bludragon bludragon said 6 months, 2 weeks ago:

    I have created a custom component using the latest skeleton framework that needs to have its URLs as part of the current group. I have accomplished this is in my component’s setup_nav() function, but when I try to access the URL I get a 404 error. I have been trying to solve this issue for the last couple of day with no luck. Could someone kindly point me in the right direction?

    Here is my component’s setup_nav method:

    function setup_nav()
    {
            $link = trailingslashit(bp_get_root_domain().'/'.bp_get_groups_root_slug().'/'.bp_get_current_group_slug().'/'.bp_get_announcements_slug());
            $slug = bp_get_announcements_slug();
    
            $main_nav = array('name'                => __('Announcements', 'bp-announcements'),
                              'slug'                => bp_get_current_group_slug(),
                              'position'            => -1,
                              'screen_function'     => 'bp_announcements_screen_list',
                              'default_subnav_slug' => 'all');
            $sub_nav[] = array('name'            =>  __('All Announcements', 'bp-announcements'),
                               'slug'            => 'all',
                               'parent_url'      => $link,
                               'parent_slug'     => bp_get_current_group_slug(),
                               'screen_function' => 'bp_announcements_screen_list',
                               'position'        => 10);
    }
  • Profile picture of bludragon bludragon said 6 months, 2 weeks ago:

    I think I’ve figured out the issue. Even though my screens.php file is listed in my includes method, for some reason the function “bp_announcements_screen_list” does not work (perhaps it isn’t being loaded?) If I change the value to a method in the component class ('screen_function' => aray(&$this,' bp_announcements_screen_list')), I can echo a string and have it show up on the 404 page (at least I get one – before I got nothing). Now I just need to figure out where to go from here.

    Edit: I figured out what was wrong with my screens.php – I had to copy my template files over to my current theme.