0

this may be a dumb question im slightly new to EE and have read the docs for Solspace rating plugin. Basically I have a ratings for trainers. But the avatar being displayed is of the user id that i am on the {name} is fine is displaying the right name for this rating just the avatar is the same for all..

here is my code

{exp:rating:entries
    entry_id="{entry_id}"
    limit="10"
}

    <p>{review}</p>

    <ul>
        <p>{stars}{rating}{/stars}</p>

    {if screen_name}
    <h6>{name}</h6>

    {if avatar}
    <img src="{avatar_url}" width="{avatar_width}" height="{avatar_height}"  />
    {/if} 
    </ul>


    {if rating_no_results}
        <p>Sorry, no ratings have been submitted for this entry yet.</p>
    {/if}

{/exp:rating:entries}
1
  • 1
    Hi , I don't know if this related with your problem but I don't see a closed tag for {if screen_name} add it and check if your code works, and check the users avatars in your CMS to be sure it's difference.
    – Ahmad Saad
    Commented Mar 13, 2014 at 15:57

1 Answer 1

2

What you have is correct (unless you're missing the closing {/if} for the screen name check like Ahmad pointed out). However, I am assuming you have this Rating:Entries tag placed inside a Channel:Entries loop, within the same template?

If so, what's happening is that variables between the 2 tags are colliding, and you'll need to use an embed instead:

Main template:

{exp:channel:entries ...stuff... }
    <h2>{title}</h2>
    <p>{body}</p>
    {embed="path_to/embed_template" entry_id="{entry_id}"}
{/exp:channel:entries}

Embedded template:

{exp:rating:entries
    entry_id="{embed:entry_id}"
    limit="10"
}
    <p>{review}</p>
    <p>{stars}{rating}{/stars}</p>
    <h6>{name}</h6>
    {if avatar}
    <img src="{avatar_url}" width="{avatar_width}" height="{avatar_height}"  />
    {/if} 
    </ul>
    {if rating_no_results}
        <p>Sorry, no ratings have been submitted for this entry yet.</p>
    {/if}
{/exp:rating:entries}
2
  • That worked perfectly but now iv made it a bit tricky, I want to use my own custom fieldtype in my channel, how can I pull the images in this case? Commented Mar 19, 2014 at 23:52
  • Not sure what you mean. You want to use a custom field in {exp:channel:entries}? It should be as simple as calling its name, eg. {my_custom_channel_field}. For EE File Upload fields, you might want to read this documentation to display uploaded files/images in a channel entry: ellislab.com/expressionengine/user-guide/add-ons/channel/…
    – Solspace
    Commented Mar 20, 2014 at 5:48

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.