I'd like to output a list of ONLY the friends of the current logged in member who have favorited the entry being viewed (single entry page).

I'm sure this can be done by passing embeds of one module results down to another, but if anyone has accomplished this more easily before I'd love to hear suggestions.


2 Answers 2


I happen to have the Friends mod file open in my editor. It appears that the friend_id parameter of the Mine tag can accept a pipe separated list. Looking at the documentation, this would be an undocumented feature. There may be something I'm missing and this actually won't work, but you can try it.

{embed="foo/bar" members="{exp:favorites:members}{member_id}|{/exp:favorites:members}"}

Then in the embed template...

{exp:friends:mine friend_id="{embed:members}"} content {/exp:friends:mine} 

Of course, make sure you add the other parameters you need, but that should give you the basic gist.

Edit: I ran a quick test on the components I wasn't sure about (parse order, multiple ID's separated by pipes and having a trailing pipe in the list) and each seemed to work fine. I couldn't do a full test because I don't have the Reviews module. But I'm confident this will work.

  • Sounds like a good alternative solution. Thanks!
    – Solspace
    Sep 5, 2013 at 20:36

The quick-and-dirty way is to run {exp:favorites:members} to get members who favorited an entry first, then feed those {member_id}s in {exp:friends:mine} to check if that member is a friend:

{exp:favorites:members entry_id="{segment_3}"}
    {exp:friends:mine friend_id="{member_id}"}
        {if friends_no_results}{/if}
        [{member_id}] {screen_name}<br />

However, the above won't work because the [{member_id}] would parse when {exp:favorites:members} it encountered, not when {exp:friends:mine} is encountered. In that case, embedding the {exp:friends:mine} part could work, but can potentially create a lot of embeds at each looping of {exp:favorites:members}, which would degrade performance.

Although this might be possible with plugins such as Stash, you could use PHP to create a string of member_ids that favorited the entry, pass this single string of data into a single embed, and use PHP in the embed to break up the string into individual member_ids again.

For example, in your template, you would set PHP to Output and build the member_id string like this:

<?php $member_ids = '';?>

   <?php $member_ids .= '{member_id}|'; ?>

{!-- This removes the pending pipe character --}
<?php $member_ids = rtrim($member_ids, '|'); ?>

{embed="friends/list" member_ids="<?php echo $member_ids; ?>"}

Then, in your embed (friends/list here), break up the pipe-delimited string of member_ids and cycle through them in {exp:friends:mine}. PHP on Output would probably do here:

<h1>Friends who favorited the entry:</h1>

<?php $member_ids = explode('|', '{embed:member_ids}'); ?>

{exp:friends:mine member_id="CURRENT_USER"}
  <?php foreach($member_ids as $member_id) :?>
    <?php if( $member_id == '{member_id}' ) :?>

       [{member_id}] {screen_name}<br />

    <?php endif ?>
  <?php endforeach ?>

You could do the foreach() loop outside of the {exp:friends:mine} tag pair and feed member_ids individually, but this would call the {exp:friends:mine} tag multiple times. The above approach would call {exp:friends:mine} once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.