Tutorial

This was originally posted in Boonex Unity Forums here:
http://www.boonex.com/forums/#topic/Age-v-Date-of-Birth.htm

It seems there was some confussion regarding this, and in case anyone missed it in the Boonex Unity Forums I thought I would write this up.

For those of you that are not sure how to edit the file for Date of Birth to Age you can  download it here for Dolphin 6.1.4
Download the Already Modded BxBaseProfileView.php
Download the Original Un-Modified BxBaseProfileView.php

*You will also need to add the language key: _Age with your Admin Panel.
--To do this login to your Admin Panel, go to the "Settings" then "Language Settings"
---Click on "Ad a new language key"
----New language key name: _Age
----Category: Profile Fields
----String text for available languages: Age
----Be sure the "Recompile language files to apply changes." box is checked
----Save Changes

Admin Panel Language Files

 

 

Add Age

 

For those of you that have made modifications to BxBaseProfileView.php prior to this you may need to review the code changes and make the necessary changes manually.

If you prefer to manually edit the file yourself you should first

make a back up of the original

/templates/base/scripts/BxBaseProfileView.php

 

Open this as a .txt(text file) for propper formating for easy copy and paste.

Then open the file /templates/base/scripts/BxBaseProfileView.php and find:

    function showBlockPFBlock( $sCaption, $sContent, $bNoDB = false ) {
        $iBlockID = (int)$sContent;
        if( !isset( $this -> aPFBlocks[$iBlockID] ) or empty( $this ->

aPFBlocks[$iBlockID]['Items'] ) )
            return '';
        $aItems = $this -> aPFBlocks[$iBlockID]['Items'];

        $sRet = '

';
       
        foreach( $aItems as $aItem ) {
            $sValue1 = $this -> oPF -> getViewableValue( $aItem, $this ->

_aProfile[ $aItem['Name'] ] );
            if( !$sValue1 ) //if empty, do not draw
                continue;
           
            $sRet .= ' ';
            $sRet .=         ' ';
           
            if( $this -> bCouple ) {
                if( in_array( $aItem['Name'], $this -> aCoupleMutualItems ) ) {
                    $sRet .= ' ';
                } else {
                    $sValue2 = $this -> oPF -> getViewableValue( $aItem,

$this -> _aCouple[ $aItem['Name'] ] );
                   
                    $sRet .= ' ';
                    $sRet .= ' ';
                }
            } else {
                $sRet .=     ' ';
            }
           
            $sRet .= ' ';
        }
       
        $sRet .= '
' . htmlspecialchars(

_t( $aItem['Caption'] ) ) . ':
'

. $sValue1 . '
' . $sValue1

. '
' . $sValue2

. '
' . $sValue1 .

'

';
       
        if ($bNoDB) {
            return $sRet;
        } else {
            echo DesignBoxContent( _t($sCaption), $sRet, 1 );
        }
    }




And replace with:

//start date of birth mod   

function showBlockPFBlock( $sCaption, $sContent, $bNoDB = false ) {
$iBlockID = (int)$sContent;
if( !isset( $this -> aPFBlocks[$iBlockID] ) or empty( $this -> aPFBlocks[$iBlockID]['Items'] )

)
return '';
$aItems = $this -> aPFBlocks[$iBlockID]['Items'];

$sRet = '

';

foreach( $aItems as $aItem ) {
$sValue1 = $this -> oPF -> getViewableValue( $aItem, $this -> _aProfile[ $aItem['Name'] ] );
if( !$sValue1 ) //if empty, do not draw
continue;

if($aItem['Name'] == "DateOfBirth")
{

$sRet .= ' ';
$sRet .= ' ';

$ageValue1 = age($sValue1);
if( $this -> bCouple ) {
if( in_array( $aItem['Name'], $this -> aCoupleMutualItems ) ) {
$sRet .= ' ';
} else {
$sValue2 = $this -> oPF -> getViewableValue( $aItem, $this -> _aCouple[ $aItem['Name'] ] );

$ageValue2 = age($sValue2);

$sRet .= ' ';
$sRet .= ' ';
}
} else {
$sRet .= ' ';
}

}else{

$sRet .= ' ';
$sRet .= ' ';

if( $this -> bCouple ) {
if( in_array( $aItem['Name'], $this -> aCoupleMutualItems ) ) {
$sRet .= ' ';
} else {
$sValue2 = $this -> oPF -> getViewableValue( $aItem, $this -> _aCouple[ $aItem['Name'] ] );

$sRet .= ' ';
$sRet .= ' ';
}
} else {
$sRet .= ' ';
}
}
$sRet .= ' ';
}

$sRet .= '
' . _t( "_Age" ) . ':' . $ageValue1 . '' . $ageValue1 . '' . $ageValue2 . '' . $ageValue1 . '
' . htmlspecialchars( _t( $aItem['Caption'] ) ) .

':
' . $sValue1 . '' . $sValue1 . '' . $sValue2 . '' . $sValue1 . '

';

if ($bNoDB) {
return $sRet;
} else {
echo DesignBoxContent( _t($sCaption), $sRet, 1 );
}
}

//end date of birth mod


Upload the already modded file to:
/templates/base/scripts/BxBaseProfileView.php
Over-writing the original.

*In your Dolphin Admin Panel "Builders" "Fields Builder" "View Profile" Date of Birth must be in the "Active Items" for a Member.

*If you do not have Date of Birth in the Active Items area you need to drag it up there. This mod is just changing there actual Date of Birth to Age

 

Fields Builder

 
Written By
Tutorial by: Jeremy LeSarge (AKA Ray)

I am the owner and administrator of DialMe.com. I write Tutorials for Boonex Dolphin as well as tips and resources surrounding website programming and development. I enjoy working with WordPress, SEO, and Web Hosting / Servers. I also maintain a WordPress Blog here on this site where you will find a variety of technology and webmaster resources.

Actions
Recommend
Sponsored Links