Random members + Online

since i cant edit the market post anymore ill post it here.
http://www.boonex.com/unity/extensions/entry/Display_random_members


files to edit \templates\base\scripts\ BxBaseIndexPageView.php
look for this code around line 322

// top menu and sorting
$aModes = array('last', 'top', 'online');

change it to

// top menu and sorting
$aModes = array('last', 'top', 'rand', 'online');


find this code around line 337

                case 'last':
                    if ($sMode == $sMyMode)
                    $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`DateReg` DESC";
                    $sModeTitle = _t('_Latest');
                break;

just bellow add this

case 'rand':
                    if ($sMode == $sMyMode)
                    $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE) DESC, `Profiles`.`Avatar` <> 0 DESC, RAND()";
                    $sModeTitle = _t('_Random');
                break;


to make the random option the default selection find this code

 $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'last';
change to
$sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'rand;



And if you already have this mod installed simply find


$sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`Avatar` <> 0 DESC, RAND()";

and change it to

$sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE) DESC, `Profiles`.`Avatar` <> 0 DESC, RAND()";

roam.JPG

Quote · 8 Dec 2010

Thanks Prolaznik

 

update your script

working 100%  here  in 7.0.4

 

 

Thanks

Quote · 9 Dec 2010

for  d 7.0.6 

there are two options that need to be changed to rand
around line 328

         if (empty($_GET[$sBlockName . 'Mode'])) {

        $sMode = 'last';

        } else {

        $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'last';

Quote · 30 May 2011

Remember this method is very slow if you have many registered peoples 

PS: If possible do not write me personally, please try to ask on the forum first
Quote · 30 May 2011

Thanks for that great mod.

Worked well but I have an error on home page:

'rand'
Warning: Cannot modify header information - headers already sent by (output started at /home/noigoiro/public_html/templates/base/scripts/BxBaseIndexPageView.php:1) in /home/noigoiro/public_html/inc/design.inc.php on line 133

 

You can help me to delete this message ?

error.jpg · 143.4K · 499 views
Quote · 25 Sep 2011

Members with photo only how can we do this 

Quote · 11 Oct 2011

But what if you wish to have Featured Block show Random and Members Block show Latest ?

Quote · 15 Oct 2011

Quote · 13 Jan 2012

Thanks for this great mod,

shows only members with avatar Cool

Quote · 16 Jan 2012

I want the Member photos and public photos to be random, but not featured members.  Is there a way to do that?  Is there a mod for it?

Quote · 14 May 2013

i want the photo block show only 1 photo per user i searching soultion for weeks

 

Always remember that the future comes one day at a time.
Quote · 17 Jun 2013

This file edit still works on 7.3.2 but with a few changes in codes. Here is what I have and changed or added is in the green:

 

        // top menu and sorting
        $aModes = getParam('votes') ? array('last', 'top', 'rand', 'online') : array('last', 'online');
        $aDBTopMenu = array();

        if (empty($_GET[$sBlockName . 'Mode'])) {
            $sMode = 'rand';
        } else {
            $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'rand';
        }
        $sqlOrder = "";
        foreach( $aModes as $sMyMode ) {
            switch ($sMyMode) {
                case 'online':
                    if ($sMode == $sMyMode) {
                        $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE)";
                        $sqlOrder = " ORDER BY `Profiles`.`DateLastNav` DESC";
                        $sViewAllQuery = 'online_only=on';
                    }
                    $sModeTitle = _t('_Online');
                break;
                case 'last':
                    if ($sMode == $sMyMode) {
                        $sqlOrder = " ORDER BY `Profiles`.`DateReg` DESC";
                        $sViewAllQuery = 'sort=date_reg';
                    }
                    $sModeTitle = _t('_Latest');
                break;
                case 'rand':
                    if ($sMode == $sMyMode) {
                        $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE) DESC, `Profiles`.`Avatar` <> 0 DESC, RAND()";
                    }
                    $sModeTitle = _t('_Random');
                break;
                case 'top':
                    if ($sMode == $sMyMode) {
                        $sqlOrder = ' ORDER BY `Profiles`.`Rate` DESC, `Profiles`.`RateCount` DESC';
                        $sViewAllQuery = 'sort=rate';
                    }
                    $sModeTitle = _t('_Top');
                break;
            }
            $aDBTopMenu[$sModeTitle] = array('href' => BX_DOL_URL_ROOT . "index.php?{$sBlockName}Mode=$sMyMode", 'dynamic' => true, 'active' => ( $sMyMode == $sMode ));
        }

