How to bring back the man/woman avatars to 7.2

Someone may not like the default avatars the way they are implemented in 7.2

And they would want to bring back the avatars based on the gender.

So, here's my solution:

  1. First, get those default man/woman avatars from the original Dolphin 7.1.6 package. The location of the files is as follows: media/images/profile/man.jpg and media/images/profile/woman.jpg.

    Place them in the same folder in 7.2: media/images/profile (by default it should contain only .htaccess file).

       
  2. Now I suggest that you clone your favorite default template (EVO, ALT, or UNI) to avoid problems if you decide to upgrade your site to a later version:
       
    make a copy of the template's folder to be cloned (templates/tmpl_evo, templates/tmpl_alt, or templates/tmpl_uni) and give it a name of your choice, for example templates/tmpl_my (the tmpl_ part in the name should remain intact!);
       
    give your template the same name as in the name of the folder:
        open the file templates/tmpl_my/scripts/BxTemplName.php and set the values for the following variables: $sTemplName, $sTemplVendor and $sTemplDesc, for example:

                $sTemplName = 'MY';
                $sTemplVendor = 'ME';
                $sTemplDesc = _t('_adm_txt_templ_my_desc');
       
    now create the _adm_txt_templ_my_desc key in Admin Panel -> Settings -> Language Settings and set the strings for this key for all your installed languages;
       
    now create a preview image (normal size and twice as small size) for your template and upload it here: templates/tmpl_my/preview.png (twice as small size) and templates/tmpl_my/preview-2x.png (normal size);   
       
    now you should be all set up with your new custom template.

       
  3. Now you will need to clone and edit one PHP and one HTML file:
       
    copy the whole function getMemberThumbnail from the file templates/base/scripts/BxBaseFunctions.php into the file templates/tmpl_my/scripts/BxTemplFunctions.php:
           
        you need to copy the whole function signature and body, for example:

        function getMemberThumbnail($iId, $sFloat = 'none', $bGenProfLink = false, $sForceSex = 'visitor', $isAutoCouple = true, $sType = 'medium', $aOnline = array(), $sTmplSfx = '')
        {
            ...
        }

            ... - here and later indicates the omitted code
            the text in bold indicates the newly added code
            the text in italics indicates the code to be replaced
           
        paste this function in templates/tmpl_my/scripts/BxTemplFunctions.php in any place inside the class BxTemplFunctions, for example:
           
            ...
           
            function BxTemplFunctions()
            {
                parent::BxBaseFunctions();
            }

            function getMemberThumbnail($iId, $sFloat = 'none', $bGenProfLink = false, $sForceSex = 'visitor', $isAutoCouple = true, $sType = 'medium', $aOnline = array(), $sTmplSfx = '')
            {
                ...
            }
           
            ...

        now inside the pasted function you need to create a variable for the path of your default images:
           
            ...
           
            $sThumbSetting = getParam($sType == 'small' ? 'sys_member_info_thumb_icon' : 'sys_member_info_thumb');
            $sThumbManWoman = BX_DOL_URL_ROOT . 'media/images/profile/';
           
            ...
           
        now you need to replace the code that generates the avatar letter with the code which will insert the appropriate image:
       
            'bx_if:show_thumbnail_letter1' => array(
                'condition' => !$bThumb1,
                'content' => array(
                    'letter' => mb_substr($sUserTitle, 0, 1)
                )
            ),
           
            replace with:
           
            'bx_if:show_thumbnail_letter1' => array(
                'condition' => !$bThumb1,
                'content' => array(
                    'letter' => $sThumbManWoman . ($aProfile['Sex'] == 'female' ? 'woman.jpg' : 'man.jpg')
                )
            ),
           
        now copy the file templates/base/thumbnail_single.html and paste it into your template's folder: templates/tmpl_my/
       
        open the file and replace:

            <bx_if:show_thumbnail_letter1>
                <p class="thumbnail_image_letter bx-def-border bx-def-thumbnail bx-def-shadow">__letter__</p>
            </bx_if:show_thumbnail_letter1>

           
            with
           
            <bx_if:show_thumbnail_letter1>       
                <img src="__letter__" src-2x="__letter__" class="thumbnail_image_file bx-def-thumbnail bx-def-shadow bx-img-retina" />
            </bx_if:show_thumbnail_letter1>

       

           
Quote · 5 Oct 2015

Thank you for sharing this idea.

Baloo
Quote · 5 Oct 2015
 
 
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.