[REQ] guests can see only part of posts

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
Locked
User avatar
katib
Registered User
Posts: 562
Joined: Thu Jun 26, 2008 12:27 pm

[REQ] guests can see only part of posts

Post by katib » Fri May 08, 2009 2:11 pm

The following code snippet was used in viewtopic.php in phpbb2
so how it can be used in phpbb3? or is there even a better way to to it in phpbb3

the code allows gustes to read only the 400 first characters of a post

Code: Select all

$message = substr(($message), 0, 400).'..
, in the specified forums:

Code: Select all

if ((($forum_id == 1) or ($forum_id == 2) or...etc
Here is the code.

Code: Select all

// Begin Gusets see only part of posts

# here you can specify certain forums and topics to be excluded from not reading by guests



if ((($forum_id == 1) or ($forum_id == 2) or ($forum_id == 3) or ($forum_id == 4) or ($forum_id == 5) or ($forum_id == 6) or ($forum_id == 7) or ($forum_id == 8) or ($forum_id == 11) or ($forum_id == 14) or ($forum_id == 15) or ($forum_id == 16) or ($forum_id == 21) or ($forum_id == 22) or ($forum_id == 23) or ($forum_id == 28)) && ($topic_id != 31) && ($topic_id != 20))

{

	$lettercount = (strlen($message));

	if (($userdata['username'] == 'Anonymous') && ($lettercount > 400))

	{

		$path = __FILE__;

		$file = basename ($path);

		if ($file != 'portal.php')//needed for portal support, otherwise portal layout will breakout when clips are played. 

		{

				//first check if message has quote in it or a ot, quote box breaks forums layout.





				$message = str_replace("[ot", "[ ot", $message);

				$message = substr(($message), 0, 400).'... <br><br><table border=1 color=red style="background-color:#99CCFF"><tr><td>'.$lang['onlyforeguser'].'<tr><td><b><a href="http://'.$board_config['server_name'].$board_config['script_path'].'profile.php?mode=register">'.$lang['Register'].'</a><tr><td> '.$lang['or'].' <a href="http://'.$board_config['server_name'].$board_config['script_path'].'login.php?redirect=viewtopic.php?t='.$postrow[$i]['topic_id'].'">'.$lang['Login'].'</a> '.$lang['GuestWantReadAll'].'</b></td></tr></table>';

		}

	}

}

	// End Gusets see only part of posts
//
Last edited by katib on Tue May 12, 2009 9:41 pm, edited 2 times in total.

User avatar
katib
Registered User
Posts: 562
Joined: Thu Jun 26, 2008 12:27 pm

Re: [REQ] guests can read only part of posts

Post by katib » Sun May 10, 2009 8:09 am

Any help please ! on how "Guests can read only part of posts" ?

Labberie
Registered User
Posts: 1
Joined: Fri Jun 19, 2015 10:18 pm

Re: [REQ] guests can see only part of posts

Post by Labberie » Fri Jun 19, 2015 10:23 pm

Any news on this topic?

I'm looking for this MOD too.

User avatar
Theriddler1
Registered User
Posts: 438
Joined: Sat Aug 27, 2011 11:00 pm
Location: NL
Contact:

Re: [REQ] guests can see only part of posts

Post by Theriddler1 » Sun Jun 21, 2015 10:50 pm

Open: viewtopic.php

Find:

Code: Select all

$message = censor_text($row['post_text']);
Replace with:

Code: Select all

if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
	{
			$message = censor_text($row['post_text']);
			// *** shortening code by AmigoJack ***
			if ((utf8_strlen($message)> 30) && ($Space = utf8_strpos($message, ' ', 30)) !== FALSE) $message= substr($message, 0, $Space).'...' .'<br /><br /><div class="rules">Sorry only registered users are allowed to read whole content<b>&nbsp;<a href="'.append_sid("{$phpbb_root_path}ucp.$phpEx",'mode=register').'">'.$user->lang['REGISTER'].'</a></b>&nbsp;or&nbsp;<b><a href="'.append_sid("{$phpbb_root_path}ucp.$phpEx",'mode=login').'">'.$user->lang['LOGIN'].'</a></b></div>';
	}
	else
	{
			$message = censor_text($row['post_text']);
	}
Theriddler - Moderator @ phpBB.nl | phpBBservice.nl Team-member
ImageSupport Tools | Image My Extensions | buy me a beer Image

Locked

Return to “[3.0.x] MOD Requests”

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 20 guests

cron