Skip to content

Commit

Permalink
fix: map object to WP_User class (#187)
Browse files Browse the repository at this point in the history
* fix: map object to `WP_User` class

* chore(l10n): update pot file

* fix: update order by parameter

* chore(l10n): update pot file

---------

Co-authored-by: GitHub Actions <actions@github.com>
  • Loading branch information
fdalcin and actions-user committed Jul 11, 2024
1 parent 2b79743 commit b8213aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
16 changes: 8 additions & 8 deletions languages/pressbooks-multi-institution.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPL v3 or later.
msgid ""
msgstr ""
"Project-Id-Version: Pressbooks Shared Network 1.0.0\n"
"Project-Id-Version: Pressbooks Shared Network 1.0.1\n"
"Report-Msgid-Bugs-To: https://github.com/pressbooks/pressbooks-multi-institution/issues\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-07-02T21:15:38+00:00\n"
"POT-Creation-Date: 2024-07-11T15:45:16+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.10.0\n"
"X-Domain: pressbooks-multi-institution\n"
Expand Down Expand Up @@ -73,27 +73,27 @@ msgid_plural "Users updated."
msgstr[0] ""
msgstr[1] ""

#: src/Controllers/InstitutionsController.php:102
#: src/Controllers/InstitutionsController.php:103
msgid "Action completed."
msgstr ""

#: src/Controllers/InstitutionsController.php:127
#: src/Controllers/InstitutionsController.php:128
msgid "The form is invalid."
msgstr ""

#: src/Controllers/InstitutionsController.php:173
#: src/Controllers/InstitutionsController.php:174
msgid "Institution has been added."
msgstr ""

#: src/Controllers/InstitutionsController.php:174
#: src/Controllers/InstitutionsController.php:175
msgid "Institution has been updated."
msgstr ""

#: src/Controllers/InstitutionsController.php:201
#: src/Controllers/InstitutionsController.php:202
msgid "The name field is required."
msgstr ""

#: src/Controllers/InstitutionsController.php:211
#: src/Controllers/InstitutionsController.php:212
msgid "The book limit field should be numeric."
msgstr ""

Expand Down
13 changes: 8 additions & 5 deletions src/Controllers/InstitutionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
use PressbooksMultiInstitution\Models\Institution;
use PressbooksMultiInstitution\Models\InstitutionUser;
use PressbooksMultiInstitution\Views\InstitutionsTable;
use PressbooksMultiInstitution\Support\ConvertEmptyStringsToNull;

use PressbooksMultiInstitution\Views\InstitutionsTotals;
use PressbooksMultiInstitution\Support\ConvertEmptyStringsToNull;
use stdClass;
use WP_User;

use function Pressbooks\Admin\NetworkManagers\is_restricted;

Expand Down Expand Up @@ -271,16 +272,18 @@ protected function fetchUsers(?Institution $institution): array
->pluck('ID')
->toArray();

return get_users([
$users = get_users([
'blog_id' => 0, // all users from the network
'fields' => ['ID', 'display_name', 'user_email'],
'orderby' => [
'display_name',
'email',
'name',
'user_email',
'user_login',
],
'exclude' => $usersToSkip
]);

return array_map(fn (stdClass $value) => new WP_User($value), $users);
}

protected function checkForInvalidDomains(array $domains): array
Expand Down

0 comments on commit b8213aa

Please sign in to comment.