Fork me on GitHub

Small PHP code help  Bottom

  • Hey guys, I have a favor to ask someone. I really don't know PHP enough to write this block, but was hoping someone out there could give me a hand. I have the "pStaffStatusLite" block on my site, and I want to change something on it. looking over teh block I see where it makes a call to add a flag by a username based on their ip address. I would like to chanfe this to show a picture for a special group of users.

    Basically I've made a new group and put users into that group. I have a small image that I want displayed next to the neames of the users in that group. what I don't know is how to write the PHP code to make that work.

    I know what I need it to do,

    if user is in group 3 then dispaly image "X" else display image "Y"

    but I don't know how to make the PHP do it :(

    please don't flame me or tell me to read a book, I'm working on it :)
  • Quote

    if user is in group 3 then dispaly image "X" else display image "Y"


    Code

    //$groupid is the variable used for group, you must find the correct variable in the script and just replace it
    $Y = "xxxxxx"; // image X
    $X = "xxxxxx"; // image Y

    if ($groupid == 3){
    $img = $X;
    } else {
    $img = $Y;
    }

    // Just remember that in this way it will only show X if there is a match, else it would use Y (for un-reg and all other ids different than 3.


    Some might drop in a fancier way of doing it.. so I will save their time:

    Code

    echo "<img src="path/". ($groupid==3 ? "y" : "x"). ".gif";
  • awsome thanks!

This list is based on users active over the last 60 minutes.