testing init_groups_visitor changes - also add virtual groups for both zot identities

This commit is contained in:
zotlabs 2019-03-10 22:32:37 -07:00
parent 1688e373bc
commit 4e97fb0e58

View File

@ -564,17 +564,6 @@ function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'f
function init_groups_visitor($contact_id) {
$groups = [];
// private profiles are treated as a virtual group
$r = q("SELECT abook_profile from abook where abook_xchan = '%s' and abook_profile != '' ",
dbesc($contact_id)
);
if($r) {
foreach($r as $rv) {
$groups[] = 'vp.' . $rv['abook_profile'];
}
}
$x = q("select * from xchan where xchan_hash = '%s'",
dbesc($contact_id)
);
@ -595,9 +584,18 @@ function init_groups_visitor($contact_id) {
$hashes = ids_to_querystr($xchans,'xchan_hash',true);
}
// private profiles are treated as a virtual group
$r = q("SELECT abook_profile from abook where abook_xchan in ( " . protect_sprintf($hashes) . " ) and abook_profile != '' ");
if($r) {
foreach($r as $rv) {
$groups[] = 'vp.' . $rv['abook_profile'];
}
}
// physical groups this identity is a member of
$r = q("SELECT hash FROM pgrp left join pgrp_member on pgrp.id = pgrp_member.gid WHERE xchan in ( " . protect_sprintf($hashes) . " ) " );
$r = q("SELECT hash FROM pgrp left join pgrp_member on pgrp.id = pgrp_member.gid WHERE xchan in ( " . protect_sprintf($hashes) . " ) ");
if($r) {
foreach($r as $rr)
$groups[] = $rr['hash'];