Warning: The author of this contribution does not provide support for it anymore.

NV advanced last topic titles

"Topics Only Visible to OP" Integration? - NV advanced last topic titles

"Topics Only Visible to OP" Integration?

by Leinad4Mind » Sat Jan 28, 2012 8:03 am

Hi there,

could anyone do an "add-on" for this mod work with "Topics Only Visible to OP (Original Poster)"

Because I have a Forum with many topics that only the Original Posters can see their topics. And When in viewforum, the topic title appears to everyone. Even if it's not the Original Poster. Users who do not have permissions to view those private forums, can still see topic titles (which I don't want).

Hope someone could make this work. :?


Here's an example of how the MOD hides information normally visible on index/viewforum pages:

includes/functions_display.php

Find:

Code: Select all

'LAST_POSTER_FULL'      =>

In-line Find

Code: Select all

'LAST_POSTER_FULL'      =>

In-line Add after

Code: Select all

($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id)) ? '--' :


Which makes this:

Code: Select all

'LAST_POSTER_FULL'      => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),

Become this:

Code: Select all

'LAST_POSTER_FULL'      => ($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id)) ? '--' : get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']),


I've tried this:
FIND:

Code: Select all

'LAST_POST_SUBJECT'      => censor_text($last_post_subject),

REPLACE:

Code: Select all

'LAST_POST_SUBJECT'      => ($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id)) ? '--' : censor_text($last_post_subject),


FIND:

Code: Select all

'U_LAST_POST'      => $last_post_url)

REPLACE:

Code: Select all

'U_LAST_POST'      => ($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id)) ? '--' : $last_post_url)


But it didn't work...

Here is the code I found on includes/mods/advanced_last_topic_titles.php:
I dont know how to edit :/

Code: Select all

if ($row['forum_last_post_id'])
      {
         global $auth;

         $password_protected = !(self::$ignore_password || !$row['forum_password']);
         $permissions_protected = !(self::$ignore_permissions || $auth->acl_get('f_read', $row['nv_permission_forum_id']));

         if (!$password_protected && !$permissions_protected)
         {
            global $template, $phpbb_root_path, $phpEx;

            $altt_link_name         = (self::$use_topic_title) ? $row['topic_title'] : $row['forum_last_post_subject'];
            $altt_link_name         = ($altt_link_name == '') ? 'Re: ' . $row['topic_title'] : $altt_link_name;
            $altt_link_name_short   = (utf8_strlen(htmlspecialchars_decode($altt_link_name)) > self::$length_limit + 3 )? htmlspecialchars((utf8_substr(htmlspecialchars_decode($altt_link_name), 0, self::$length_limit) . '...')) : ($altt_link_name);

            $real_topic_id = ($row['topic_moved_id']) ? $row['topic_moved_id'] : $row['topic_id'];

            switch (self::$link_url)
            {
               case 1:
                  $altt_link_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&t=' . $real_topic_id);
               break;
               case 2:
                  $altt_link_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&t=' . $real_topic_id . '&view=unread') . '#unread';
               break;
               default:
                  $altt_link_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id'];
               break;
            }

            $template->alter_block_array('forumrow', array(
               'ALTT_LINK_NAME_SHORT'      => censor_text($altt_link_name_short),
               'ALTT_LINK_NAME'         => censor_text($altt_link_name),
               'U_ALTT_LINK'            => $altt_link_url,
            ), true, 'change');
         }
      }
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by WileCoyote » Sat Jan 28, 2012 9:44 am

I don't have installed the mod you are talking about but you can try following

Open includes/mods/advanced_last_topic_titles.php

Find

Code: Select all

         $permissions_protected = !(self::$ignore_permissions || $auth->acl_get('f_read', $row['nv_permission_forum_id']));

Add after

Code: Select all

            $forum_op_only_view_protected = !(self::$ignore_forum_op_only_view) || ($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id));

Find

