Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
c9c4d236
Commit
c9c4d236
authored
Sep 23, 2009
by
Richard Mansfield
Browse files
Filter by role in group_get_user_groups
Signed-off-by:
Richard Mansfield
<
richardm@catalyst.net.nz
>
parent
f7f94cc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/group.php
View file @
c9c4d236
...
...
@@ -1114,17 +1114,17 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
}
function
group_get_user_groups
(
$userid
=
null
)
{
function
group_get_user_groups
(
$userid
=
null
,
$roles
=
null
)
{
if
(
is_null
(
$userid
))
{
global
$USER
;
$userid
=
$USER
->
get
(
'id'
);
}
if
(
$groups
=
get_records_sql_array
(
"SELECT g.id, g.name, gm.role
"SELECT g.id, g.name, gm.role
, g.jointype, g.grouptype
FROM
{
group
}
g
JOIN
{
group_member
}
gm ON (gm.group = g.id)
WHERE gm.member = ?
AND g.deleted = 0
AND g.deleted = 0
"
.
(
is_array
(
$roles
)
?
(
' AND gm.role IN ('
.
join
(
','
,
array_map
(
'db_quote'
,
$roles
))
.
')'
)
:
''
)
.
"
ORDER BY gm.role = 'admin' DESC, gm.role, g.id"
,
array
(
$userid
)))
{
return
$groups
;
}
...
...
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