Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: SONSiVRi on September 04, 2008, 11:48:18 PM

Title: IP View Permission
Post by: SONSiVRi on September 04, 2008, 11:48:18 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=1378)

Brief:

Moderate forum members (Original permission):

Moderate (Limited) forum members (New permission):

Version Info:

How To Use:

How To Install:

How To Upgrade:

Note:

Version History:
Title: Re: IP View Permission
Post by: Kimojuno on September 25, 2008, 03:18:19 PM
I might be missing something here, but while looking over your code I found some things that made me unsure.

Original:


// Being news, this actually makes sense in rss format.
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum')) ? null : $row['posterEmail'],


Your change:


// Being news, this actually makes sense in rss format.
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.0',
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !(allowedTo('moderate_forum') || allowedTo('moderate_forum2'))) ? null : $row['posterEmail'],


Any reason why allowedTo('moderate_forum2'))) is not !allowedTo('moderate_forum2')) ? The reason I ask is because I notice the moderate_forum begins with an '!' yet the moderate_forum2 does not. I went over that field and it seems (at least from studying it for a few moments) that it is unsetting/not allowing those properties (as 'the is_guest' makes it look like that is for guests). I could be wrong here but wanted to check before using this.

-------

Original:


// Doesn't work as well as news, but it kinda does..
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !allowedTo('moderate_forum')) ? null : $row['posterEmail'],


Your change:


// Doesn't work as well as news, but it kinda does..
if ($xml_format == 'rss' || $xml_format == 'rss2')
$data[] = array(
'title' => cdata_parse($row['subject']),
'link' => $scripturl . '?topic=' . $row['ID_TOPIC'] . '.msg' . $row['ID_MSG'] . '#msg' . $row['ID_MSG'],
'description' => cdata_parse($row['body']),
'author' => (!empty($modSettings['guest_hideContacts']) && $user_info['is_guest']) || (!empty($row['hideEmail']) && !empty($modSettings['allow_hideEmail']) && !(allowedTo('moderate_forum') || allowedTo('moderate_forum'))) ? null : $row['posterEmail'],


Shouldn't the second 'moderate_forum' be 'moderate_forum2'?

Also, same questions as above.

Don't get me wrong, I love the idea but I wanted to ask.

Thank you for writing for and sharing with the community,
Jeffrey.
Title: Re: IP View Permission
Post by: SONSiVRi on September 25, 2008, 03:43:58 PM
Thanks Jeffrey,
bug fixed now (moderate_forum to moderate_forum2).

And about your question, its nature of logical equation.
Former code was checking isnt user having moderate_forum rights? then do not show content to him/her.
If you need to add second operand in this equation, you cant break checking algorithm style.
this is old one => !right1 => means if right1 isn't true
this is new one => !(right1 || right2) => means either right1 or right2 isn't true
In my mod, content is showing to user if one of permissions (original permission or new permission) is set.

I can give clear examples if you still dont get it.
Title: Re: IP View Permission
Post by: Kimojuno on September 26, 2008, 11:16:05 AM
Quote from: SONSiVRi on September 25, 2008, 03:43:58 PM
Thanks Jeffrey,
bug fixed now (moderate_forum to moderate_forum2).

And about your question, its nature of logical equation.
Former code was checking isnt user having moderate_forum rights? then do not show content to him/her.
If you need to add second operand in this equation, you cant break checking algorithm style.
this is old one => !right1 => means if right1 isn't true
this is new one => !(right1 || right2) => means either right1 or right2 isn't true
In my mod, content is showing to user if one of permissions (original permission or new permission) is set.

I can give clear examples if you still dont get it.

Ah, an either-or equation. I understand, thanks! =)
Title: Re: IP View Permission
Post by: vagrant on September 26, 2008, 09:50:34 PM
Nice mod and thank you for your time and work.

However, on my main forums users are by the nature of the forums very anon and i would like a mod to restrict access rather than grant more.
Title: Re: IP View Permission
Post by: SONSiVRi on September 27, 2008, 10:11:15 AM
Quote from: vagrant on September 26, 2008, 09:50:34 PM
Nice mod and thank you for your time and work.