Code: Select all

         if (!$password_protected && !$permissions_protected

Inline add after

Code: Select all

 && !$forum_op_only_view_protected
Regards
WileCoyote
User avatar
WileCoyote
Registered User
Posts: 432
Joined: Sun Jan 15, 2006 7:37 am
Location: Austria
Name: Wolfgang
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Sat Jan 28, 2012 11:15 am

It appeared:

Fatal error: Access to undeclared static property: phpbb_mods_advanced_last_topic_titles::$ignore_forum_op_only_view /forum/includes/mods/advanced_last_topic_titles.php on line 181

I've add:

Code: Select all

	static public $ignore_forum_op_only_view		= false;
It solved. but it says on all foruns that are protected, and it should just say on one of them.

and here:

Code: Select all

		self::$ignore_password		= (bool) $config['altt_ignore_password'];
		self::$ignore_permissions	= (bool) $config['altt_ignore_rights'];
		self::$ignore_forum_op_only_view = ????????????? WHAT SHOULD I PUT?
Last edited by Leinad4Mind on Mon May 20, 2019 4:00 pm
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by WileCoyote » Sat Jan 28, 2012 6:36 pm

Instead of

Code: Select all

                $forum_op_only_view_protected = !(self::$ignore_forum_op_only_view) || ($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id));

try

Code: Select all

            $forum_op_only_view_protected = !($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id));

or

Code: Select all

            $forum_op_only_view_protected = !($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $row['nv_permission_forum_id']));

then it should not be necessary to add

Code: Select all

            self::$ignore_forum_op_only_view = ????????????? WHAT SHOULD I PUT?

as this is only needed if there is an configuration option in the acp part of the mod. To have this configuration option it would also be necessary to add an entry to the database table of the mod
Regards
WileCoyote
User avatar
WileCoyote
Registered User
Posts: 432
Joined: Sun Jan 15, 2006 7:37 am
Location: Austria
Name: Wolfgang
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Sat Jan 28, 2012 10:20 pm

Still doesn't work :/ All foruns become protected. I've try many many things with those values and nothing :/
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Sat Jan 28, 2012 10:20 pm

Still doesn't work :/ All foruns become protected. I've try many many things with those values and nothing :/
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by WileCoyote » Sat Jan 28, 2012 11:18 pm

If i get some freetime in the next weeks i will take a look into it and test this on my local enviroment. Maybe i can work out a litlle piece of code which works for you.
Regards
WileCoyote
User avatar
WileCoyote
Registered User
Posts: 432
Joined: Sun Jan 15, 2006 7:37 am
Location: Austria
Name: Wolfgang
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Sun Jan 29, 2012 12:12 am

Thank you!
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by kasimi » Tue Jan 31, 2012 12:12 pm

Actually there's an easy fix for this.

Open
/includes/functions_display.php

Find

Code: Select all

($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id)) ? '--' : $last_post_time,

Replace with

Code: Select all

($row['forum_op_only_view'] && !$auth->acl_get('f_op_only_view', $forum_id)) ? '0' : $last_post_time,

All this does is replace the "--" with a zero.

This will make the <!-- IF forumrow.LAST_POST_TIME --> in the forumlist_body.html template file evaluate to false, thus showing No posts for users who do not have sufficient permissions.
Last edited by kasimi on Tue Jan 31, 2012 9:25 pm
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3789
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Tue Jan 31, 2012 2:01 pm

But I still need to apply the fix's above said by WileCoyote, Am I right?
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by kasimi » Tue Jan 31, 2012 3:11 pm

As far as I can tell, no, you don't need those anymore.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3789
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Tue Jan 31, 2012 3:20 pm

In that case, it does not work, with only your modification neither with both wilie and yours modification. :(
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by kasimi » Tue Jan 31, 2012 4:07 pm

Are you perhaps talking about the Active Topics list? I hadn't thought of that because I have it disabled for forums with OP view only.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3789
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: "Topics Only Visible to OP" Integration?

by Leinad4Mind » Tue Jan 31, 2012 4:17 pm

Hmm, perhaps, yes. In my index, it shows the Last Topic that has the last message on. Maybe it's the Last Active.

Don't know what Active Topics list is in fact.
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 851
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: "Topics Only Visible to OP" Integration?

by kasimi » Tue Jan 31, 2012 5:33 pm

This is the active topics list. I recommend disabling it for forums with OP view only enabled.

active-topics.png

If that's not part of your problem, I'm afraid I need to see a screenshot of what you're talking about in order to help you out.
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 3789
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact: