[RC] Hide BBcode

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
FomenkoAndrey
Registered User
Posts: 363
Joined: Thu Aug 19, 2010 10:44 am

Re: [RC] Hide BBcode

Post by FomenkoAndrey » Sat Oct 10, 2015 11:29 am

try. doesnt work.

FomenkoAndrey
Registered User
Posts: 363
Joined: Thu Aug 19, 2010 10:44 am

Re: [RC] Hide BBcode

Post by FomenkoAndrey » Sat Oct 10, 2015 10:04 pm

i found problem viewtopic.php?f=456&t=2259081&p=14226616#p14226616 - HideBBcode!

if turn OFF HideBBcode - portal work fine,

turn ON HideBBcode - if a page of Board3Portal contains a post with bbcode hide - portal page crqash with the error:

Code: Select all

Unable to find template "portal/portal_body.html" (looked into: ./styles/prosilver_se/template, ./styles/prosilver_se/theme, ./styles/prosilver/template, ./styles/prosilver/theme, ./ext/marcovo/hideBBcode/styles/all/template, ./ext/marcovo/hideBBcode/styles/all/theme).

can U fix this problem? plz

Miri4ever
Registered User
Posts: 392
Joined: Sat Mar 07, 2015 11:18 am

Re: [RC] Hide BBcode

Post by Miri4ever » Sat Oct 10, 2015 11:41 pm

Tested Hidden Message on my Portal Site inside a Portal and it's working fine with no errors.

The error is coming from Portal Exentsion telling you the File for display the portal is missing inside your template.

Copy from portal exentsion "portal/portal_body.html"

to your base style "/styles/prosilver_se/template"

to be sure copy this portal folder, best to all your styles yours using to get it running. Portal is not coded very well on this part and sometimes it misses the copies at differ styles, even if they should be there. The Hide extension is working very well.
Homepage: Terra Oceanica

Miri4ever
Registered User
Posts: 392
Joined: Sat Mar 07, 2015 11:18 am

Re: [RC] Hide BBcode

Post by Miri4ever » Sat Oct 10, 2015 11:46 pm

Hi marcovo,

making it a little bit more compatible to my style but missing always the CSS Files while patching this exentsion.

Could you please create a new folder inside the template / Styles folder ?

Please make:

styles/pbwow3 folder and copy your files from you styles inside there but overwrite this File: custom.css with my patched version for PBWOW3 Styles.

Code: Select all

dl.hidebox {
	background-color: #2B0101;
	border-color: #DADADA;
	padding: 3px;
	background-color: #2B0101;
	border: 1px solid #DADADA;
	font-size: 1em;
}

dl.hidebox dt {
	border-bottom-color:  #111111;
	text-transform: uppercase;
	border-bottom: 1px solid #111111;
	margin-bottom: 3px;
	font-size: 0.8em;
	font-weight: bold;
	display: block;
}

dt.unhide {
	color: #78FF9A;
}

dt.hide {
	color: #FAFAFA;
}

blockquote dl.hidebox {
	margin-left: 0;
}

.rtl blockquote dl.hidebox {
	margin-right: 0;
}
Homepage: Terra Oceanica

FomenkoAndrey
Registered User
Posts: 363
Joined: Thu Aug 19, 2010 10:44 am

Re: [RC] Hide BBcode

Post by FomenkoAndrey » Sun Oct 11, 2015 6:39 am

UPD: problem not in hideBBcode, in post content.

portal displays the contents hidden BB code hide.
BUT! PLEASE!!! do not support the portal, otherwise it fail, as in the case with a QR.

marcovo
Registered User
Posts: 239
Joined: Fri Nov 16, 2012 12:19 pm
Location: The Netherlands
Name: Marco

Re: [RC] Hide BBcode

Post by marcovo » Sun Oct 11, 2015 9:33 am

I've included the issues on the issues page. I don't know, is the issue with the board3portal an issue with that extension, or with this extension? If it is an issue of this extension, I could imagine that this could be an issue, because of this question. Sadly it did not receive any answers.

FomenkoAndrey
Registered User
Posts: 363
Joined: Thu Aug 19, 2010 10:44 am

