Index: openacs-4/packages/acs-subsite/tcl/group-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/group-procs.tcl,v diff -u -N -r1.39.2.14 -r1.39.2.15 --- openacs-4/packages/acs-subsite/tcl/group-procs.tcl 12 May 2017 16:00:33 -0000 1.39.2.14 +++ openacs-4/packages/acs-subsite/tcl/group-procs.tcl 12 May 2017 16:17:44 -0000 1.39.2.15 @@ -608,38 +608,43 @@ ad_proc -public group::party_member_p { -party_id - { -group_name "" } { -group_id "" } + { -group_name "" } { -subsite_id "" } } { - Return 1 if the party is an approved member of the group specified. - You can specify a group name or group id. -

- Note: The group name is not unique - by definition, - and if you call this function with a duplicate group name it - will bomb!!! Using the group name as a parameter is - thus strongly discouraged unless you are really, really sure the - name is unique.

-

The party must have specifically - been granted membership on the group in question.

-} { + Return 1 if the party is an approved member of the group + specified. - if { $group_name eq "" && $group_id eq "" } { - return 0 - } + One can specify a group_id (preferred) or a group name. + Note: The group name is not + unique by definition, and if you call this function with a + duplicate group name it will return the first one + (arbitrary)!!! Using the group name as a parameter is thus + strongly discouraged unless you are really, really sure the name + is unique.

+

The party must have specifically been granted + membership on the group in question.

+ +} { if { $group_name ne "" } { + if {$group_id ne ""} { + ad_log warning "group::party_member_p: ignore specified group_id $group_id, usin name '$group_name' instead" + } set group_id [group::get_id -group_name $group_name -subsite_id $subsite_id] - if { $group_id eq "" } { - return 0 - } } - set result [lindex [db_list party_is_member {}] 0] - - return [template::util::is_true $result] + if { $group_id eq "" } { + set result 0 + } else { + set result [db_string party_is_member { + select 1 from group_approved_member_map + where member_id = :party_id + and group_id = :group_id + } -default 0] + } + return $result } ad_proc -public group::get_rel_segment {