]> git.mxchange.org Git - friendica.git/commitdiff
visit "random profile" feature
authorfriendica <info@friendica.com>
Wed, 11 Apr 2012 03:50:31 +0000 (20:50 -0700)
committerfriendica <info@friendica.com>
Wed, 11 Apr 2012 03:50:31 +0000 (20:50 -0700)
include/Contact.php
include/contact_widgets.php
mod/profile.php
mod/randprof.php [new file with mode: 0644]
view/peoplefind.tpl

index d8d94b1908faa8d1bdf1f4efb9a7ded3b9485aaa..532ea2f957cf15e1c4bc1c605e6c547ea0a663ad 100644 (file)
@@ -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
index e0f37f078f7cf2241b3e4efc34fbe3b9bcecc3c8..96b02f29391c816926739db27dc07fb86d552bc1 100644 (file)
@@ -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')
        ));
 
index 68d73fba3829b50aab8d2fb33897788ee148dfe9..51f9444121d20083f3908c30e63b82b7ab389822 100644 (file)
@@ -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 (file)
index 0000000..53d7425
--- /dev/null
@@ -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');
+}
index eeae2a29af4ceee4d62df5a7e7cb6e53bdcb212a..3c2692d25e7a1c03b3c241bed5ba40c1f63c1cc3 100644 (file)
@@ -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 }}