ProfileController::buildProfile PHP Method

buildProfile() public method

Set the page title, add data to page modules, add modules to assets, add tabs to tab menu. $this->User must be defined, or this method will throw an exception.
Since: 2.0.0
public buildProfile ( ) : boolean
return boolean Always true.
    public function buildProfile()
    {
        if (!is_object($this->User)) {
            throw new Exception(t('Cannot build profile information if user is not defined.'));
        }
        $Session = Gdn::session();
        if (strpos($this->CssClass, 'Profile') === false) {
            $this->CssClass .= ' Profile';
        }
        $this->title(Gdn_Format::text($this->User->Name));
        if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) {
            // Javascript needed
            // see note above about jcrop
            $this->addJsFile('jquery.jcrop.min.js');
            $this->addJsFile('profile.js');
            $this->addJsFile('jquery.gardenmorepager.js');
            $this->addJsFile('activity.js');
            // Build activity URL
            $ActivityUrl = 'profile/activity/';
            if ($this->User->UserID != $Session->UserID) {
                $ActivityUrl = userUrl($this->User, '', 'activity');
            }
            // Show activity?
            if (c('Garden.Profile.ShowActivities', true)) {
                $this->addProfileTab(t('Activity'), $ActivityUrl, 'Activity', sprite('SpActivity') . ' ' . t('Activity'));
            }
            // Show notifications?
            if ($this->User->UserID == $Session->UserID) {
                $Notifications = t('Notifications');
                $NotificationsHtml = sprite('SpNotifications') . ' ' . $Notifications;
                $CountNotifications = $Session->User->CountNotifications;
                if (is_numeric($CountNotifications) && $CountNotifications > 0) {
                    $NotificationsHtml .= ' <span class="Aside"><span class="Count">' . $CountNotifications . '</span></span>';
                }
                $this->addProfileTab($Notifications, 'profile/notifications', 'Notifications', $NotificationsHtml);
            }
            // Show invitations?
            if (c('Garden.Registration.Method') == 'Invitation') {
                $this->addProfileTab(t('Invitations'), 'profile/invitations', 'InvitationsLink', sprite('SpInvitations') . ' ' . t('Invitations'));
            }
            $this->fireEvent('AddProfileTabs');
        }
        return true;
    }