Creating a widget from the "Popular member" widget and want to append data from a custom field

StackOverflow https://stackoverflow.com/questions/15335890

  •  22-03-2022
  •  | 
  •  

Question

I am creating a widget to show most active viewers but want to also fetch a custom field by alias. I have the below in my .tpl:

<ul>
<?php foreach( $this->paginator as $mam_user ): ?>
    <div>
     <?php echo $this->htmlLink($mam_user->getHref(), $this->itemPhoto($mam_user, 'thumb.icon'), array('class' => 'popularmembers_thumb')) ?>
         <h3>
           <?php echo $this->htmlLink($mam_user->getHref(), $mam_user->getTitle()) ?>
         </h3>
         <?php
            // Fetches Fields from database by Alias
            $tagline = Engine_Api::_()->fields()->getFieldsValuesByAlias();
            echo $this->$mam_user->$tagline['tagline'];
         ?>
    </div>
<?php endforeach; ?>

I controller file is the same as that of the "Popular members" untouched.. but something seem not working here. I guess i'm doing something wrongly here. Any help pls..; and thanks in advance.

Was it helpful?

Solution

Your syntax isn't correct, try something like:

 $aliasValues = Engine_Api::_()->fields()->getFieldsValuesByAlias($mam_user);
 echo $aliasValues['profile_type']; // just for example
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top