connect link in directory

This commit is contained in:
friendica 2013-08-03 16:35:55 -07:00
parent 8a7fea45cc
commit e6a8bb211c
3 changed files with 27 additions and 4 deletions

View File

@ -53,6 +53,20 @@ function directory_content(&$a) {
}
logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
$contacts = array();
if(local_user()) {
$x = q("select abook_xchan from abook where abook_channel = %d",
intval(local_user())
);
if($x) {
foreach($x as $xx)
$contacts[] = $xx['abook_xchan'];
}
}
if($url) {
$query = $url . '?f=' ;
if($search)
@ -88,7 +102,11 @@ function directory_content(&$a) {
$profile_link = chanlink_url($rr['url']);
$pdesc = (($rr['description']) ? $rr['description'] . '<br />' : '');
$connect_link = ((local_user()) ? z_root() . '/follow?f=&url=' . urlencode($rr['address']) : '');
if(in_array($rr['hash'],$contacts))
$connect_link = '';
$details = '';
if(strlen($rr['locale']))
$details .= $rr['locale'];
@ -142,7 +160,8 @@ function directory_content(&$a) {
'marital' => $marital,
'homepage' => $homepage,
'about' => $about,
'conn_label' => t('Connect'),
'connect' => $connect_link,
);
$arr = array('contact' => $rr, 'entry' => $entry);
@ -150,14 +169,13 @@ function directory_content(&$a) {
call_hooks('directory_item', $arr);
$entries[] = $entry;
unset($profile);
unset($location);
}
logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA);
// logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA);
$o .= replace_macros($tpl, array(
'$search' => $search,

View File

@ -134,6 +134,8 @@ function dirsearch_content(&$a) {
$entry = array();
$entry['name'] = $rr['xchan_name'];
$entry['hash'] = $rr['xchan_hash'];
$entry['updated'] = (($rr['ud_date']) ? $rr['ud_date'] : '0000-00-00 00:00:00');
$entry['url'] = $rr['xchan_url'];
$entry['photo'] = $rr['xchan_photo_m'];

View File

@ -6,5 +6,8 @@
</div>
<div class="contact-name" id="directory-name-{{$entry.id}}">{{$entry.name}}</div>
{{if $entry.connect}}
<div class="directory-connect"><a href="{{$entry.connect}}">{{$entry.conn_label}}</a></div>
{{/if}}
<div class="contact-details">{{$entry.details}}</div>
</div>