visit "random profile" feature

This commit is contained in:
friendica 2012-04-10 20:50:31 -07:00
parent 0fa932853c
commit b02a671494
5 changed files with 22 additions and 1 deletions

View File

@ -158,3 +158,11 @@ function contact_photo_menu($contact) {
} }
return $o; 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 '';
}

View File

@ -12,6 +12,7 @@ function follow_widget() {
} }
function findpeople_widget() { function findpeople_widget() {
require_once('include/Contact.php');
$a = get_app(); $a = get_app();
@ -32,6 +33,7 @@ function findpeople_widget() {
'$findthem' => t('Find'), '$findthem' => t('Find'),
'$suggest' => t('Friend Suggestions'), '$suggest' => t('Friend Suggestions'),
'$similar' => t('Similar Interests'), '$similar' => t('Similar Interests'),
'$random' => t('Random Profile'),
'$inv' => t('Invite Friends') '$inv' => t('Invite Friends')
)); ));

View File

@ -14,7 +14,7 @@ function profile_init(&$a) {
else { else {
$r = q("select nickname from user where blocked = 0 and account_expired = 0 and verified = 1 order by rand() limit 1"); $r = q("select nickname from user where blocked = 0 and account_expired = 0 and verified = 1 order by rand() limit 1");
if(count($r)) { if(count($r)) {
$which = $r[0]['nickname']; goaway($a->get_baseurl() . '/profile/' . $r[0]['nickname']);
} }
else { else {
notice( t('Requested profile is not available.') . EOL ); notice( t('Requested profile is not available.') . EOL );

10
mod/randprof.php Normal file
View File

@ -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');
}

View File

@ -6,6 +6,7 @@
</form> </form>
<div class="side-link" id="side-match-link"><a href="match" >$similar</a></div> <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-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 }} {{ if $inv }}
<div class="side-link" id="side-invite-link" ><a href="invite" >$inv</a></div> <div class="side-link" id="side-invite-link" ><a href="invite" >$inv</a></div>
{{ endif }} {{ endif }}