Quote · 18 Sep 2016

 

This file edit still works on 7.3.2 but with a few changes in codes. Here is what I have and changed or added is in the green:

 

        // top menu and sorting
        $aModes = getParam('votes') ? array('last', 'top', 'rand', 'online') : array('last', 'online');
        $aDBTopMenu = array();

        if (empty($_GET[$sBlockName . 'Mode'])) {
            $sMode = 'rand';
        } else {
            $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'rand';
        }
        $sqlOrder = "";
        foreach( $aModes as $sMyMode ) {
            switch ($sMyMode) {
                case 'online':
                    if ($sMode == $sMyMode) {
                        $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE)";
                        $sqlOrder = " ORDER BY `Profiles`.`DateLastNav` DESC";
                        $sViewAllQuery = 'online_only=on';
                    }
                    $sModeTitle = _t('_Online');
                break;
                case 'last':
                    if ($sMode == $sMyMode) {
                        $sqlOrder = " ORDER BY `Profiles`.`DateReg` DESC";
                        $sViewAllQuery = 'sort=date_reg';
                    }
                    $sModeTitle = _t('_Latest');
                break;
                case 'rand':
                    if ($sMode == $sMyMode) {
                        $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE) DESC, `Profiles`.`Avatar` <> 0 DESC, RAND()";
                    }
                    $sModeTitle = _t('_Random');
                break;
                case 'top':
                    if ($sMode == $sMyMode) {
                        $sqlOrder = ' ORDER BY `Profiles`.`Rate` DESC, `Profiles`.`RateCount` DESC';
                        $sViewAllQuery = 'sort=rate';
                    }
                    $sModeTitle = _t('_Top');
                break;
            }
            $aDBTopMenu[$sModeTitle] = array('href' => BX_DOL_URL_ROOT . "index.php?{$sBlockName}Mode=$sMyMode", 'dynamic' => true, 'active' => ( $sMyMode == $sMode ));
        }

 

I am running dolphin 7.3.3 and tried to edit code, upload and then clear cache, but without any results, no changes to the block whatsoever, anyone have any valuable advice about how to implement this on 7.3.3?  

Quote · 30 Dec 2016

 

I am running dolphin 7.3.3 and tried to edit code, upload and then clear cache, but without any results, no changes to the block whatsoever, anyone have any valuable advice about how to implement this on 7.3.3?  

 Clear your cache.

Core changes are a bad idea these days. Keep track of your changes, helpful when updates overwrite your edits.

ManOfTeal.COM a Proud UNA site, six years running strong!
Quote · 30 Dec 2016

 

 

I am running dolphin 7.3.3 and tried to edit code, upload and then clear cache, but without any results, no changes to the block whatsoever, anyone have any valuable advice about how to implement this on 7.3.3?  

 Clear your cache.

Core changes are a bad idea these days. Keep track of your changes, helpful when updates overwrite your edits.

 

I have cleared all caches from admin panel already, do I need to manually delete the files in cache and cache_public folders also? 

Quote · 30 Dec 2016