However, on my main forums users are by the nature of the forums very anon and i would like a mod to restrict access rather than grant more.

In fact with this mod you can restrict either. You asked that or you explaining it?
Title: Re: IP View Permission
Post by: Sander on November 04, 2008, 07:27:48 AM
When my "Don't show IP's of these user(s)" list is empty, I get syntax errors.

E.g. in this line (Profile.php):

AND NOT ID_MEMBER IN (" . implode(',', unserialize($modSettings['masked_members'])) . ")", __FILE__, __LINE__);

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 4".

Obviously, the error is caused because (" . implode(',', unserialize($modSettings['masked_members'])) . ") leads to something weird when $modSettings['masked_members'] is empty, but I can't figure out how to resolve this (except for putting a username in the list, of course ;) ).

Anyone?


Title: Re: IP View Permission
Post by: SONSiVRi on November 07, 2008, 11:45:42 AM
I am on it.
Title: Re: IP View Permission
Post by: Sander on November 08, 2008, 05:34:44 AM
Thanks. ^-^
Title: Re: IP View Permission
Post by: Sabre™ on November 10, 2008, 07:10:07 AM
Any update on this SONSiVRi?
Is it possible to stop my moderators from viewing all IPs with this mod?
Or only grant my global mods permission to see IPs?

Thank you
Title: Re: IP View Permission
Post by: SONSiVRi on November 10, 2008, 07:26:19 AM
I think I didnt get you clear, I will answer as I think what you are asking.
If you want to stop moderators to viewing IP, dont give them this permission.
If you want stop viewing of moderator's IP by other members (who can view IP), then use mask option exist in new release (1.3).
Type each moderator nick into related area and their IP's will be hidden.

Is this what you asking?
Title: Re: IP View Permission
Post by: Sabre™ on November 10, 2008, 12:15:13 PM
Quote from: SONSiVRi on November 10, 2008, 07:26:19 AM
If you want to stop moderators to viewing IP, dont give them this permission.

Excellent buddy, thats all I needed to know.  Thank you :)

Quote from: Sander on November 04, 2008, 07:27:48 AM
When my "Don't show IP's of these user(s)" list is empty, I get syntax errors.

Have you ironed this out yet mate?
Title: Re: IP View Permission
Post by: SONSiVRi on November 10, 2008, 01:24:36 PM
for the error, its in the queue.
Lots of other codes are awaiting to done.
I hope I will handle this error tomorrow.
Title: Re: IP View Permission
Post by: Sabre™ on November 10, 2008, 01:31:48 PM
Brilliant, I will wait till youve completed it to implement this mod then.

Thanks for you good work mate :)
Title: Re: IP View Permission
Post by: SONSiVRi on November 11, 2008, 06:47:02 AM
Quote from: Sander on November 04, 2008, 07:27:48 AM
When my "Don't show IP's of these user(s)" list is empty, I get syntax errors.

Thanks for informing me, it's solved now.
Title: Re: IP View Permission
Post by: Sander on November 11, 2008, 03:07:14 PM
But you introduced a new bug. :)

In Profile.php, query below "// Get some totals for pagination." (somewhere near line 1900)

$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}messages AS m
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
WHERE $user_info[query_see_board]
AND m.posterIP $dbip " . (sizeof($id_members) > 0 ? sprintf('AND NOT mem.ID_MEMBER IN (%s)', implode(',', $id_members)) : '') . "", __FILE__, __LINE__);


