V4.1.x Rating Module v1.7.1 - disabling self rating?

Discussion in 'Modules / Plugins / Modifications' started by John_6x6, Sep 17, 2010.

  1. John_6x6 Customer

    Using rating module v1.7.1 and developer v4.1.10 with default theme.

    Question: during checkout in "step7.tpl" file, or while the ad poster is viewing their own listing, I noticed this module (I think) allows the user to give themselves a rating. How can I disable the logged-in ad poster from rating themselves? I only want guest to be able to rate the listings. Both files call on: {include file="viewlisting.tpl"} - the place the rating module code is added.
    Thanks! By the way, other than this, the module works great!
  2. Mike-N-Tosh Developer & Moderator

    What? You don't like cheaters?

    That's a very interesting catch there. What I would do is modify the listing_rating.tpl file in the module itself and use smarty to hide these lines starting around line 23:
    HTML:
    <tr>
    	<td class="formstrip" colspan="3" align="center"><a href="javascript:writereview()">{$smarty.const.LANG_WRITE_REVIEW}</a></td>
    </tr>
    
    I didn't test this or check to see if the these are the right variables and checks, you'll need to use the smarty debug to verify, but this should get you going in the right direction.
    HTML:
    {if $template ne "step7.tpl" || $smarty.session.username ne $l_UserName}
    <tr>
    	<td class="formstrip" colspan="3" align="center"><a href="javascript:writereview()">{$smarty.const.LANG_WRITE_REVIEW}</a></td>
    </tr>
    {else}
    {/if}
    
    That should prevent the link from showing. The first part of the if will check if they are in checkout and the second part will check their username (if logged in) against the seller's name if they are just viewing the listing.
  3. John_6x6 Customer

    Sweet! I'll give it a shot and report back. Thanks for the quick response.
  4. John_6x6 Customer

    Well, not sure how to utilize debug but I did add {debug} to the layout.tpl and activated the module but have no clue what it is showing me. I added your suggested smarty code as shown above but as you said, it may not work. It doesn't. Don't know what to do next. Any ideas?
  5. John_6x6 Customer

    Works like a champ! Thank you so much, Mike. For anyone else needing this, here's the code to insert into the listing_rating.tpl files located within the rating module's template folder - on or about line #23:

    HTML:
    {if $smarty.session.username ne $username}
         <tr>
             <td class="formstrip" colspan="3" align="center"><a href="javascript:writereview()">{$smarty.const.LANG_WRITE_REVIEW}</a></td>
        </tr>
        {/if}
    Mike, you're a true professional. Thanks again.

Share This Page