PDA

View Full Version : help with conditional


sabret00the
12-16-2005, 11:10 AM
if (!($group_info['leaderid'] == $vbulletin->userinfo['userid'] AND $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) AND !($vbulletin->bf_ugp['grpspermissions']['groupsmoderator']))
{
$mod_options = "
<form action=\"postings.php\" method=\"post\">
<strong>Moderation</strong>:
<select name=\"do\">
<option value=\"\" selected=\"selected\">----------</option>
<option value=\"cls\">Close Thread</option>
<option value=\"del\">Delete Thread</option>
<option value=\"stk\">" . (($group_info['stuck']) ? "Unstuck" : "Stick") . " Thread</option>
</select>
<input class=\"button\" id=\"inlinego\" type=\"submit\" value=\"Go\" />
<input name=\"threadid\" value=\"$t\" type=\"hidden\">
<input name=\"groupid\" value=\"$g\" type=\"hidden\">
<input name=\"url\" value=\"viewthread.php?g=$g&amp;t=$t\" type=\"hidden\">
</form>
";
}
else
{
$mod_options = FALSE;
}


the conditional is if your userid is the same as the leaderid AND you're usergroup permissions allow you to edit groups OR you're a groups moderator (as set within the usergroup options) then display the info, otherwise don't.

however i can't get this to work. what am i doing wrong?

Guest190829
12-16-2005, 06:50 PM
Try this....

if (($group_info['leaderid'] == $vbulletin->userinfo['userid'] AND $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) OR ($vbulletin->bf_ugp['grpspermissions']['groupsmoderator']))

sabret00the
12-17-2005, 09:45 AM
nope doesn't work, it's still showing up users it shouldn't do :(

sabret00the
12-18-2005, 04:13 PM
*bump*

sabret00the
12-20-2005, 12:46 AM
function display_mod_options($group_info)
{
global $vbulletin, $threadid, $groupid;

//if (!($group_info['leaderid'] == $vbulletin->userinfo['userid'] AND $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) AND !($vbulletin->bf_ugp['grpspermissions']['groupsmoderator']))
//if (($group_info['leaderid'] == $vbulletin->userinfo['userid'] AND $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) OR ($vbulletin->bf_ugp['grpspermissions']['groupsmoderator']))
//if ((($vbulletin->userinfo['userid'] == $group_info['leaderid']) AND $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) OR $vbulletin->bf_ugp['grpspermissions']['groupsmoderator'])
//if (($vbulletin->userinfo['userid'] == $group_info['leaderid'] AND $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) OR $vbulletin->bf_ugp['grpspermissions']['groupsmoderator'])
if (($vbulletin->userinfo['userid'] == $group_info['leaderid']) && ($vbulletin->bf_ugp['grpspermissions'] && $vbulletin->bf_ugp['grpspermissions']['groupspostedit']) || ($vbulletin->bf_ugp['grpspermissions'] && $vbulletin->bf_ugp['grpspermissions']['groupsmoderator']))
{

/*echo $vbulletin->userinfo['userid'] . "<br />";
echo $vbulletin->bf_ugp['grpspermissions']['groupspostedit'] . "<br />";
echo $vbulletin->bf_ugp['grpspermissions']['groupsmoderator'] . "<br />";*/

$mod_options = "
<form action=\"postings.php\" method=\"post\">
<strong>Moderation</strong>:
<select name=\"do\">
<option value=\"\" selected=\"selected\">Please Select An Option</option>
<option value=\"cls\">" . (($group_info['closed']) ? "Open" : "Close") . " Thread</option>
<option value=\"del\">Delete Thread</option>
<option value=\"stk\">" . (($group_info['stuck']) ? "Unstick" : "Stick") . " Thread</option>
</select>
<input class=\"button\" id=\"inlinego\" type=\"submit\" value=\"Go\" />
<input name=\"threadid\" value=\"$threadid\" type=\"hidden\">
<input name=\"groupid\" value=\"$groupid\" type=\"hidden\">
<input name=\"url\" value=\"viewthread.php?g=$groupid&amp;t=$threadid\" type=\"hidden\">
</form>
";
}
else
{
$mod_options = FALSE;
}

return $mod_options;
}
here's the full function, note all the failed conditonals commented out ;)