News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Revisiting Private Threads, please?

Started by Grammy, May 29, 2016, 11:47:42 PM

Previous topic - Next topic

Grammy

Based on this post:  http://www.simplemachines.org/community/index.php?topic=542687.msg3856058#msg3856058

I'm sorry to revive this, Kindred or anyone, but would you happen to remember the name of this mod?  I ask because that's exactly what I'm being asked for.  There'll be a section of the new forum that will deal with sensitive health issues and the users would like the option for their posts to be only between them and staff.  I guess personal messages aren't ideal because they want their issues to be viewed by any and all capable staff with a response possible from any of them, not just one back-and-forth PM.  So, I guess, similar to starting a ticket?  No biggie, if it's not available anymore, but one asks.   :)

Antechinus

Suki wrote a mod for that for 2.0.x.

br360


Grammy

 That makes us just about ready to launch.   ;)

Thanks, guys, so much!

Grammy

In case Suki sees this, I'm 2.0.11, default.  It doesn't upload via the manager, you must unarchive and place in the packages directory; however that's no big deal.  When you browse packages, it's there and it seems to install okay but once you see the redirect, everything goes white.  The entire forum is white.  I'll undo the edits so that I can get the forum back, and I wish I could tell you the errors, but I can't see them.   :)

If Suki or anyone can think of why this might be happening, I would sure appreciate the help.  Other installed mods are:

(Well...  I can't see the list but here's what's sitting on my server.  I think they're all installed):

BETA_ts_0.3.99d.tar.gz (tabbed smileys)
Breeze_v1.0.9.zip
cbi181.zip
ColorizePost_1.0.zip
Default_Avatar_by_Username_v1.0.1.zip
Disable_last-edit-by._for_administrators1.9.zip
Dynamic_Memberlist_3_0.zip
Packages/Image_Float_BBCode_v1.19.zip
Lazy_Admin_Menu_v1.16.zip
maestrosite-StickyTopicsOrder-0.5.tar.gz
misc-anti-spam.zip
OharaYTEmbed.zip
PersonalPad.zip
PmxBlog-1.1-master/
PrivateTopic-master/
SimplePortal_2.3.6.zip
SMF-Arcade-RC3.zip
SMF-ILA-master/
SMFGallery5.6.zip
ultimate_profile-0-9-1_20.zip

The forum has been running clean with no errors, prior.  Thanks!   :)

Grammy

#5
I put the original files back and the forum's up.  Here are my 2 errors:


2: copy(/var/www/vhosts/domain.com/httpdocs/Packages/temp/PrivateTopicsTools.php): failed to open stream: No such file or directory
File: /var/www/vhosts/domain.com/httpdocs/Sources/Subs-Package.php
Line: 1392

         $failure |= !copy($action['source'], $action['destination']);

2: file_get_contents(/var/www/vhosts/domain.com/httpdocs/Packages/temp/PrivateTopicsTools.php): failed to open stream: No such file or directory
File: /var/www/vhosts/domain.com/httpdocs/Sources/Subs-Package.php
Line: 2467

return file_get_contents($filename);


Of course, it may be improper to ask about this here, since you've already answered my initial question.  Should I actually post about this elsewhere?


EDIT:  I did find PrivateTopicsTools.php sitting in my Sources folder, so it did land there after installation.  However, it is a blank file.  It's not included in the package, only referred to in package-info.xml.  Does that mean it's blank intentionally?

<install for="2.0 - 2.0.99">
<database>install.php</database>
<code>hooks.php</code>
<readme type="file" parsebbc="true">readme.txt</readme>
<modification>PrivateTopics.xml</modification>
<require-file name="PrivateTopics.php" destination="$sourcedir">source</require-file>
<require-file name="PrivateTopicsTools.php" destination="$sourcedir">source</require-file>
<require-file name="PrivateTopics.english.php" destination="$languagedir">lang</require-file>
<require-file name="PrivateTopics.template.php" destination="$themedir">theme</require-file>
<redirect url="$scripturl?action=admin;area=privatetopics" timeout="3000"></redirect>
</install>

Grammy