Should be
$request = db_query("
SELECT COUNT(*)
FROM {$db_prefix}messages AS m
INNER JOIN {$db_prefix}boards AS b ON (b.ID_BOARD = m.ID_BOARD)
WHERE $user_info[query_see_board]
AND m.posterIP $dbip " . (sizeof($id_members) > 0 ? sprintf('AND NOT m.ID_MEMBER IN (%s)', implode(',', $id_members)) : '') . "", __FILE__, __LINE__);


mem.ID_MEMBER should be m.ID_MEMBER, that is.

Besides that, $id_members is not defined yet, in your mode-code it is defined at a later stage in the code (just before the next query that is changed by your mod).

Title: Re: IP View Permission
Post by: SONSiVRi on November 11, 2008, 04:57:46 PM
"Sander"

Error was issued bacause of there were same pattern twice and installer changed two of them. I didnt wanted first one and also "$id_members" wasn't defined for that. I expanded pattern and its won't mix up again. I changed mod file, would you try again?
Title: Re: IP View Permission
Post by: Sander on November 12, 2008, 12:16:39 PM
Seems to work OK now, thanks.
Title: Re: IP View Permission
Post by: SONSiVRi on November 13, 2008, 03:15:52 AM
Quote from: Sander on November 12, 2008, 12:16:39 PM
Seems to work OK now, thanks.

You welcome.
Title: Re: IP View Permission
Post by: DarkForce on November 25, 2008, 08:45:57 AM
first of all thank you for this great mod ;)

but i have a question...is it possible to hide the email-adress of specific users? (like hiding the ip of specific users)

DarkForce
Title: Re: IP View Permission
Post by: SONSiVRi on November 25, 2008, 08:49:04 AM
Yeah its possible but its not related this mod. You can do it yourself to check how I did mine. I could take a look for you but emails are spreaded around and its hard to find all of them. So its long time for me now.
Title: Re: IP View Permission
Post by: DarkForce on November 25, 2008, 10:34:17 AM
yes, of course it's possible with another mod...but i want to hide the email of those users, where
the ip is also hidden. so, when i hide the ip, the email should be hidden automatically, too.

if this isn't that easy to do or it costs too much time, let me know :)
but maybe you can give me a hint how to do this then...;)

DarkForce
Title: Re: IP View Permission
Post by: SONSiVRi on November 25, 2008, 10:44:39 AM
Quote from: DarkForce on November 25, 2008, 10:34:17 AM
yes, of course it's possible with another mod...but i want to hide the email of those users, where
the ip is also hidden. so, when i hide the ip, the email should be hidden automatically, too.

if this isn't that easy to do or it costs too much time, let me know :)
but maybe you can give me a hint how to do this then...;)

DarkForce

You have an option of this in original smf. But it hides whole users email adresses, not selected ones. Setting conditions isn't complicated. But it takes to that finding places where email are shown.
Title: Re: IP View Permission
Post by: DarkForce on November 25, 2008, 11:01:29 AM
yeah, i know. but i want to give my moderators the permission to see the email/ip of all users, even if the email is hidden.
but i want the moderators not to see the ip/mail of the admins...hiding the ip is no problem, because this is integrated in
your mod, but hiding the email-adress isn't implented yet.
this is what i'm asking for ;) i hope you've understood my question now  :)

DarkForce
Title: Re: IP View Permission
Post by: SONSiVRi on November 26, 2008, 04:45:48 AM
Ahhh, I got you now. I can do add condition on my email showing mechanisms. And I thing it's better to use same list for "Hide Email" with "Hide IP", I mean no need different two settings. But these days I am too busy for this. It may take one week to start.
Title: Re: IP View Permission
Post by: DarkForce on January 07, 2009, 05:43:36 PM
i just wanted to ask if you have started already?
Title: Re: IP View Permission
Post by: SONSiVRi on January 08, 2009, 04:06:45 AM
I forgot it, I will handle asap.
Title: Re: IP View Permission
Post by: Whimsical on May 05, 2009, 02:12:01 PM
thanks, very handy mod!

also managed to change it where necessary myself, to keep members emails private that were already set to private whilst still being able to view their IP

Cheers
Whimsical :)
Title: Re: IP View Permission
Post by: SONSiVRi on May 05, 2009, 03:19:54 PM
Quote from: Whimsical on May 05, 2009, 02:12:01 PM
thanks, very handy mod!

also managed to change it where necessary myself, to keep members emails private that were already set to private whilst still being able to view their IP

Cheers
Whimsical :)

That's a good idea though.
Title: Re: IP View Permission
Post by: studiowi33 on December 30, 2010, 04:16:05 AM
Please delete.