@EXT\Route(
"/user/{user}/bulletinPointsDiversWidget/",
name="laurentBulletinPointsDiversWidget"
)

@param User $user
487239
public function bulletinPointsDiversWidgetAction(User $user)
    {
        $pointsDivers = $this->totauxManager->getMoyennePointsDivers($user);

        $params = array('pointsDivers' => $pointsDivers);

        return $this->render('LaurentBulletinBundle::BulletinPointsDiversWidget.html.twig', $params);
    }
38196
public function saveUser(User $user, Request $request)
    {
        $user->fill($request->get('user'))
            ->save();

        Alert::info(__('User was saved.'));

        return back();
    }
382642
private function cleanSettings(User $user)
    {
        foreach ($user->getNotificationSettings() as $userNotificationSetting) {
            $this->objectManager->remove($userNotificationSetting);
        }

        $user->getNotificationSettings()->clear();

        foreach ($user->getSettings() as $userSetting) {
            $this->objectManager->remove($userSetting);
        }

        $user->getSettings()->clear();
    }
1077062
public function grantTo($user): void
    {
        $userModel = config('auth.providers.users.model');

        if (is_int($user) && !$userModel::find($user)) {
            return;
        }

        $this->users()->attach($user);
    }
196368
public function requestNewPassword(User $user)
    {
        $user->setPasswordRequestedAt(new \DateTime());
        $user->resetAuthenticationToken();
        $user->setEmailSent(false);
        $this->save($user);
    }
1336551
public function can_manually_control_post_read_status(stdClass $user) : bool {
        global $CFG;
        return $CFG->forum_usermarksread && isloggedin() && forum_tp_is_tracked($this->get_forum_record(), $user);
    }
440774
public function update(Request $request, User $user)
    {
        $this->authorize('update', $user);
        $this->validate($request, [
            'name'     => 'required|max:255',
        ]);

        $user->update([
            'name' => $request->name,
        ]);

        return redirect()->route('laralum::users.index');
    }
639178
public function updateUser(User $user)
    {
        $request = $user->toJson();
        $this->client->put(sprintf('/v2/user/%s', $user->getId()), $request);
    }
851040
public function markAllAsRead(User $user)
    {
        Notification::where('user_id', $user->id)->update(['read_at' => Carbon::now()]);
    }
1324457
public static function set_user($user): void
	{
		// Sets the history table name
		if ( bbn\str::is_uid($user) ){
			self::$user = $user;
		}
	}
1267897
public function regenerateApiKey(User $user)
    {
        $user->api_key = User::generateApiKey();
        $user->save();

        event(new UserRegeneratedApiTokenEvent($user));

        return cachet_redirect('dashboard.user');
    }
1343125
public function before(
        User $user,
        /** @noinspection PhpUnusedParameterInspection */
        $ability,
        MemberInvitation $memberInvitation)
    {
        return $this->allowForRoleOnTeam($user, 'Coach', $memberInvitation->team_id, null);
    }
779410
public function onPostUpdate(UserEvent $event)
    {
        if (!$event->hasData('password')) {
            return;
        }

        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */
        $user = $event->getResource();

        if (0 < $this->mailer->sendNewPasswordEmailMessage($user, $event->getData('password'))) {
            $event->addMessage(new ResourceMessage('ekyna_user.user.event.credentials_sent'));
        }
    }
458717
public function update(UpdateUserRequest $request, User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_UPDATE);

        $user->update($request->getValidatedData());
        $user->roles()->sync($request->get('roles'));

        $this->transNotification('updated', ['name' => $user->full_name], $user->toArray());

        return redirect()->route('admin::auth.users.show', [$user->hashed_id]);
    }
959252
public function addInvitationsMenuItem(UserMenuCollectionEvent $event): void
    {
        // Get the menu from the event.
        $menu = $event->getMenu();

        // Lookup and count pending invitations.
        $repo = $this->em->getRepository(Invitation::class);
        $user = $this->token_storage->getToken()->getUser();
        $invitations = $repo->findPendingInvitations($user);

        // Create the pending invitations menu link.
        $invitations = $this->factory->createItem('menu_item.pending_invitations', [
            'route' => 'bkstg_invitation_index',
            'extras' => [
                'badge_count' => count($invitations),
                'translation_domain' => BkstgScheduleBundle::TRANSLATION_DOMAIN,
            ],
        ]);
        $menu->addChild($invitations);
    }
512660
public function getDesktopWidgetInstance(
        User $user,
        array $excludedWidgetInstances
    )
    {
        if (count($excludedWidgetInstances) === 0) {
            return $this->widgetInstanceRepo->findBy(
                array(
                    'user' => $user,
                    'isAdmin' => false,
                    'isDesktop' => true
                )
            );
        }

        return $this->widgetInstanceRepo
            ->findDesktopWidgetInstance($user, $excludedWidgetInstances);
    }
594598
public function updateFromGeoIp(User $user, array $ipInfo)
    {
        $contact = $user->getContact();
        $country = $contact->getCountry();
        $city = $contact->getCity();
        $region = $contact->getRegion();

        if (!$country) {
            $contact->setCountry($ipInfo['country']);
        }

        if (!$city) {
            $contact->setCountry($ipInfo['country']);
        }

        if (!$region) {
            $contact->setCountry($ipInfo['country']);
        }

        $this->dm->persist($user);

        return $this;
    }