#6
Actually, I went through each file and manually edited and that's when I discovered that several of the XML positions seem off.  There are quite a few incidents of "after" when it seems that it should be "replace" because the find string is included in the "Add", for instance.  The table isn't added to the database, either.  I left a message on Suki's site asking her to please take a look at this thread, so I'll just subscribe to it and wait it out.  Thanks.


EDIT:  I uploaded one file at a time and it's the SSI.php file that's causing the forum to white out.  I notice that, for some reason, it's called for twice in the XML and it seems that when it's called for toward the end of the XML, it takes into account some strings that it edited the first time it called for SSI.php.  I'm a bit stumped about that, but what else is new?   :D

I'm attaching the XML file, in case anyone sees anything obvious that's causing the white out.  Thanks, guys.

Grammy

#7
Oh, phooey, my "modify post" time ran out.  Please forgive me for adding this as a separate post, but while you're looking at the XML file, do you see what I mean about the positions being a bit off?  This, for instance:

<file name="$boarddir/SSI.php">
<operation>
<search position="before"><![CDATA[m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, m.id_board, b.name AS board_name,]]></search>
<add><![CDATA[m.poster_time, m.subject, m.id_topic, m.id_member, m.id_msg, m.id_board, b.name AS board_name, t.private_users,]]></add>
</operation>


That shouldn't be "replace"?   :-\


EDIT:    Okay, I've gone through the SSI.php edits and any of these three edits (found in the first time the XML file calls for SSI.php) will white out the forum:

<operation>
<search position="before"><![CDATA[$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);]]></search>
<add><![CDATA[$posts = array();

/* PrivateTopics mod */
$canSeePrivateTopics = !empty($modSettings['PrivateTopics_enable']) ? allowedTo('can_always_see_private_topics') = true;
/* PrivateTopics mod */

while ($row = $smcFunc['db_fetch_assoc']($request))
{
/* PrivateTopics mod */
if (empty($canSeePrivateTopics) && !empty($row['private_users']))
{
// We have the encoded list so lets use it
$ptusers = PrivateTopics_decode($row['private_users']);

// Sorry, you aren't allowed to see this topic.
if (!empty($ptusers) && !isset($ptUsers[$user_info['id']]))
continue;
}
/* PrivateTopics mod */

$row['body'] = parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']);]]></add>
</operation>


<operation>
<search position="after"><![CDATA[$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));]]></search>
<add><![CDATA[$posts = array();

/* PrivateTopics mod */
$canSeePrivateTopics = !empty($modSettings['PrivateTopics_enable']) ? allowedTo('can_always_see_private_topics') = true;
/* PrivateTopics mod */

while ($row = $smcFunc['db_fetch_assoc']($request))
{
/* PrivateTopics mod */
if (empty($canSeePrivateTopics) && !empty($row['private_users']))
{
// We have the encoded list so lets use it
$ptusers = PrivateTopics_decode($row['private_users']);

// Sorry, you aren't allowed to see this topic.
if (!empty($ptusers) && !isset($ptUsers[$user_info['id']]))
continue;
}
/* PrivateTopics mod */

$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));]]></add>
</operation>


