First name for member dashboard in place of username

Discussion in 'Customization & add-ons' started by siteprowizard, Jan 16, 2017.

  1. siteprowizard

    siteprowizard New Member

    Joined:
    Dec 5, 2016
    Messages:
    1
    I asked this question via support...
    where do i access or how can i change it so that the first name displays on the member dashboard instead of the username?

    and was given this code to add to the site.php file - but it causes the page to be blank
    --------------------------------

    Am_Di::getInstance()->blocks->remove('member-identity');
    Am_Di::getInstance()->blocks->add(new Am_Block('member/identity', null, 'member-identity-custom', null,
    function(Am_View $v){
    $name = Am_Html::escape($v->di->user->getName());
    $url = Am_Di::getInstance()->url('logout');
    $url_label = Am_Html::escape(___('Logout'));
    return <<<CUT
    <div class="am-user-identity-block">
    $name <a href="$url">$url_label</a>
    </div>
    CUT;
    }));

    ----------------------

    need some help with this
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    1,669
    The code is correct but it rely on feature that is not exists in current version.
    So change it to:
    PHP:
    Am_Di::getInstance()->blocks->remove('member-identity');
    Am_Di::getInstance()->blocks->add(new Am_Block('member/identity'null'member-identity-custom'null,
        function(
    Am_View $v){
                    
    $name Am_Html::escape($v->di->user->getName());
                    
    $url REL_ROOT_URL '/logout';
                    
    $url_label Am_Html::escape(___('Logout'));
                    return <<<CUT
    <div class="am-user-identity-block">
        
    $name <a href="$url">$url_label</a>
    </div>
    CUT;
                }));

Share This Page