Hello Prometheus, thanks for your help !
I'm not a pro but i have tried a little bit more and got a solution that works, cause i want the "featured" and the "premium" profiles to be shown in the same box. The visitor should not see any difference !
- I have created a new admin field
PHP Code:
$premium_num = getParam('premium_num');
INSERT INTO `GlParams` VALUES ('premium_num','4',0,'Number of premium members displayed on front page','digit','return $arg0 >= 0;','must be equal to or greater than zero.',NULL);
(Also some changes in global_settings.php)
- Changed the database querys like this
PHP Code:
if ( $feature_num || $premium_num )
{
$featured_res = db_res( "SELECT `Profiles`.`ID`,
`Pic_0_addon`,
`ProfileType`,
`NickName`,
`Headline`,
`Sex`,
`Sex2`,
`Country`,
`DateOfBirth`,
`DateOfBirth2`
FROM `Profiles`
WHERE `Status` = 'Active'
AND `Featured` = '1'
ORDER BY RAND() LIMIT $feature_num" );
$premium_res = db_res( "SELECT `ProfileMemLevels`.`IDMember`,
`ProfileMemLevels`.`IDLevel`,
`Profiles`.`ID`,
`Profiles`.`NickName`,
`Profiles`.`DateOfBirth`,
`Profiles`.`ProfileType`,
`Profiles`.`Headline`,
`Profiles`.`DateOfBirth`,
`Profiles`.`DateOfBirth2`,
`Profiles`.`Sex`,
`Profiles`.`Sex2`,
`Profiles`.`Country`,
`Profiles`.`Pic_0_addon`
FROM `ProfileMemLevels`
LEFT JOIN `Profiles` ON Profiles.ID = IDMember
WHERE `Status` = 'Active'
AND `IDLevel` = '4'
ORDER BY RAND() LIMIT $premium_num");
(I hope this is the right way, perhaps somebody can confirm it ?)
- And the changes for display on index page
PHP Code:
$ret = "";
$sum_featured_res = mysql_num_rows( $featured_res );
$sum_premium_res = mysql_num_rows( $premium_res );
if(( $sum_featured_res + $sum_premium_res ) > 0 )
{
$j=1;
###############################################################################
while( $premium_arr = mysql_fetch_assoc( $premium_res ) )
{
if ( $p_arr['ProfileType'] == "couple")
{
$age1_str = _t("_y/o", age( $premium_arr['DateOfBirth'] ));
$age2_str = _t("_y/o", age( $premium_arr['DateOfBirth2'] ));
$y_o_sex = $age1_str ._t('_'.$premium_arr['Sex']) .'; '. $age2_str ._t('_'.$premium_arr['Sex2']);
$y_o_2 = $age1_str .'/ '. $age2_str ;
$sex2 = _t('_'.$premium_arr['Sex']) .'/ '._t('_'.$premium_arr['Sex2']);
}
else
{
$age_str = _t("_y/o", age( $premium_arr['DateOfBirth'] ));
$y_o_sex = $age_str . ' ' . _t("_".$premium_arr['Sex']);
$y_o_2 = $age_str ;
$sex2 = _t("_".$premium_arr['Sex']);
}
$featured_coutry = _t("__".$prof['countries'][$premium_arr['Country']]);
if( $j%2 == '0' )
{
$style_add = 'style="border:none; left:14px; width:140px;"';
}
else
{
$style_add = '';
}
$ret .= '<div class="featured_block" ' . $style_add . '>';
$ret .= get_member_thumbnail( $premium_arr['ID'], left );
$ret .= '</div>';
$j++;
}
###############################################################################
while( $featured_arr = mysql_fetch_assoc( $featured_res ) )
{
if ( $p_arr['ProfileType'] == "couple")
{
$age1_str = _t("_y/o", age( $featured_arr['DateOfBirth'] ));
$age2_str = _t("_y/o", age( $featured_arr['DateOfBirth2'] ));
$y_o_sex = $age1_str ._t('_'.$featured_arr['Sex']) .'; '. $age2_str ._t('_'.$featured_arr['Sex2']);
$y_o_2 = $age1_str .'/ '. $age2_str ;
$sex2 = _t('_'.$featured_arr['Sex']) .'/ '._t('_'.$featured_arr['Sex2']);
}
else
{
$age_str = _t("_y/o", age( $featured_arr['DateOfBirth'] ));
$y_o_sex = $age_str . ' ' . _t("_".$featured_arr['Sex']);
$y_o_2 = $age_str ;
$sex2 = _t("_".$featured_arr['Sex']);
}
$featured_coutry = _t("__".$prof['countries'][$featured_arr['Country']]);
if( $j%2 == '0' )
{
$style_add = 'style="border:none; left:14px; width:140px;"';
}
else
{
$style_add = '';
}
$ret .= '<div class="featured_block" ' . $style_add . '>';
$ret .= get_member_thumbnail( $featured_arr['ID'], left );
$ret .= '</div>';
$j++;
}
###############################################################################
}
else
{
$ret .= '<div class="no_result">';
$ret .= '<div>';
$ret .= _t("_No results found");
$ret .= '</div>';
$ret .= '</div>';
}
}
return DesignBoxContent( _t("_featured members"), $ret, $oTemplConfig -> PageCompFeatured_db_num );
}
Or does anybody has got a better idea ?
Bookmarks