SettingsController::index PHP Метод

index() публичный Метод

You can override this method with a method in your plugin named SettingsController_Index_Create. You can hook into it with methods named SettingsController_Index_Before and SettingsController_Index_After.
С версии: 2.0.0
public index ( )
    public function index()
    {
        // Confirm that the user has at least one of the many admin preferences.
        $this->permission(['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage', 'Garden.Moderation.Manage', 'Moderation.ModerationQueue.Manage', 'Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete', 'Garden.Users.Approve'], false);
        // Send the user to the last section they navigated to in the dashboard.
        $section = Gdn::session()->getPreference('DashboardNav.DashboardLandingPage', 'DashboardHome');
        if ($section) {
            $sections = DashboardNavModule::getDashboardNav()->getSectionsInfo();
            $url = val('url', val($section, $sections));
            if ($url) {
                redirect($url);
            }
        }
        // Resolve our default landing page redirection based on permissions.
        if (!Gdn::session()->checkPermission(['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage'], false)) {
            // We don't have permission to see the dashboard/home.
            redirect(DashboardNavModule::getDashboardNav()->getUrlForSection('Moderation'));
        }
        // Still here?
        redirect('dashboard/settings/home');
    }