<operation>
<search position="replace"><![CDATA[$topics = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
censorText($row['subject']);]]></search>
<add><![CDATA[$topics = array();

/* PrivateTopics mod */
$canSeePrivateTopics = !empty($modSettings['PrivateTopics_enable']) ? allowedTo('can_always_see_private_topics') = true;
/* PrivateTopics mod */

while ($row = $smcFunc['db_fetch_assoc']($request))
{
/* PrivateTopics mod */
if (empty($canSeePrivateTopics) && !empty($row['private_users']))
{
// We have the encoded list so lets use it
$ptusers = PrivateTopics_decode($row['private_users']);

// Sorry, you aren't allowed to see this topic.
if (!empty($ptusers) && !isset($ptUsers[$user_info['id']]))
continue;
}
/* PrivateTopics mod */

censorText($row['subject']);]]></add>
</operation>


And again, I know nothing about coding, but it seems to me that the first two edit instructions should be "replace".  No?   :(


NOTE:  All three of those kick out in a PHP validator with this:  Fatal error: Can't use function return value in write context
$canSeePrivateTopics = !empty($modSettings['PrivateTopics_enable']) ? allowedTo('can_always_see_private_topics') = true;

But of course, ignorant me doesn't even know what that means.   :-[

Antechinus

It's probably best to wait for Suki to have a look at this.

Grammy

#9
Quote from: Antechinus on May 30, 2016, 06:04:33 PM
It's probably best to wait for Suki to have a look at this.


I'm sure you're right.  Thanks for stopping by; I'll do that.   :)


NOTE for SUKI:  I was able to get those three blocks from XML for SSI.php to stop throwing errors by changing

$canSeePrivateTopics = !empty($modSettings['PrivateTopics_enable']) ? allowedTo('can_always_see_private_topics') = true;

to this:


$canSeePrivateTopics = !empty($modSettings['PrivateTopics_enable']) ? allowedTo('can_always_see_private_topics') : true;


The forum screen is no longer white.  Is that okay?   If it is, I now have all the files edited (I hope correctly) but I'm not sure what to do next to manually install it.  I did move all the files in the zip where they should go and was thinking I'm supposed to put install.php and hooks.php in the root?  I do have the PrivateTopicsTools.php file that I saved from my server earlier but it's a blank file.  Should I upload it anyway?  (Don't you wish I'd go away?)   :D

Grammy

Hi, Suki, I'm coming back over to SMF to post because I couldn't get my post to go through at your site.   :)

Here's where I currently am:  I edited the files (as well as I could, at least to the extent that my forum pages are no longer white and the files pass the PHP validator).  I uploaded them, along with the files that were included in the zip.  I had managed to save the PrivateTopicsTools.php from my server earlier, so I uploaded it to Sources, even though it is a blank file.  I put install.php and hooks.php in the root and pointed my browser to install.php.  I got the white screen I expected, but no table was added to the database.  I created one but I'm not sure I did it correctly and only guessed at what it might look like, after reading another user's issues over at your site:

CREATE TABLE smf_private_topics (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
topic_id INT not null,
users INT not null,
new INT not null
)ENGINE=MYISAM;


There are 2 permissions in the members' section:

1.)  Can set topics as private topics (I have that one checked)
2.)  Can always see private topics (I do NOT have that one checked)

In the Admin section, I have enabled Private Topics, have chosen a board for topics and have saved the changes.

I have tested, logged in as a regular member and, in the posting area, I can see a checkbox that I'm assuming should have something written by it like "Make This Topic Private"?  I checked it and I think the field next to it is for a username.  (There's just nothing written by these two areas.)  I put in my admin username and made a topic as a regular member. 

The problem is that other regular member testing accounts can all see the topic, so it isn't private. 

These are my errors:

8: Undefined index: PrivateTopics_post_message
Line 210 of Post.template.php:

<span id="caption_privatetopics">', $txt['PrivateTopics_post_message'] , ':</span>

8: Undefined index: PrivateTopics_post_enable
Line 202 of Post.template.php

<span id="caption_privatetopics">', $txt['PrivateTopics_post_enable'] , ':</span>

Should I add these to the globals?

But I don't think they're causing the topics to not really be private.  Is that maybe connected to the posting area being incomplete?  I'm attaching a screenshot of it.





Kindred

Suki is on vacation and will not be around for a week or more
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Grammy

Quote from: Kindred on May 31, 2016, 11:24:37 PM
Suki is on vacation and will not be around for a week or more


Ah!  I was beginning to question my charm!    :D

Okay, thanks, Kindred; I'll busy myself with something else. 

Grammy

#14
June 8th, 2016

Still looking for Suki.   ???

Actually, though, although it was probably proper to begin this thread in Mod Requests since that's where I found the original request, it's evolved into a request for support. If there's a more proper location, I'm happy to let this die and begin a new thread elsewhere, particularly if there's a better chance that Suki will actually see it. 

ULemmeNo.   :)





EDIT:
Never mind, guys.  I just found this over at her site:

Quote from: Suki on June 06, 2016, 08:08:24 PM
I honestly wouldn't bother with that mod,  it's unfinished and unfortunately I don't have the time to properly update it since it requires a large rewrite.

So, I guess that's the end of that, then.   I'm back to this being a Mod Request.

Thanks.   :(

Advertisement: