Members Blocks Show Random

This will allow you to show members randomly in the Featured Members Block and the Members Block on Homepage.

Step 1. Edit /templates/base/scripts/BxBaseIndexPageView.php

Find around line 323

$aModes = array('last', 'top', 'online');

And replace with

$aModes = array('rand', 'last', 'top', 'online');

Then to set default display order

Find around line 326

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

And replace with

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

Note (possible values are rand, last, top, online)

Then around line 330 after

switch ($sMyMode) {

insert

case 'rand':

if ($sMode == $sMyMode)

$sqlOrder = " ORDER BY RAND()";

$sModeTitle = _t('Random');

break;

And that's it

But if you wish to have Featured Block show Random and Members Block show Latest follow above instructions then do this:

Around line 327 find:

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

And replace with:

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

Then around line 323 just before

$aModes = array('rand', 'last', 'top', 'online');

Insert:

if ($sBlockName == 'Featured') {
$blorder='rand';
} else if ($sBlockName == 'Members') {
$blorder='last';
}

________________________________________________________________________________

Regards

Dave....

Quote · 23 Apr 2010

Very Cool!

I never liked bitching around with people that contribute, but would it be possible to add such changes in the template's scripts instead of the  base script?

I'm saying this because as we all figured, heavily modding core D7 features is not usable since for every patch that is released, we're gonna also have to do all the changes from scratch!

Thank you a lot for sharing this code snippet!

Quote · 23 Apr 2010

Yup life's a Bummer... Was this not a standard feature in D6?

Quote · 23 Apr 2010

Yes i think it was, but not for all kinds of such buttons, only for users i think!

Quote · 23 Apr 2010

This might be helpful also....  ;-)

/templates/base/scripts/BxBaseProfileView.php

Around line 819 find

$sPossibleOrder = '';

Replace with

$sPossibleOrder = ' ORDER BY RAND()';

Then around line 822 remove or comment

$aWhere[] = "`Profiles`.`Featured` = '1'";

Or if you want to show randomly profiles with images only replace

$aWhere[] = "`Profiles`.`Featured` = '1'";

with

$aWhere[] = "`Profiles`.`Avatar` > '0'";

Then Edit

/templates/base/scripts/BxBaseIndexPageView.php

Remove or comment around line 319

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

Or if you want to show randomly profiles with images only replace

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

With

$sqlCondition .= " AND `Profiles`.`Avatar` > '0'";

Quote · 2 May 2010

This does not seem to work in 7.05

Quote · 13 Feb 2011

 

And that's it

But if you wish to have Featured Block show Random and Members Block show Latest follow above instructions then do this:

Around line 327 find:

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

And replace with:

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

Then around line 323 just before

$aModes = array('rand', 'last', 'top', 'online');

Insert:

if ($sBlockName == 'Featured') {
$blorder='rand';
} else if ($sBlockName == 'Members') {
$blorder='last';
}

________________________________________________________________________________

 

Regards

Dave....

 

does not work with dolphin D7.0.6 - there is another solution?

Quote · 20 May 2011

Agreed. None of this seems to work for 7.06, but it was working fine for me on 7.02.

Would love it if someone could tell us a solution. It looks terrible when you have profile pic with no image on the front page. Many thanks in advance to whoever might have the answer.

Quote · 27 May 2011

http://www.boonex.com/forums/#topic/Random-members-Online-.htm

Quote · 30 May 2011

Wonderful. That extra change for 7.06 did the trick. Thanks a lot prolaznik!

Quote · 30 May 2011

But what if you wish to have Featured Block show Random and Members Block show Latest ? The above does not work in 7.0.6

Quote · 16 Nov 2011

What about random for featured block in other modules!

Some mods allow to charge for featured status which can put a listing on the home page featured block. Only takes a few though so may not really give much 'featured' status...

 

Random option would be great site wide!

Quote · 16 Nov 2011
 
 
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.