How to display user id in edit profile page

From aMember Pro Documentation
Revision as of 05:50, 18 March 2013 by Alexander (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add this code to /amember/application/configs/site.php

<?php
class Am_Form_Brick_UserId extends Am_Form_Brick 
{
    public function __construct($id = null, $config = null)
    {
        $this->name = ___('User ID (readonly)');
        parent::__construct($id, $config);
    }
 
    public function initConfigForm(Am_Form $form) {
        $form->addText('label')->setLabel(___('Label'));
    }
    public function insertBrick(HTML_QuickForm2_Container $form)
    {
        $data = array();
        $data['content'] = Am_Di::getInstance()->auth->getUserId();
        $data['label'] = $this->getConfig('label');
        $form->addStatic('user_id ', null, $data);
    }
 
    public function isMultiple()
    {
        return true;
    }
}


Then edit Profile form in aMember CP -> Forms Editor -> Edit Form and add User ID brick to profile form.