We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33033
    • 43 Posts
    Using PHx custom modifiers you can make a User Rating modifier to output images based on post count. Make a snippet named phx:rating and save the following code. This is an extremely simple example, 1 post = , 2 posts = , 3 posts = , 4+ posts =
    <?php
    $defaultValue = " <img src=assets/images/icons/star.png  />";
    
    
    if (intval($output) <= '1') {
    $newvalue =  '<img src=assets/images/icons/bronze.png  />';
    } 
    
    elseif (intval($output) <= '2') {
    $newvalue = '<img src=assets/images/icons/silver.png   />';
    }
    
    elseif (intval($output) <= '3') {
    $newvalue = '<img src=assets/images/icons/gold.png   />';
    }
    
    else {
    $newvalue =  $defaultValue;
    }
    return $newvalue;
    ?>


    In your Jot template add
    [+comment.userpostcount:rating+]
    where you want the rating.
      • 4195
      • 398 Posts
      Nice and thanks you for contributing smiley
        Armand Pondman
        MODx Coding Team
        :: Jot :: PHx
        • 25991
        • 13 Posts
        Thanks a lot for this contribution, it works like a charm grin

        King regards.
        Nathalie