]> git.mxchange.org Git - friendica.git/commitdiff
show group affiliations in contact editor
authorFriendika <info@friendika.com>
Wed, 1 Jun 2011 02:24:26 +0000 (19:24 -0700)
committerFriendika <info@friendika.com>
Wed, 1 Jun 2011 02:24:26 +0000 (19:24 -0700)
include/group.php
mod/contacts.php
view/contact_edit.tpl

index d1b3369469fef8694a7dc898c00cc06f3f11a483..804d0c58f3ee1cbfded85e7572d7502cefff8c4d 100644 (file)
@@ -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;
+
+}
+
index 4baa2d2d7c7ec24bf552240857db2e00064a0e54..e7a800500bcbfdaf0b12e2f47571f49c948acb91 100644 (file)
@@ -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: '),
index 97134aedd7dc3a34f320e51d1fd283535565acd5..3246e4470331783a270cd4f4ec31481a67465023 100644 (file)
@@ -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">