$pieceexists = $DB_site->query_first("
SELECT pieceid, userid, styleid ,catid, title, pagetext, dateline
FROM prs_pieces
WHERE pieceid = $p ");
$modificationperms = prs_can_moderate();
if (!$modificationperms)
{
echo $modificationperms;
die('you dont have permission');
}
unset($modificationperms);
and the function is
PHP Code:
function prs_can_moderate()
{
global $DB_site, $vboptions, $vbphrase, $bbuserinfo, $postownership, $pieceexists, $post;
if ($bbuserinfo['userid'] == $postownership['userid'])
{
$canmodit = TRUE;
}
if ($bbuserinfo['userid'] == $pieceexists['userid'])
{
$canmodit = TRUE;
}
if ($bbuserinfo['userid'] == $post['userid'])
{
$canmodit = TRUE;
}
if ($bbuserinfo['usergroupid'] == 6)
{
$canmodit = TRUE;
}