Page 1 of 1

bbcode request

Posted: Wed Nov 12, 2014 9:22 am
by huddy
We currently have a bbcode that's content is shown to registered members only. This is part of the advance editor function - hidden tag

I would also like a similar bb code that shows content for registered members but with a certain criteria.. Registered for at least 30 days and with a post count of 50 for example.


Re: bbcode request

Posted: Wed Nov 12, 2014 10:02 am
by huddy
My guess is that it would be a copy of this section in /includes/abbcode.php

Code: Select all

	* Parsing the hidden tag - Second pass.
	* @param string		$in		post text between [hidden] & [/hidden]
	* @version 3.0.6
	function hidden_pass($in)
		global $user;

		if ($user->data['user_id'] == ANONYMOUS || $user->data['is_bot'])
			return str_replace(array('{HIDDEN_ON}', '{HIDDEN_TEXT}'), array($user->lang['HIDDEN_ON'], $user->lang['HIDDEN_EXPLAIN']), $this->bbcode_tpl('hidden'));
		//	$in	= make_clickable(trim(str_replace('\"', '',preg_replace('#<!-- ([lmwe]) --><a class=(.*?) href=(.*?)>(.*?)</a><!-- ([lmwe]) -->#si','$3',$in))));
			$in	= make_clickable(trim(preg_replace('#<!-- ([lmwe]) --><a class=(.*?) href=(.*?)>(.*?)</a><!-- ([lmwe]) -->#si','$3', $in)));
			$in	= str_replace(array("\r\n", '\"', '\'', '(', ')'), array("\n", '"', ''', '&#40;', '&#41;'), trim($in));
			return str_replace(array('{HIDDEN_OFF}', '{UNHIDDEN_TEXT}'), array($user->lang['HIDDEN_OFF'], $in), $this->bbcode_tpl('unhidden'));

Re: bbcode request

Posted: Thu Nov 13, 2014 3:20 am
by Pony99CA
Standard BBCodes can't access the phpBB database, so they can't do things like check if a user is registered or not.

To do that, you'll probably need an extension, too, not just a BBCode (which is probably why your topic was moved to Extension Requests instead of Custom BBCodes).


Re: bbcode request

Posted: Thu Nov 13, 2014 8:09 am
by VSE