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
a487b737
Commit
a487b737
authored
Apr 15, 2009
by
Richard Mansfield
Browse files
Fix my groups/find group queries to give correct number of pending members (bug 3206)
parent
80525850
Changes
2
Show whitespace changes
Inline
Side-by-side
htdocs/group/find.php
View file @
a487b737
...
...
@@ -86,12 +86,11 @@ if ($groups['data']) {
$groupids
[]
=
$group
->
id
;
}
$groups
[
'data'
]
=
get_records_sql_assoc
(
"SELECT g.id, g.name, g.description, g.jointype,
t
.membershiptype,
COUNT(gm.member) AS membercount,
COUNT(gm
r
.member) AS
requests
"SELECT g
1
.id, g
1
.name, g
1
.description, g
1
.jointype,
g1
.membershiptype,
g1.membercount, COUNT(gmr.member) AS requests
FROM (
SELECT g.id, g.name, g.description, g.jointype, t.membershiptype,
COUNT(gm.member) AS
membercount
FROM
{
group
}
g
LEFT JOIN
{
group_member
}
gm ON (gm.group = g.id)
LEFT JOIN
{
group_member_request
}
gmr ON (gmr.group = g.id)
LEFT JOIN (
SELECT g.id, 'admin' AS membershiptype
FROM
{
group
}
g
...
...
@@ -111,7 +110,10 @@ if ($groups['data']) {
) t ON t.id = g.id
WHERE g.id IN ("
.
implode
(
$groupids
,
','
)
.
')
GROUP BY g.id, g.name, g.description, g.jointype, t.membershiptype
ORDER BY g.name'
,
ORDER BY g.name
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.jointype, g1.membershiptype, g1.membercount'
,
array
(
$USER
->
get
(
'id'
),
$USER
->
get
(
'id'
),
$USER
->
get
(
'id'
),
$USER
->
get
(
'id'
))
);
if
(
$groups
[
'data'
])
{
...
...
htdocs/lib/group.php
View file @
a487b737
...
...
@@ -1067,14 +1067,18 @@ function group_get_associated_groups($userid, $filter='all', $limit=20, $offset=
// gets the groups filtered by above
// and the first three members by id
$sql
=
'SELECT g.id, g.name, g.description, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role, COUNT(gm.member) AS membercount, COUNT(gmr.member) AS requests
$sql
=
'SELECT g1.id, g1.name, g1.description, g1.jointype, g1.grouptype, g1.membershiptype, g1.reason, g1.role, g1.membercount, COUNT(gmr.member) AS requests
FROM (
SELECT g.id, g.name, g.description, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role, COUNT(gm.member) AS membercount
FROM {group} g
LEFT JOIN {group_member} gm ON (gm.group = g.id)
LEFT JOIN {group_member_request} gmr ON (gmr.group = g.id)'
.
LEFT JOIN {group_member} gm ON (gm.group = g.id)'
.
$sql
.
'
WHERE g.deleted = ?
GROUP BY g.id, g.name, g.description, g.jointype, g.grouptype, t.membershiptype, t.reason, t.role
ORDER BY g.name'
;
ORDER BY g.name
) g1
LEFT JOIN {group_member_request} gmr ON (gmr.group = g1.id)
GROUP BY g1.id, g1.name, g1.description, g1.jointype, g1.grouptype, g1.membershiptype, g1.reason, g1.role, g1.membercount'
;
$groups
=
get_records_sql_assoc
(
$sql
,
$values
,
$offset
,
$limit
);
...
...
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