Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
mahara
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mahara
mahara
Commits
588126aa
Commit
588126aa
authored
Jun 17, 2011
by
Richard Mansfield
Committed by
Gerrit Code Review
Jun 17, 2011
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Add a function to turn a list of usernames into ids"
parents
d62429dc
ad2e892a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
htdocs/lib/user.php
htdocs/lib/user.php
+19
-0
No files found.
htdocs/lib/user.php
View file @
588126aa
...
...
@@ -2197,3 +2197,22 @@ function get_onlineusers($limit=10, $offset=0, $orderby='firstname,lastname') {
return
$result
;
}
/**
* Get a list of userids from a list of usernames
*
* @param $usernames array list of usernames
*
* @returns array list of userids
*/
function
username_to_id
(
$usernames
)
{
if
(
!
empty
(
$usernames
))
{
$ids
=
get_records_sql_menu
(
'
SELECT username, id FROM {usr}
WHERE deleted = 0
AND LOWER(username) IN ('
.
join
(
','
,
array_fill
(
0
,
count
(
$usernames
),
'?'
))
.
')'
,
array_map
(
'strtolower'
,
$usernames
)
);
}
return
empty
(
$ids
)
?
array
()
:
$ids
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment