"Topics Only Visible to OP" Integration with Portal?

Current Version: 2.0.2
Released: 2013-10-27
Forum rules
Before creating a new support thread, please take a look at the board3 Portal FAQ and use the search!
Many questions have already been answered.
Locked

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

"Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

Hello

I really hope someone can help (it's a small problem but takes a while to explain).

I have "Topics Only Visible to OP" MOD installed. It's a MOD which allows a forum to be set to private, meaning only the topic author and selected groups can view the threads within certain forums.

MOD is here: "Topics Only Visible to OP (Original Poster)"

The problem I have is, with "Board3 Portal" installed, in "Latest news" module the users who do not have permissions to view those private forums, can still see topic titles (which I don't want).


And 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']),

And with this line 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:

Code: Select all

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

How can I Adapt all this to the portal?!

In functions.php I just could find this and try some stuff but without sucess :/:

Code: Select all

// fetch post for news & announce
function phpbb_fetch_posts($module_id, $forum_from, $permissions, $number_of_posts, $text_length, $time, $type, $start = 0, $invert = false)
{
	global $db, $phpbb_root_path, $auth, $user, $bbcode_bitfield, $bbcode, $portal_config, $config;

	$posts = array();
	$post_time = ($time == 0) ? '' : 'AND t.topic_time > ' . (time() - $time * 86400);
	$forum_from = (strpos($forum_from, ',') !== FALSE) ? explode(',', $forum_from) : (($forum_from != '') ? array($forum_from) : array());
	$str_where = '';
	$topic_icons = array(0);
	$have_icons = 0;

	if ($permissions == true)
	{
		$disallow_access = array_unique(array_keys($auth->acl_getf('!f_read', true)));
	} 
	else
	{
		$disallow_access = array();
	}

	if ($invert == true)
	{
		$disallow_access = array_merge($disallow_access, $forum_from);
		$forum_from = array();
	}
Last edited by Leinad4Mind on 13. February 2012 02:34, edited 1 time in total.

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

Re: "Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

How can I get an array of $row['forum_op_only_view'] ? 'Cause I can't get one... :/~

All I done so far:

Code: Select all

	if ($permissions == true)
	{
		$forums_all = array_unique(array_keys($auth->acl_getf('f_read', true)));	
		//$forums_to_be_disallowed = array(127,128,129,130,131,132,174); // This works
		$forums_to_be_disallowed = array_unique(array_keys($row['forum_op_only_view'])); //This don't work
		$forums_unrestricted = array_diff($forums_all, $forums_to_be_disallowed); //Shows only topics disallowed
		$forums_restricted = array_intersect($forums_all, $forums_to_be_disallowed); // Shows all topics except disallowed
		$forum_op_only_view_protected = array_unique(array_keys($auth->acl_getf('!f_op_only_view', true))); //disallow acess to users without permission to view OP authors
		$forums_permission = array_intersect($forums_unrestricted, $forum_op_only_view_protected);
		$disallow_access = $forum_op_only_view_protected;
	} 
	else
	{
		$disallow_access = array();
	}

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

Re: "Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

Bump this up. Anyone knows how to make but mods compatible?

Thanks!

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

Re: "Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

I've almost solve it.

In ./portal/includes/functions.php

Find:

Code: Select all

			'forum_name'			=> $row['forum_name'],
			'attachments'			=> (!empty($attachments)) ? $attachments : array(),
		));
Add after:

Code: Select all

// BEGIN Topics Only Visible to OP MOD
// If original poster only view is enabled, check if user has permission or is the topic poster
		if($row['forum_op_only_view'] && $user->data['user_id'] != $row['topic_poster'] && $row['topic_type'] != POST_STICKY && $row['topic_type'] != POST_ANNOUNCE && $row['topic_type'] != POST_GLOBAL && !$auth->acl_get('f_op_only_view', $forum_id) && !$auth->acl_getf_global('m_') && !$auth->acl_getf_global('a_'))
		{
			--$i;
		}
		$posts['global_id'] = $global_f;
		++$i;
// END Topics Only Visible to OP MOD
With this code, for registed users, all topics created on a specific sub-forum, will just be seen by the author (and admin+mods).

The PROBLEM I can't fix yet, and I need help is that all members that are not the author of the topic, will not see the topic, but in that page, it will appear just 4 topics and not 5. If someone create 3 topics on that subforum in the same time, the others users will just see 2 topics on the portal page. I can I fix the $i?

Best regards!

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

Re: "Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

Still anyone of Board3 Dev can help me out on the intregration with this other MOD? I and, I presume, many others, will kindly appreciate.

Best Regards

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

Re: "Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

:| :( :cry:

Topic author
Leinad4Mind
Active Member
Posts: 16
Joined: 7. January 2010 23:15
phpBB.de User: Leinad4Mind
phpBB.com User: Leinad4Mind

Re: "Topics Only Visible to OP" Integration with Portal?

Post by Leinad4Mind »

Can anyone see this, please?
Locked

Return to “Board3 Portal 2.0.x - English Support”