Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3626)
Private topics mod
by: Suki (http://missallsunday.com)
License
/*
* Version: MPL 2.0
*
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
*/
DescriptionAllows users with permissions to mark topics as private and invite people to it, the mod also has a permission to see all topics marked as private without the need to be invited.
This mod only covers a vanilla SMF installation, if you have mods that adds their own queries to fetch topics then you need to manually apply the appropiate check to that code.
for SMF 2.0.x only Laguage-English
ChangeLog
ugh! I sent this before I realized the mess with grandchild boards.
If you are planing on using this, keep in mind that it doesn't play well with child and grandchild boards (and I have no idea how to properly add support for it) and it does add a performance hit, it is not recommended to use this on a busy site.
Oh! That's a great idea! Would you mind doing a SMF 1.1 Version of this mod please Mr. Suki? Thank you!
I'm sorry, I do not write mods for outdated versions and I ain't a Mr ;) but since the mod is open source, anyone can write a version for 1.1.x
Hi,
It seems like an interesting mod, but I'm a little confused about how to get it to work.
Would it be possible to automatically mark all threads on a specific board as private, so for that board, people can only see and reply to the thread they made themselves, except for global moderators who are able to view and reply to all threads?
Kind regards,
Thels.
Welcome, first of all, the annoying captcha goes away at 10 posts.
Well, I specifically added a check so the users can chose for themselves whether or not mark any of their topics as private, the mark as private option will only be available on the boards you specified in the mod's settings admin page.
You can change this on your theme's Post.template.php
<input type="checkbox" id="ptenable" name="ptenable"', !empty($context['ptenable']) ? ' checked="checked"' : '', ' class="input_check" />
with this:
<input type="checkbox" id="ptenable" name="ptenable"', !empty($context['ptenable']) || !empty($ptBoard) ? ' checked="checked"' : '', ' class="input_check" />
And it will make the check as marked by default.
Thank you, Suki, this sounds like a great mod! So if I don't have any subforums, I shouldn't have any issues with it?
Only the server load been increased, if you have a pretty busy forum then I don't recommend adding this.
It actually hasn't opened yet, so I'm not sure how busy it will be yet. I do know that I want to have a board where my staff can offer private counseling to the users but not through PM, so this sounds like the way to go. Would this use even more resources than, say, AJAX Chat?
No, any chat will add far more load to the server than this mod. This mod will only become an issue when you have literally thousands of users requesting topics.
Oh okay, thanks again Suki. This sounds like the way to go, at least for now. I'm *hoping* to have thousands of members, of course, but it will still take some time for that to happen :)
Suki, where it says "type a user ID," is that for the user to allow non-moderators to view it? If so, can this be disabled?
Your users can leave that field as empty and then only the topic author and whoever has the permission to see any topic will be able to see it.
Very usefull mod and i need it but it is really work in "vanilla smf". cant make it work in custom theme. does anyone can use it in custom theme ?
ps: now i tried with fresh smf and it is gave me the same error, i think there is something else to make it work.
The error is, when i create a private topic it given me ''The database value you're trying to insert does not exist: topic_id'' and can't reach some of my mods it is given me another error.
is there any solution for this ? if this is a bug i can send a demo acc for test :)
Thing is, I cannot reproduce this on my local installation, I already tried several times with no luck...
Can you please tell me step by steps all the changes you did, including the boards where you are enabling this, whos member is having the issues, do you set the permissions correctly? are your boards childboards or grand childboards? all details you can provide would help.
I can't explane all of these with my english :) i thing it would be better to sent you a demo acc (did it).
a demo acc at this point isn't going to help since I just don't know the steps you did for the error to appear, that is why I want to know which steps you did.
doesn't matter if you can't explain it in English, post it on your native language, google will do the rest, the point here is to know all the steps you did.
Okay then, i will tell the steps and you can try them with demo acc.
The mod is active in board number 1. So first try to open new thread in here. chech the box and don't write any member id.
it will give this error ''The database value you're trying to insert does not exist: topic_id''
but the post will open. and appear for everyone.
the board error doesn't appear now. i will give more information later.
OK, thanks, that gives me an idea on where I need to look, hopefully this "undefined topic" error will finally stop hunting me!
Will take a look when I have some time.
Quote from: Suki on March 05, 2013, 08:39:46 PM
OK, thanks, that gives me an idea on where I need to look, hopefully this "undefined topic" error will finally stop hunting me!
Will take a look when I have some time.
Okay :laugh:
Suki, i'm still trying to work this mod. Sometimes it is working sometimes it is not. i wonder maybe i'm doing something wrong with entegrate it my theme. can you help me with just this part ?
how should has to be ?
find
if (!empty($board['last_post']['id']))
echo '
<p><span>', $board['last_post']['member']['link'] , ' ', $txt['in'], ' ', $board['last_post']['link'], '</span><br />
', $board['last_post']['time'],'
</p>';
change
if (!empty($board['last_post']['id']))
if (!empty($modSettings['PrivateTopics_enable']))
{
global $user_info;
$ptTrue = false;
$pt = new PrivateTopics($board['last_post']['id']);
$ptCache = $pt->doGet();
if (!empty($ptCache) && is_array($ptCache) && !allowedTo('can_always_see_private_topics'))
{
if (!in_array($user_info['id'], $ptCache))
echo '
<p>', !empty($modSettings['PrivateTopics_boardindex_message']) ? $modSettings['PrivateTopics_boardindex_message'] : PrivateTopics::doTools()->getText('boardindex_message_default') ,'</p>';
else
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
}
else
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
}
else
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
Exactly like you posted it? just find/replace.
To say "not working" doesn't really help, at all.
i couldn't express myself.
in defaul theme it has these codes.
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
but in mine theme it has these, how has to be the modified.
if (!empty($board['last_post']['id']))
echo '
<p><span>', $board['last_post']['member']['link'] , ' ', $txt['in'], ' ', $board['last_post']['link'], '</span><br />
', $board['last_post']['time'],'
</p>';
The only thing that changes is this:
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>'
Just replace that echo part with what you have:
echo '
<p><span>', $board['last_post']['member']['link'] , ' ', $txt['in'], ' ', $board['last_post']['link'], '</span><br />
', $board['last_post']['time'],'
</p>';
If you see closely on the code you need to add, there are multiple instance of that echo statement, replace all of them with what you have.
Okay i did it like this:
if (!empty($board['last_post']['id']))
if (!empty($modSettings['PrivateTopics_enable']))
{
global $user_info;
$ptTrue = false;
$pt = new PrivateTopics($board['last_post']['id']);
$ptCache = $pt->doGet();
if (!empty($ptCache) && is_array($ptCache) && !allowedTo('can_always_see_private_topics'))
{
if (!in_array($user_info['id'], $ptCache))
echo '
<p>', !empty($modSettings['PrivateTopics_boardindex_message']) ? $modSettings['PrivateTopics_boardindex_message'] : PrivateTopics::doTools()->getText('boardindex_message_default') ,'</p>';
else
echo '
<p><span>', $board['last_post']['member']['link'] , ' ', $txt['in'], ' ', $board['last_post']['link'], '</span><br />
', $board['last_post']['time'],'
</p>';
}
else
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
}
else
echo '
<p><strong>', $txt['last_post'], '</strong> ', $txt['by'], ' ', $board['last_post']['member']['link'], '<br />
', $txt['in'], ' ', $board['last_post']['link'], '<br />
', $txt['on'], ' ', $board['last_post']['time'],'
</p>';
when i make a topic private and put a id, other members can't see the all boards it gives a DB error. in default theme can see the topic but can't open it, it seems working in default.
Did you do all the other edits the mod needs?
This is just a template edit. Anyway, you only replaced one echo statement, there are more two more.
Can really help you if you don't provide more details.... what DB error? what did you do? did you installed this manually?
the mod is sending pm to invite users but it is do it just in the first time when post is created. if you add couple of more id after that it is not sending pms to the new ids.
is ''anyone'' have and idea how to fix this ?
thanks in advance.