Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: BigGunn - tammikuu 08, 2006, 06:50:44 IP

Otsikko: new to coding and need a little bit of help
Kirjoitti: BigGunn - tammikuu 08, 2006, 06:50:44 IP
I'm altering a mod that I installed to make it so that global mods can see all hidden posts without replying. I have it set so admins can, and i added a bit of code that worked to make it so that moderators can see the hidden content without replying if it's posted in the forum they moderate.

Here's the original code before I changed it at all:

// Find if there a post from you in this thread :) (For the hide tag)
if ($user_info['is_admin'] && !empty($modSettings['hide_adminshouldsee']))
$context['user_post_avaible'] = 1;
elseif (!$user_info['is_guest']) {
$request = db_query("
SELECT ID_MSG, ID_MEMBER
FROM {$db_prefix}messages
WHERE ID_TOPIC = $topic AND ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);

if (mysql_num_rows($request)) $context['user_post_avaible'] = 1;
else $context['user_post_avaible'] = 0;
mysql_free_result($request);
}
else $context['user_post_avaible'] = 0; //Anyway no way you should see it!


I've since changed it to this:

// Find if there a post from you in this thread :) (For the hide tag)
if ($user_info['is_admin'] && !empty($modSettings['hide_adminshouldsee']))
$context['user_post_avaible'] = 1;
elseif ($user_info['is_gmod'] && !empty($modSettings['hide_adminshouldsee']))
$context['user_post_avaible'] = 1;
elseif ($user_info['is_mod'] && !empty($modSettings['hide_adminshouldsee']))
$context['user_post_avaible'] = 1;
elseif (!$user_info['is_guest']) {
$request = db_query("
SELECT ID_MSG, ID_MEMBER
FROM {$db_prefix}messages
WHERE ID_TOPIC = $topic AND ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);

if (mysql_num_rows($request)) $context['user_post_avaible'] = 1;
else $context['user_post_avaible'] = 0;
mysql_free_result($request);
}
else $context['user_post_avaible'] = 0; //Anyway no way you should see it!


Any help would be greatly appreciated.
Otsikko: Re: new to coding and need a little bit of help
Kirjoitti: BigGunn - tammikuu 09, 2006, 04:26:38 AP
Issue was resolved here[/hide].

This can be locked or deleted now. Thank you. (http://www.simplemachines.org/community/index.php?topic=32954)