by JacquesPrevert » Sat Oct 24, 2009 11:04 am
Hi Praveen.
I wnat to set the default to random and within random only show pictures with avatars. If a member clicks onthe LATEST tab, I want to show all pictures, whether they are avatars or the dolphin-issued grey face.
I've set the default to random, but have not been able to get past that. My experimenting with your latest instructions have not been greatly successful. There are four lines of code which include "ORDER BY". Which line is it?
Thanks again for all your help.
function getBlockCode_Members() {
global $tmpl;
// number of profiles
$max_num = (int) getParam( "top_members_max_num" );
// Get Sex from GET data
if ( $_GET['Sex'] && $_GET['Sex'] != "all" ) {
$sex = process_db_input( $_GET['Sex'] );
$query_add = " AND `Sex` = '$sex'";
} else {
$sex = "all";
$query_add = "";
}
$query_add .= ' AND (`Couple`=0 OR `Couple`>`ID`)';
$query = "
SELECT
`Profiles`.*
";
if ( $_GET['members_mode'] == 'online' or
$_GET['members_mode'] == 'rand' or
$_GET['members_mode'] == 'last' or
$_GET['members_mode'] == 'top' )
$mode = $_GET['members_mode'];
else
$mode = 'rand';
$aDBTopMenu = array();
//$menu = '<div class="dbTopMenu">';
foreach( array( 'last', 'top', 'online', 'rand' ) as $myMode )
{
switch ( $myMode )
{
case 'online':
if( $mode == $myMode )
$filter = " FROM `Profiles` WHERE `DateLastNav` > SUBDATE(NOW(), INTERVAL ".(int)getParam( "member_online_time" )." MINUTE) AND `Status` = 'Active' $query_add ORDER BY `Couple` ASC";
$modeTitle = _t('_Online');
break;
case 'rand':
if( $mode == $myMode )
$filter = " FROM `Profiles` WHERE `Status` = 'Active' $query_add ORDER BY `Couple` ASC, RAND()";
$modeTitle = _t('_Random');
break;
case 'last':
if( $mode == $myMode )
$filter = " FROM `Profiles` WHERE `Status` = 'Active' $query_add ORDER BY `Couple` ASC, `DateReg` DESC";
$modeTitle = _t('_Latest');
break;
case 'top':
if( $mode == $myMode )
{
$oVotingView = new BxTemplVotingView ('profile', 0, 0);
$aSql = $oVotingView->getSqlParts('`Profiles`', '`ID`');
$sqlOrderBy = $oVotingView->isEnabled() ? " ORDER BY `Couple` ASC, (`pr_rating_sum`/`pr_rating_count`) DESC, `pr_rating_count` DESC, `DateReg` DESC" : $sqlOrderBy ;
$sqlFields = $aSql['fields'];
$sqlLJoin = $aSql['join'];
$filter = "$sqlFields FROM `Profiles` $sqlLJoin WHERE `Status` = 'Active' AND `pr_rating_count` > 2 $query_add $sqlOrderBy";
$filter2 = " FROM `Profiles` $sqlLJoin WHERE `Status` = 'Active' AND `pr_rating_count` > 2 $query_add $sqlOrderBy";
}
$