diff --git a/src/Model/Contact.php b/src/Model/Contact.php index 18c378179e..325183e10b 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -3259,4 +3259,24 @@ class Contact $fields = ['failed' => false, 'last_contact' => DateTimeFormat::utcNow(), 'updated' => $last_updated]; DBA::update('contact', $fields, ['nurl' => Strings::normaliseLink($data['url'])]); } + + /** + * Returns a random, global contact of the current node + * + * @return string The profile URL + * @throws Exception + */ + public static function getRandomUrl() + { + $r = DBA::selectFirst('contact', ['url'], [ + "`uid` = ? AND `network` = ? AND NOT `failed` AND `last-item` > ?", + 0, Protocol::DFRN, DateTimeFormat::utc('now - 1 month'), + ], ['order' => ['RAND()']]); + + if (DBA::isResult($r)) { + return $r['url']; + } + + return ''; + } } diff --git a/src/Model/GContact.php b/src/Model/GContact.php index 6549e9efe2..ce224f44c0 100644 --- a/src/Model/GContact.php +++ b/src/Model/GContact.php @@ -205,27 +205,4 @@ class GContact /// @TODO Check all calling-findings of this function if they properly use DBA::isResult() return $r; } - - /** - * Returns a random, global contact of the current node - * - * @return string The profile URL - * @throws Exception - */ - public static function getRandomUrl() - { - $r = DBA::selectFirst('gcontact', ['url'], [ - '`network` = ? - AND NOT `failed` - AND `updated` > ?', - Protocol::DFRN, - DateTimeFormat::utc('now - 1 month'), - ], ['order' => ['RAND()']]); - - if (DBA::isResult($r)) { - return $r['url']; - } - - return ''; - } } diff --git a/src/Module/RandomProfile.php b/src/Module/RandomProfile.php index 111d92dc40..65ce565959 100644 --- a/src/Module/RandomProfile.php +++ b/src/Module/RandomProfile.php @@ -24,7 +24,6 @@ namespace Friendica\Module; use Friendica\BaseModule; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Model\GContact; /** * Redirects to a random Friendica profile this node knows about @@ -35,7 +34,7 @@ class RandomProfile extends BaseModule { $a = DI::app(); - $contactUrl = GContact::getRandomUrl(); + $contactUrl = Contact::getRandomUrl(); if ($contactUrl) { $link = Contact::magicLink($contactUrl); diff --git a/view/theme/frio/templates/widget/peoplefind.tpl b/view/theme/frio/templates/widget/peoplefind.tpl index fc5d249b4b..b6d1e3ff27 100644 --- a/view/theme/frio/templates/widget/peoplefind.tpl +++ b/view/theme/frio/templates/widget/peoplefind.tpl @@ -16,6 +16,7 @@ {{* Additional links *}} + {{if $nv.inv}}