Now I found a way to make this work for my dolphin 7.3.3 here is the code that made it work for me, have marked the newly added code with red bold text and the original code that was edited is market with green bold text  not sure if this is best way to do this but worked for me, remember to clear all caches after uploading the new file to your server.

 

 // ----- non-block functions ----- //

    function getMembers ($sBlockName, $aParams = array(), $iLimit = 32, $sMode = 'rand')

    {

        $aDefFields = array(

            'ID', 'NickName', 'Couple', 'Sex'

        );

        $sCode = '';

 

        $iOnlineTime = (int)getParam( "member_online_time" );

 

        //main fields

        $sqlMainFields = "";

        foreach ($aDefFields as $iKey => $sValue)

             $sqlMainFields .= "`Profiles`. `$sValue`, ";

 

        $sqlMainFields .= "if(`DateLastNav` > SUBDATE(NOW(), INTERVAL $iOnlineTime MINUTE ), 1, 0) AS `is_online`";

 

        // possible conditions

        $sqlCondition = "WHERE `Profiles`.`Status` = 'Active' and (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";

        if (is_array($aParams)) {

             foreach ($aParams as $sField => $sValue)

                 $sqlCondition .= " AND `Profiles`.`$sField` = '$sValue'";

        }

 

        // top menu and sorting

        $aModes = getParam('votes') ? array('last', 'top', 'rand', 'online') : array('last', 'top', 'rand', 'online');

        $aDBTopMenu = array();

 

        if (empty($_GET[$sBlockName . 'Mode'])) {

            $sMode = 'rand';

        } else {

            $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'rand';

        }

        $sqlOrder = "";

        foreach( $aModes as $sMyMode ) {

            switch ($sMyMode) {

                case 'online':

                    if ($sMode == $sMyMode) {

                        $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE)";

                        $sqlOrder = " ORDER BY `Profiles`.`DateLastNav` DESC";

                        $sViewAllQuery = 'online_only=on';

                    }

                    $sModeTitle = _t('_Online');

                break;

                case 'last':

                    if ($sMode == $sMyMode) {

                        $sqlOrder = " ORDER BY `Profiles`.`DateReg` DESC";

                        $sViewAllQuery = 'sort=date_reg';

                    }

                    $sModeTitle = _t('_Latest');

                break;

                case 'rand':

                    if ($sMode == $sMyMode) {

                        $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE) DESC, `Profiles`.`Avatar` <> 0 DESC, RAND()";

                    }

                    $sModeTitle = _t('_Random');

                break;

                case 'top':

                    if ($sMode == $sMyMode) {

                        $sqlOrder = ' ORDER BY `Profiles`.`Rate` DESC, `Profiles`.`RateCount` DESC';

                        $sViewAllQuery = 'sort=rate';

                    }

                    $sModeTitle = _t('_Top');

                break;

            }

 

 

       Here is the original code, how it was before I made any changes

 

// ----- non-block functions ----- //

    function getMembers ($sBlockName, $aParams = array(), $iLimit = 16, $sMode = 'last')

    {

        $aDefFields = array(

            'ID', 'NickName', 'Couple', 'Sex'

        );

        $sCode = '';

 

        $iOnlineTime = (int)getParam( "member_online_time" );

 

        //main fields

        $sqlMainFields = "";

        foreach ($aDefFields as $iKey => $sValue)

             $sqlMainFields .= "`Profiles`. `$sValue`, ";

 

        $sqlMainFields .= "if(`DateLastNav` > SUBDATE(NOW(), INTERVAL $iOnlineTime MINUTE ), 1, 0) AS `is_online`";

 

        // possible conditions

        $sqlCondition = "WHERE `Profiles`.`Status` = 'Active' and (`Profiles`.`Couple` = 0 or `Profiles`.`Couple` > `Profiles`.`ID`)";

        if (is_array($aParams)) {

             foreach ($aParams as $sField => $sValue)

                 $sqlCondition .= " AND `Profiles`.`$sField` = '$sValue'";

        }

 

        // top menu and sorting

        $aModes = getParam('votes') ? array('last', 'top', 'online') : array('last', 'online');

        $aDBTopMenu = array();

 

        if (empty($_GET[$sBlockName . 'Mode'])) {

            $sMode = 'last';

        } else {

            $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'last';

        }

        $sqlOrder = "";

        foreach( $aModes as $sMyMode ) {

            switch ($sMyMode) {

                case 'online':

                    if ($sMode == $sMyMode) {

                        $sqlCondition .= " AND `Profiles`.`DateLastNav` > SUBDATE(NOW(), INTERVAL ".$iOnlineTime." MINUTE)";

                        $sqlOrder = " ORDER BY `Profiles`.`DateLastNav` DESC";

                        $sViewAllQuery = 'online_only=on';

                    }

                    $sModeTitle = _t('_Online');

                break;

                case 'last':

                    if ($sMode == $sMyMode) {

                        $sqlOrder = " ORDER BY `Profiles`.`DateReg` DESC";

                        $sViewAllQuery = 'sort=date_reg';

                    }

                    $sModeTitle = _t('_Latest');

                break;

                case 'top':

                    if ($sMode == $sMyMode) {

                        $sqlOrder = ' ORDER BY `Profiles`.`Rate` DESC, `Profiles`.`RateCount` DESC';

                        $sViewAllQuery = 'sort=rate';

                    }

                    $sModeTitle = _t('_Top');

                break;

            }

 

 

Quote · 30 Dec 2016
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.