Members with avatars only on homepage

Hi.

I don't know shared this somebody or not.

I made it to show only members with avatars on homepage in members block (look at screenshots).

Open your /template/base/scripts/BxBaseIndexPageView.php and find

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

change it to:

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

then find:

$sMode = 'last';
        } else {
            $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'last';
        }
    (line 351)

and change to:

$sMode = 'avatar';
        } else {
            $sMode = (in_array($_GET[$sBlockName . 'Mode'], $aModes)) ? $_GET[$sBlockName . 'Mode'] : $sMode = 'avatar';
        }

then find:

case 'last':   (line 365)

and place just above:

case 'avatar':
                    if ($sMode == $sMyMode) {
                        $sqlCondition .= " AND `Profiles`.`Avatar` <> 0";
                        $sqlOrder = " ORDER BY `Profiles`.`Couple` ASC, `Profiles`.`DateReg` DESC";
                    }
                    $sModeTitle = _t('__Avatar');
                break;

And don't forget to add key '__Avatar' into your lang file with discription "with photos" (or smething alike)

w avatars.jpg · 283.8K · 290 views
without avatars.jpg · 270.6K · 283 views
Quote · 4 Jan 2012

Very nice mod

Was looking for these

Thanks

Quote · 17 Jan 2012

This is out standing. Thank you.

 

Do you know how to update all profiles that do not have an avatar to the first picture in there album?

Quote · 3 Apr 2012

For those annoying members that don't want to upload an avatar, I have created the following mod that emails them every 2 days to remind them they haven't uploaded an avatar. 

Run the following 2 sql queries to add information to your database

INSERT INTO `sys_cron_jobs` (`name`, `time`, `class`, `file`, `eval`) VALUES  ('avatar_upload_reminder', '0 1 * * *', '', '', '$iPeriod = $GLOBALS[''MySQL'']->getParam(''remind_avatar_period''); \n$aProfilesAvatar = $GLOBALS[''MySQL'']->getAll("SELECT `ID` FROM `Profiles` WHERE `Avatar` = ''0''  AND (TO_DAYS(NOW()) - TO_DAYS(`DateReg`)) % {$iPeriod} = 0"); foreach ($aProfilesAvatar as $aProfile) avatar_mail($aProfile[''ID''], 0);

INSERT INTO `sys_email_templates` (`Name`, `Subject`, `Body`, `Desc`, `LangID`) VALUES ('t_AvatarReminder', 'Missing Avatar', '<html><head></head><body style="font: 12px Verdana; color:#000000">
<p><b>Dear <RealName></b>,</p>);

INSERT INTO `sys_options` (`Name`, `VALUE`, `kateg`, `desc`, `Type`, `check`, `err_text`, `order_in_kateg`, `AvailableValues`) VALUES
('remind_avatar_period', '2', 15, 'Time period for sending reminders about no Avatar (in days)', 'digit', '', '', 28, '')


This is just a friendly reminder that you have not yet added an Avatar on <SiteName>.<br>\r\n
You can <ClickHere> to add your Avatar.<br><p>--</p>

<p style="font: bold 10px Verdana; color:red"><SiteName> mail delivery system!!!\r\n<br>
<br />Auto-generated e-mail, please, do not reply!!!</p></body></html><font size="4">\r\n', 'Avatar Missing', 0)

add this to inc/admin.inc

function avatar_mail( $ID, $text = 1 ) {
    global $ret;

    $ID = (int)$ID;
    $p_arr = db_arr( "SELECT `Email`, 'NickName' FROM `Profiles` WHERE `ID` = '$ID'" );
    if ( !$p_arr ) {
        $ret['ErrorCode'] = 7;
        return false;
    }

    $rEmailTemplate     = new BxDolEmailTemplates();
    $aTemplate         = $rEmailTemplate -> getTemplate( 't_AvatarReminder' ) ;   
    $aPlus             = array();   
    $recipient          = $p_arr['Email'];
    $aPlus['SiteName']  = $GLOBALS['site']['title'];
    $aPlus['RealName']  = $p_arr['NickName'];
    $aPlus['Subject']   = $aTemplate['Subject'];
    $aPlus['ClickHere'] = '<a href="' .BX_DOL_URL_ROOT . 'm/avatar">Click Here</a>';
    $aPlus['SiteLink']  = '<a href="' . BX_DOL_URL_ROOT . '">'. $GLOBALS['site']['title'] . '</a>';
    $aPlus['Subject']   = $aTemplate['Subject'];

    $mail_ret = sendMail( $recipient, $aTemplate['Subject'], $aTemplate['Body'], $ID, $aPlus, 'html', false, true );

    return ($text) ? $page_text : true;
}

This will give you an option in your admin panel to control how many days it waits to email them.

if the SQL query gives you an error,check the syntax as I am headed out the door to go to my step dad's funeral, I just wanted to get this out here for you guys.

 

 

http://www.mytikibar.com
Quote · 4 Apr 2012
 
 
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.