aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-05-31 19:24:26 -0700
committerFriendika <info@friendika.com>2011-05-31 19:24:26 -0700
commitb8c4d73377d93cc54cb10fd1c3fac173c8f57627 (patch)
tree80272eff0a99a399ccd9bc82f0b3999e5a99bd72
parente25ded6d9611e4bada5474b7c7d7c96ad95c930e (diff)
downloadvolse-hubzilla-b8c4d73377d93cc54cb10fd1c3fac173c8f57627.tar.gz
volse-hubzilla-b8c4d73377d93cc54cb10fd1c3fac173c8f57627.tar.bz2
volse-hubzilla-b8c4d73377d93cc54cb10fd1c3fac173c8f57627.zip
show group affiliations in contact editor
-rw-r--r--include/group.php12
-rw-r--r--mod/contacts.php10
-rw-r--r--view/contact_edit.tpl2
3 files changed, 24 insertions, 0 deletions
diff --git a/include/group.php b/include/group.php
index d1b336946..804d0c58f 100644
--- a/include/group.php
+++ b/include/group.php
@@ -185,3 +185,15 @@ function expand_groups($a) {
$ret[] = $rr['contact-id'];
return $ret;
}
+
+
+function member_of($c) {
+
+ $r = q("SELECT `group`.`name`, `group`.`id` FROM `group` LEFT JOIN `group_member` ON `group_member`.`gid` = `group`.`id` WHERE `group_member`.`contact-id` = %d AND `group`.`deleted` = 0 ORDER BY `group`.`name` ASC ",
+ intval($c)
+ );
+
+ return $r;
+
+}
+
diff --git a/mod/contacts.php b/mod/contacts.php
index 4baa2d2d7..e7a800500 100644
--- a/mod/contacts.php
+++ b/mod/contacts.php
@@ -249,6 +249,15 @@ function contacts_content(&$a) {
$sparkle = '';
}
+ $grps = '';
+ $member_of = member_of($r[0]['id']);
+ if(is_array($member_of) && count($member_of)) {
+ $grps = t('Member of: ') . EOL . '<ul>';
+ foreach($member_of as $member)
+ $grps .= '<li><a href="group/' . $member['id'] . '" title="' . t('Edit') . '" ><img src="images/spencil.gif" alt="' . t('Edit') . '" /></a> <a href="network/' . $member['id'] . '">' . $member['name'] . '</a></li>';
+ $grps .= '</ul>';
+ }
+
$insecure = '<div id="profile-edit-insecure"><p><img src="images/unlock_icon.gif" alt="' . t('Privacy Unavailable') . '" />&nbsp;'
. t('Private communications are not available for this contact.') . '</p></div>';
@@ -275,6 +284,7 @@ function contacts_content(&$a) {
'$altcrepair' => t('Repair contact URL settings'),
'$lblcrepair' => t("Repair contact URL settings \x28WARNING: Advanced\x29"),
'$lblrecent' => t('View conversations'),
+ '$grps' => $grps,
'$delete' => t('Delete contact'),
'$poll_interval' => contact_poll_interval($r[0]['priority']),
'$lastupdtext' => t('Last updated: '),
diff --git a/view/contact_edit.tpl b/view/contact_edit.tpl
index 97134aedd..3246e4470 100644
--- a/view/contact_edit.tpl
+++ b/view/contact_edit.tpl
@@ -42,6 +42,8 @@ $insecure
$blocked
$ignored
+$grps
+
<div id="view-recent-wrapper"><a href="network/?cid=$contact_id" id="contact-view-recent">$lblrecent</a></div>
<div id="contact-edit-info-wrapper">