aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/Contact.php8
-rw-r--r--include/contact_widgets.php2
-rw-r--r--mod/profile.php2
-rw-r--r--mod/randprof.php10
-rw-r--r--view/peoplefind.tpl1
5 files changed, 22 insertions, 1 deletions
diff --git a/include/Contact.php b/include/Contact.php
index d8d94b190..532ea2f95 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -158,3 +158,11 @@ function contact_photo_menu($contact) {
}
return $o;
}}
+
+
+function random_profile() {
+ $r = q("select url from gcontact where url like '%%://%%/profile/%%' order by rand() limit 1");
+ if(count($r))
+ return dirname($r[0]['url']);
+ return '';
+} \ No newline at end of file
diff --git a/include/contact_widgets.php b/include/contact_widgets.php
index e0f37f078..96b02f293 100644
--- a/include/contact_widgets.php
+++ b/include/contact_widgets.php
@@ -12,6 +12,7 @@ function follow_widget() {
}
function findpeople_widget() {
+ require_once('include/Contact.php');
$a = get_app();
@@ -32,6 +33,7 @@ function findpeople_widget() {
'$findthem' => t('Find'),
'$suggest' => t('Friend Suggestions'),
'$similar' => t('Similar Interests'),
+ '$random' => t('Random Profile'),
'$inv' => t('Invite Friends')
));
diff --git a/mod/profile.php b/mod/profile.php
index 68d73fba3..51f944412 100644
--- a/mod/profile.php
+++ b/mod/profile.php
@@ -14,7 +14,7 @@ function profile_init(&$a) {
else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and verified = 1 order by rand() limit 1");
if(count($r)) {
- $which = $r[0]['nickname'];
+ goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
}
else {
notice( t('Requested profile is not available.') . EOL );
diff --git a/mod/randprof.php b/mod/randprof.php
new file mode 100644
index 000000000..53d7425e9
--- /dev/null
+++ b/mod/randprof.php
@@ -0,0 +1,10 @@
+<?php
+
+
+function randprof_init(&$a) {
+ require_once('include/Contact.php');
+ $x = random_profile();
+ if($x)
+ goaway($x);
+ goaway($a->get_baseurl() . '/profile');
+}
diff --git a/view/peoplefind.tpl b/view/peoplefind.tpl
index eeae2a29a..3c2692d25 100644
--- a/view/peoplefind.tpl
+++ b/view/peoplefind.tpl
@@ -6,6 +6,7 @@
</form>
<div class="side-link" id="side-match-link"><a href="match" >$similar</a></div>
<div class="side-link" id="side-suggest-link"><a href="suggest" >$suggest</a></div>
+ <div class="side-link" id="side-random-profile-link" ><a href="randprof" target="extlink" >$random</a></div>
{{ if $inv }}
<div class="side-link" id="side-invite-link" ><a href="invite" >$inv</a></div>
{{ endif }}