graham23s Posted May 21, 2007 Share Posted May 21, 2007 Hi Guys, on a users profile page i was going to add an edit post button (only for moderator and above to see) if the users class isn't mod or admin then echo no edit button, but it isn't going to plan heres my coding: while ($row_display = mysql_fetch_array($result5)) { $post_id = $row_display['id']; $user_id = $row_display['user_id']; $user_comments = $row_display['comment']; $post_date = $row_display['date_added']; // get the usernames and links.../////////////////////////////////////////////////// $query6 = "SELECT * FROM `membership` WHERE `id`='$user_id'"; $result6 = mysql_query($query6); $row = mysql_fetch_array($result6); $poster_id = $row['id']; $poster_name = $row['username']; $poster_avatar = $row['avatar']; $poster_class = $row['user_class']; // start making a table:)...//////////////////////////////////////////////////////// echo '<table width="500" border="1" bordercolor="#000000" cellspacing="2" cellpadding="2" /> <tr> <td colspan="2" align="left" /> <a href="user_details.php?id='.$poster_id.'" />'.$poster_name.'</a> - (<b>'.$poster_class.'</b>) - <font size="1" />Posted On: '.$post_date.'</font> '; // if the user class fits echo edit button etc...///////////////////////////// if($poster_class != "Moderator" && $poster_class != "Administrator") { echo "Can't Edit Wrong UserClass!"; #################### } else { #################### echo "<font size=\"1\">[<a href=\"mod_edit_comments.php?id=$post_id\"/><font color=\"red\" />EDIT</font></a>]"; } echo ' </td> </tr> <tr> <td width="150" align="center" /><img src="avatars/'.$poster_avatar.'" /></td><td width="350" align="left" valign="top"/>'.$user_comments.'</td> </tr><br />'; } echo '</table><br />'; } else { echo "<b>No Comments Have Been Added Yet!</b><br /><br />"; } thanks for any help guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/52407-solved-getting-user-class/ Share on other sites More sharing options...
MadTechie Posted May 21, 2007 Share Posted May 21, 2007 isn't going to plan is hardly a description of a problem! Quote Link to comment https://forums.phpfreaks.com/topic/52407-solved-getting-user-class/#findComment-258626 Share on other sites More sharing options...
AndyB Posted May 22, 2007 Share Posted May 22, 2007 if($poster_class != "Moderator" && $poster_class != "Administrator") { Think about that logic for a moment. If I'm a moderator it will fail because I'm not also an admin and vice versa. What you want is if I'm a moderator OR an administrator then show the edit link. Quote Link to comment https://forums.phpfreaks.com/topic/52407-solved-getting-user-class/#findComment-258874 Share on other sites More sharing options...
graham23s Posted May 22, 2007 Author Share Posted May 22, 2007 Hi Guys, Sorry i forgot i posted this link, unlike me. yep i could have phrased it a lot better ultimately the link wasn't showing but as Andy has said i should have used OR instead of AND. Thanks again guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/52407-solved-getting-user-class/#findComment-259247 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.