Load Referral Name - V4

Discussion in 'aMember Pro v.4' started by marcioarc, Oct 20, 2012.

  1. marcioarc

    marcioarc New Member

    Joined:
    Apr 17, 2010
    Messages:
    1
    Hello,
    Very simple question...

    I'm trying to load referral info using aff_id to show in users members area.

    Code was placed in main.phtml

    <?php
    $aff = Am_Di::getInstance()->userTable->load($member->aff_id);
    echo $aff->getName();
    ?>

    Its saying there was a problem to find info on database...

    Any ideas what could be wrong?

    Thanks

    marcioarc
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    try the following code and please always please copy/paste error messages!

    PHP:
    $di Am_Di::getInstance();
    // get aff_id of currently logged-in user
    $aff_id $di->auth->getUser()->aff_id;
    echo 
    "Aff#=$aff_id\n"// debug
    // try to load, second parameter allows to fail silently if record not found
    $aff $di->userTable->load->($di->auth->getUser()->aff_idfalse);
    if (
    $affprint_r($aff->toArray()); // debug
    echo $aff->getName();

Share This Page