Re: [RC] Hide BBcode

Post by FomenkoAndrey » Sun Oct 11, 2015 9:41 am

I've included the issues on the issues page.
This error occurs on the portal page, but it is not related to the portal.
I just re-insert a photo in the topic and it worked.
why it happened and where are hide - I do not know.
most likely a problem in the BB code that is incorrectly cut on the portal page.

BB code is simply ignored hide in the pages of the portal, hidden content is displayed.

PS:
by the way, soon QR will be updated wait problems with hide (

Cl0wnie
Registered User
Posts: 11
Joined: Fri Aug 17, 2012 2:27 pm

Re: [RC] Hide BBcode

Post by Cl0wnie » Sun Oct 11, 2015 11:37 am

Just after some pointers on what to edit in order to automatically unhide content from particular groups like mods, admin, helpers, staff etc so they don't have to reply in order to see what has been posted to moderate the topics.

Edit: Also what needs to be added/altered to be able to see in the moderator control panel so you don't end up deleting the wrong hidden message and not having to go back and look what it is.
Last edited by Cl0wnie on Sun Oct 11, 2015 1:55 pm, edited 1 time in total.

FomenkoAndrey
Registered User
Posts: 363
Joined: Thu Aug 19, 2010 10:44 am

Re: [RC] Hide BBcode

Post by FomenkoAndrey » Sun Oct 11, 2015 11:46 am

+1
great idea!
it would be nice to be able to specify a group in the admin panel, which shows for the hidden content.

Miri4ever
Registered User
Posts: 392
Joined: Sat Mar 07, 2015 11:18 am

Re: [RC] Hide BBcode

Post by Miri4ever » Sun Oct 11, 2015 7:53 pm

The HIDE and HIDDEN parts are not displayed inside the portal system. But the text between is also not there. So this is no problem at all. This happen if you press read all button at portal. But there are no error messages. If reading the topic normal everything is display fine.

So I say it'S no big trouble at all and not hidden content is displayed under read all. The portal extension just don't call the routine for display HIDE Code. How could it call this, if many this exentsion not using or including this called inside HIDE Extension is also bad because not everyone using the same portal system. Sure it could be done I think but there are many checks inside both if any using this.

And again this is no bad error yours got, just a missing template file inside your prosilver or own style folder. I got uploaded all everywhere, thats why I can't see anywhere an error at all.
Homepage: Terra Oceanica

Cl0wnie
Registered User
Posts: 11
Joined: Fri Aug 17, 2012 2:27 pm

Re: [DEV] Hide BBcode

Post by Cl0wnie » Thu Oct 15, 2015 1:48 pm

parshakov wrote:I modified marcovo extension to hide content from anyone but a particular group of users named "Trusted Users". It can be easily modified to hide content from guests.

All you need to do is modify the listener.php file:

Code: Select all

<?php
/** 
*
* @package Hide_BBcode
* @copyright (c) 2015 Marco van Oort
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 
*
*/

namespace marcovo\hide_bbcode\event;

/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
	protected $db;
	protected $user;
	protected $template;

	protected $b_hide = true;

	/**
	* Constructor
	*
	* @param \phpbb\db\driver\driver $db Database object
	* @param \phpbb\controller\helper    $helper        Controller helper object
	*/
	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\template\template $template)
	{
		$this->db = $db;
		$this->user = $user;
		$this->template = $template;

	}

	static public function getSubscribedEvents()
	{
		return array(
			'core.user_setup'	=> 'load_language_on_setup',

//			'core.modify_posting_parameters'		=> 'check_user_is_trusted',
			'core.modify_text_for_display_after'	=> 'parse_bbcodes_after',
			'core.modify_format_display_text_after'	=> 'parse_bbcodes_topicPreview',
			
//			'core.parse_attachments_modify_template_data'	=> 'check_attachment',

			'test.topic_review_modify_template_vars'	=> 'topic_review_modify_template_vars',
			'core.posting_modify_template_vars'	=> 'posting_modify_template_vars',
		);
	}

	/**
	* Load common files during user setup
	*
	* @param object $event The event object
	* @return null
	* @access public
	*/
	public function load_language_on_setup($event)
	{
		$lang_set_ext = $event['lang_set_ext'];
		$lang_set_ext[] = array(
			'ext_name' => 'marcovo/hide_bbcode',
			'lang_set' => 'hide_bbcode',
		);
		$event['lang_set_ext'] = $lang_set_ext;
		
		$this->check_user_is_trusted();
	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function topic_review_modify_template_vars($event)
	{
		if ($this->b_hide)
		{
			$event['decoded_message'] = preg_replace("#\[hide\].*?\[/hide\]#is", '{{'.$this->user->lang('HIDEBB_HIDDEN_MESSAGE')."}}\n", $event['decoded_message']);
		}

	}
	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function posting_modify_template_vars($event)
	{	
		if ($this->b_hide)
		{
			$page_data = $event['page_data'];
			$page_data['MESSAGE'] = preg_replace("#\[hide\].*?\[/hide\]#is", '{{'.$this->user->lang('HIDEBB_HIDDEN_MESSAGE')."}}\n", $page_data['MESSAGE']);
			$event['page_data'] = $page_data;
		}

	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	private function check_user_is_trusted()
	{

		// Check if the is in the Trusted group
		$sql = "SELECT group_id	FROM " . USER_GROUP_TABLE . " WHERE group_id = 8 AND user_id = " . $this->user->data['user_id']; 

		$result = $this->db->sql_query($sql);
		$b_hide = $this->db->sql_affectedrows($result) ? false : true;
		$this->db->sql_freeresult($result);
		
		$this->b_hide = $b_hide;
	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	/*
	public function check_attachment($event)
	{
		if($this->b_hide)
		{
			$event['attachment'] = array();
			$event['block_array'] = array();
			$event['download_link'] = '';
		}
	}
	*/


	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function parse_bbcodes_after($event)
	{

		$event['text'] = preg_replace_callback('#<!-- HIDE_BBCODE -->(.*?)<!-- /HIDE_BBCODE -->#s', array($this, 'hidden_pass'), $event['text']);

	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function parse_bbcodes_topicPreview($event)
	{

		$event['text'] = preg_replace_callback('#<!-- HIDE_BBCODE -->(.*?)<!-- /HIDE_BBCODE -->#s', array($this, 'hidden_pass_topicPreview'), $event['text']);

	}
	
	
	/**
	* Convert Hidden BBCode into its final appearance
	*
	* @param array $matches
	* @return string HTML render of hidden bbcode
	*/
	protected function hidden_pass($matches)
	{
		$this->template->set_style(array('styles', 'ext/marcovo/hide_bbcode/styles'));

		$bbcode = new \bbcode();
		$bbcode->template_filename = $this->template->get_source_file_for_handle('hide_bbcode.html');
		
		if ($this->b_hide) return $bbcode->bbcode_tpl('hide');
		else return $bbcode->bbcode_tpl('unhide_open') . $matches[1] . $bbcode->bbcode_tpl('unhide_close');
	}
	
	/**
	* Convert Hidden BBCode into its final appearance
	*
	* @param array $matches
	* @return string HTML render of hidden bbcode
	*/
	protected function hidden_pass_topicPreview($matches)
	{
		$this->template->set_style(array('styles', 'ext/marcovo/hide_bbcode/styles'));

		$bbcode = new \bbcode();
		$bbcode->template_filename = $this->template->get_source_file_for_handle('hide_bbcode.html');
		
		return $bbcode->bbcode_tpl('unhide_open') . $matches[1] . $bbcode->bbcode_tpl('unhide_close');

	}

}
I had no experience at creating extensions, so it would be great if someone could check the code (functions load_language_on_setup and check_user_is_trusted in particular)!
I tried this and it didn't work, just crashed everything.

parshakov
Registered User
Posts: 35
Joined: Sun Jul 28, 2013 8:03 pm

Re: [RC] Hide BBcode

Post by parshakov » Wed Oct 21, 2015 2:33 am

Cl0wnie, try this:

ext/marcovo/hide_bbcode/event/listener.php

Code: Select all

<?php
/** 
*
* @package Hide_BBcode
* @copyright (c) 2015 Marco van Oort
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 
*
*/

namespace marcovo\hide_bbcode\event;

/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
	protected $db;
	protected $user;
	protected $template;

	protected $b_hide = true;

	/**
	* Constructor
	*
	* @param \phpbb\db\driver\driver $db Database object
	* @param \phpbb\controller\helper    $helper        Controller helper object
	*/
	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\template\template $template)
	{
		$this->db = $db;
		$this->user = $user;
		$this->template = $template;

	}

	static public function getSubscribedEvents()
	{
		return array(
			'core.user_setup'	=> 'load_language_on_setup',

//			'core.modify_posting_parameters'		=> 'check_user_is_trusted',
			'core.modify_text_for_display_after'	=> 'parse_bbcodes_after',
			'core.modify_format_display_text_after'	=> 'parse_bbcodes_topicPreview',
			
//			'core.parse_attachments_modify_template_data'	=> 'check_attachment',

			'test.topic_review_modify_template_vars'	=> 'topic_review_modify_template_vars',
			'core.posting_modify_template_vars'	=> 'posting_modify_template_vars',
		);
	}

	/**
	* Load common files during user setup
	*
	* @param object $event The event object
	* @return null
	* @access public
	*/
	public function load_language_on_setup($event)
	{
		$lang_set_ext = $event['lang_set_ext'];
		$lang_set_ext[] = array(
			'ext_name' => 'marcovo/hide_bbcode',
			'lang_set' => 'hide_bbcode',
		);
		$event['lang_set_ext'] = $lang_set_ext;
		
		$this->check_user_is_trusted();
	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function topic_review_modify_template_vars($event)
	{
		if ($this->b_hide)
		{
			$event['decoded_message'] = preg_replace("#\[hide\].*?\[/hide\]#is", '{{'.$this->user->lang('HIDEBB_HIDDEN_MESSAGE')."}}\n", $event['decoded_message']);
		}

	}
	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function posting_modify_template_vars($event)
	{
//if ($this->b_hide && in_array($event['mode'], array('reply', 'quote')) && !$event['preview'] && $event['draft_id'] == 0)	
		if ($this->b_hide)
		{
			$page_data = $event['page_data'];
			$page_data['MESSAGE'] = preg_replace("#\[hide\].*?\[/hide\]#is", '{{'.$this->user->lang('HIDEBB_HIDDEN_MESSAGE')."}}\n", $page_data['MESSAGE']);
			$event['page_data'] = $page_data;
		}

	}




	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	private function check_user_is_trusted()
	{

		// Check if the is in the Trusted group
		$sql = "SELECT group_id	FROM " . USER_GROUP_TABLE . " WHERE group_id = 8 AND user_id = " . $this->user->data['user_id']; 

		$result = $this->db->sql_query($sql);
		$b_hide = $this->db->sql_affectedrows($result) ? false : true;
		$this->db->sql_freeresult($result);
		
		$this->b_hide = $b_hide;
	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	/*
	public function check_attachment($event)
	{
		if($this->b_hide)
		{
			$event['attachment'] = array();
			$event['block_array'] = array();
			$event['download_link'] = '';
		}
	}
	*/
	

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function parse_bbcodes_after($event)
	{

		$event['text'] = preg_replace_callback('#<!-- HIDE_BBCODE -->(.*?)<!-- /HIDE_BBCODE -->#s', array($this, 'hidden_pass'), $event['text']);

	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function parse_bbcodes_topicPreview($event)
	{

		$event['text'] = preg_replace_callback('#<!-- HIDE_BBCODE -->(.*?)<!-- /HIDE_BBCODE -->#s', array($this, 'hidden_pass_topicPreview'), $event['text']);

	}
	
	
	/**
	* Convert Hidden BBCode into its final appearance
	*
	* @param array $matches
	* @return string HTML render of hidden bbcode
	*/
	protected function hidden_pass($matches)
	{
		$this->template->set_style(array('styles', 'ext/marcovo/hide_bbcode/styles'));

		$bbcode = new \bbcode();
		$bbcode->template_filename = $this->template->get_source_file_for_handle('hide_bbcode.html');
		
		if ($this->b_hide) return $bbcode->bbcode_tpl('hide');
		else return $bbcode->bbcode_tpl('unhide_open') . $matches[1] . $bbcode->bbcode_tpl('unhide_close');
	}
	
	/**
	* Convert Hidden BBCode into its final appearance
	*
	* @param array $matches
	* @return string HTML render of hidden bbcode
	*/
	protected function hidden_pass_topicPreview($matches)
	{
		$this->template->set_style(array('styles', 'ext/marcovo/hide_bbcode/styles'));

		$bbcode = new \bbcode();
		$bbcode->template_filename = $this->template->get_source_file_for_handle('hide_bbcode.html');
		
		return $bbcode->bbcode_tpl('unhide_open') . $matches[1] . $bbcode->bbcode_tpl('unhide_close');

	}

}

User avatar
Leinad4Mind
Translator
Posts: 804
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: [RC] Hide BBcode

Post by Leinad4Mind » Thu Oct 29, 2015 5:05 pm

New feature to have: User on ACP could choose or by Hide BBCode or by an new Option when creating the topic saying "Hide Content from Guest".

best regards
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator

Cl0wnie
Registered User
Posts: 11
Joined: Fri Aug 17, 2012 2:27 pm

Re: [RC] Hide BBcode

Post by Cl0wnie » Wed Nov 04, 2015 11:11 am

parshakov wrote:Cl0wnie, try this:

ext/marcovo/hide_bbcode/event/listener.php

Code: Select all

<?php
/** 
*
* @package Hide_BBcode
* @copyright (c) 2015 Marco van Oort
* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2 
*
*/

namespace marcovo\hide_bbcode\event;

/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* Event listener
*/
class listener implements EventSubscriberInterface
{
	protected $db;
	protected $user;
	protected $template;

	protected $b_hide = true;

	/**
	* Constructor
	*
	* @param \phpbb\db\driver\driver $db Database object
	* @param \phpbb\controller\helper    $helper        Controller helper object
	*/
	public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\template\template $template)
	{
		$this->db = $db;
		$this->user = $user;
		$this->template = $template;

	}

	static public function getSubscribedEvents()
	{
		return array(
			'core.user_setup'	=> 'load_language_on_setup',

//			'core.modify_posting_parameters'		=> 'check_user_is_trusted',
			'core.modify_text_for_display_after'	=> 'parse_bbcodes_after',
			'core.modify_format_display_text_after'	=> 'parse_bbcodes_topicPreview',
			
//			'core.parse_attachments_modify_template_data'	=> 'check_attachment',

			'test.topic_review_modify_template_vars'	=> 'topic_review_modify_template_vars',
			'core.posting_modify_template_vars'	=> 'posting_modify_template_vars',
		);
	}

	/**
	* Load common files during user setup
	*
	* @param object $event The event object
	* @return null
	* @access public
	*/
	public function load_language_on_setup($event)
	{
		$lang_set_ext = $event['lang_set_ext'];
		$lang_set_ext[] = array(
			'ext_name' => 'marcovo/hide_bbcode',
			'lang_set' => 'hide_bbcode',
		);
		$event['lang_set_ext'] = $lang_set_ext;
		
		$this->check_user_is_trusted();
	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function topic_review_modify_template_vars($event)
	{
		if ($this->b_hide)
		{
			$event['decoded_message'] = preg_replace("#\[hide\].*?\[/hide\]#is", '{{'.$this->user->lang('HIDEBB_HIDDEN_MESSAGE')."}}\n", $event['decoded_message']);
		}

	}
	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function posting_modify_template_vars($event)
	{
//if ($this->b_hide && in_array($event['mode'], array('reply', 'quote')) && !$event['preview'] && $event['draft_id'] == 0)	
		if ($this->b_hide)
		{
			$page_data = $event['page_data'];
			$page_data['MESSAGE'] = preg_replace("#\[hide\].*?\[/hide\]#is", '{{'.$this->user->lang('HIDEBB_HIDDEN_MESSAGE')."}}\n", $page_data['MESSAGE']);
			$event['page_data'] = $page_data;
		}

	}




	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	private function check_user_is_trusted()
	{

		// Check if the is in the Trusted group
		$sql = "SELECT group_id	FROM " . USER_GROUP_TABLE . " WHERE group_id = 8 AND user_id = " . $this->user->data['user_id']; 

		$result = $this->db->sql_query($sql);
		$b_hide = $this->db->sql_affectedrows($result) ? false : true;
		$this->db->sql_freeresult($result);
		
		$this->b_hide = $b_hide;
	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	/*
	public function check_attachment($event)
	{
		if($this->b_hide)
		{
			$event['attachment'] = array();
			$event['block_array'] = array();
			$event['download_link'] = '';
		}
	}
	*/
	

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function parse_bbcodes_after($event)
	{

		$event['text'] = preg_replace_callback('#<!-- HIDE_BBCODE -->(.*?)<!-- /HIDE_BBCODE -->#s', array($this, 'hidden_pass'), $event['text']);

	}

	/**
	* Alter BBCodes after they are processed by phpBB
	*
	* @param object $event The event object
	*/
	public function parse_bbcodes_topicPreview($event)
	{

		$event['text'] = preg_replace_callback('#<!-- HIDE_BBCODE -->(.*?)<!-- /HIDE_BBCODE -->#s', array($this, 'hidden_pass_topicPreview'), $event['text']);

	}
	
	
	/**
	* Convert Hidden BBCode into its final appearance
	*
	* @param array $matches
	* @return string HTML render of hidden bbcode
	*/
	protected function hidden_pass($matches)
	{
		$this->template->set_style(array('styles', 'ext/marcovo/hide_bbcode/styles'));

		$bbcode = new \bbcode();
		$bbcode->template_filename = $this->template->get_source_file_for_handle('hide_bbcode.html');
		
		if ($this->b_hide) return $bbcode->bbcode_tpl('hide');
		else return $bbcode->bbcode_tpl('unhide_open') . $matches[1] . $bbcode->bbcode_tpl('unhide_close');
	}
	
	/**
	* Convert Hidden BBCode into its final appearance
	*
	* @param array $matches
	* @return string HTML render of hidden bbcode
	*/
	protected function hidden_pass_topicPreview($matches)
	{
		$this->template->set_style(array('styles', 'ext/marcovo/hide_bbcode/styles'));

		$bbcode = new \bbcode();
		$bbcode->template_filename = $this->template->get_source_file_for_handle('hide_bbcode.html');
		
		return $bbcode->bbcode_tpl('unhide_open') . $matches[1] . $bbcode->bbcode_tpl('unhide_close');

	}

}
I don't mean any offense by this but do you even know what you're doing? By that I mean are you even testing this yourself on your own board or you're just changing codes and hoping for the best?

Cl0wnie
Registered User
Posts: 11
Joined: Fri Aug 17, 2012 2:27 pm

Re: [RC] Hide BBcode

Post by Cl0wnie » Thu Nov 05, 2015 9:49 am

Basically I need to get this code into the listener.php file;

Code: Select all

// Check if the topic viewer has posted in a topic
$unhide = false;
if ($user->data['user_id'] != ANONYMOUS)
{
     // give hide free for a specific group by u2y
    $sql = 'SELECT group_id
        FROM ' . USERS_TABLE . "
        WHERE user_id = {$user->data['user_id']}";
    $result = $db->sql_query($sql);
    $groups = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
     
   if ($groups['group_id'] == 4 || $groups['group_id'] == 5 || $groups['group_id'] == 7)
   {
      $unhide = true;
   }
   else
   {
   $sql = "SELECT poster_id, topic_id
      FROM " . POSTS_TABLE . "
      WHERE topic_id = $topic_id
      AND poster_id = " . $user->data['user_id'];

   $result = $db->sql_query($sql);
   $unhide = $db->sql_affectedrows($result) ? true : false;
   $db->sql_freeresult($result);
   }
}
That way I'll be able to specify what groups are able to access the posts that are hidden from certain groups whether they reply or not.

Locked

Return to “Abandoned Extensions”

Who is online

Users browsing this forum: No registered users and 3 guests

cron