0

I'm having a bit odd issue with channel:entry tag when using it inside friends:mine loop. Have tried both ways, using channel:entry tag within and embedded. When using entry tag within friends:mine it shoots entries if available but no_results does not work. When I use it via embed, it then does not parse friends_member_id and all friends gets "no results".

Here is the code:

{exp:friends:mine reciprocal="y" orderby="screen_name" dynamic="no" sort="asc" limit="5" paginate="bottom"}

    ...some common html and friends single variables here...

    {exp:channel:entries channel="luontopalvelut" author_id="{friends_member_id}" status="closed|open|featured|premium" dynamic="no" limit="15" disable="pagination"}

        ....channel entry title and other stuff....

        {if no_results}blaa that does not parse when there is no entries for the this member{/if}
    {/exp:channel:entries}

    ...yet some html....

    {if friends_no_results}<li>No available contacts for this person yet.</li>{/if}

    {friends_paginate}<li>Page {friends_current_page} / {friends_total_pages} page{if friends_total_pages > "1"}s{/if}{if friends_pagination_links} &nbsp; | &nbsp; {friends_pagination_links}{/if}</li>{/friends_paginate}

{/exp:friends:mine}

Using the channel entry tag via embed gives no results to all (because the author_id="friends_member_id does not parse, and using the channel entry straight inside friends:mine stops no_results variable from working.

Ideas? Thank you.

2 Answers 2

0

You look to be having a parse order issue, try adding parse="inward" to your {exp:friends:mine} tag.

See this answer for more in depth about parse order : Using Plugin Tags Within Channel Tags

Also, try echoing out {friends_member_id} just to ensure you're getting at least one good member ID, and of course check you have a 'recipricated' friend!

Edit 1 : Even Embedded Templates dont work?!?!

I'm confused by your last comment, you seem to be implying that while member ID's are populated they are not droperly populated / parsed wayyyy later than they should be? Particularly the embeds, because embeds are parsed much later than most things they are useful for these cases, can you confirm the below example please:

{exp:friends:mine reciprocal="y" dynamic="no"}

<p>Inside the friends lop member ID is : {friends_member_id}</p>
{embed="test/template" passedId="{friends_member_id}"}

{/exp:friends:mine}

It's a much simplified version, inside the test/template template (put it where you will) :

Php ON : Input

<?php $passedStr = "{embed:passedId}"; ?>
<?php $passedStr = str_replace(array('{','}'), array("&#123;","&#125;"), $passedId);
<p>The ID passed to an embedded template is : <?php echo $passedStr; ?></p>

What we are doing here is testing the parse order, what we expect is (assuming the friend is ID of 11 & 12) :

Inside the friends lop member ID is : 11
The ID passed to an embedded template is : 11
Inside the friends lop member ID is : 12
The ID passed to an embedded template is : 12

if we are getting any sort of tags displayed on the output, please share what you get, it will indicate where the parse order much up is...

5
  • Did try that already but no success.
    – Riverboy
    Commented May 11, 2015 at 10:08
  • And you checked that {friends_member_id} is outputting a value?? Also, you've checked that the friend has authored a value entry in the channel right? (Sorry for simple questions, you know we have to chekc all these little tings :) )
    – Blatant
    Commented May 11, 2015 at 10:35
  • Yeah. I have 2 dummy acc's, other has 2 entries, other none. Template debugging does confirm the right ID for both in author_id. Also did try several embedded variations but they all gives "no results" all the time :)
    – Riverboy
    Commented May 11, 2015 at 10:40
  • Little note: turn PHP on input, and start var_dump("{friends_member_id}"); in every scope of your loops and template embeds...
    – jrothafer
    Commented May 11, 2015 at 12:18
  • That too ;) morning jChrono!
    – Blatant
    Commented May 11, 2015 at 14:50
0

Solution was/is as simple as I thought it has to be. Got a reminder from Solspace about how I handle me embeds - wrong way of course because it was not working heh.

Anycase this will work just fine without any extra hassle(thanks Kelsey for pointing out my idiotism again hehe):

Main template:

{exp:friends:mine reciprocal="y" orderby="screen_name" dynamic="no" sort="asc" limit="5" paginate="bottom"} ...Some common content.... {embed="path_to/embed" author_id="{friends_member_id}"} ...some other content.... {/exp:friends:mine}

Embedded template:

{exp:channel:entries channel="luontopalvelut" author_id="{embed:author_id}" status="closed|open|featured|premium" dynamic="no" limit="15" disable="pagination"} ...stuff here... {/exp:channel:entries}

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.