docs: Port "User" service page to 7.2#578
Conversation
Ports the legacy User helper guide (mautic/developer-documentation _plugin_services_users.md) into docs/plugin_services/user.rst, converting Markdown to RST and modernizing to constructor injection of UserHelper. Targets 7.2 per the team's plan to set content in 7.2 first, then cherry-pick to 7.1/7.0/6.0/5.x. Resolves docs issue mautic#391 (parent mautic#390).
| .. vale on No newline at end of file | ||
| .. vale on | ||
|
|
||
| Use the ``Mautic\CoreBundle\Helper\UserHelper`` service to retrieve the currently logged-in User. Inject it into your service or subscriber through the constructor: |
There was a problem hiding this comment.
Ported this page's UserHelper usage from the legacy Markdown file _plugin_services_users.md, which documented retrieving the current User via the mautic.helper.user service and calling getUser(). Modernized the legacy $this->get('mautic.helper.user') fetch to constructor injection of UserHelper and corrected the getter casing (getFirstName()/getLastName()).
There was a problem hiding this comment.
(Line 45)
Verified the documented behavior against UserHelper::getUser() on the 7.x branch: its signature is getUser($nullIfGuest = false): ?User, so passing true returns null when the request has no authenticated User (otherwise it returns a guest User). Also confirmed getFirstName(), getLastName(), getEmail(), getRole() on UserBundle\Entity\User and Role::isAdmin() exist as used in the example.
Source: https://github.com/mautic/mautic/blob/7.x/app/bundles/CoreBundle/Helper/UserHelper.php
Open this suggestion in Promptless to view citations and reasoning process
Ports the legacy User helper guide into docs/plugin_services/user.rst, converting the legacy Markdown to RST and modernizing it to constructor injection of UserHelper. Targets the 7.2 base branch per the team's plan to set content in 7.2 first, then cherry-pick to 7.1/7.0/6.0/5.x. Resolves docs issue #391 (parent #390).
Trigger Events
blockedlabel is to set content, structure, and tone in one branch, then backport/cherry pick i...Tip: Sort by Shortest Review in the Dashboard to find quick wins ⚡