Help for Hidden MOD
Posted March 3rd 2015, 1:46am
I'm looking for a hidden code for phpbb3.
Defaultly one can view if become a member after registering
Now I want something will be hidden to all members, and except some specials can view it
Very appreciated for help
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1
Help for Hidden MOD
Posted March 3rd 2015, 1:09pm
I'm not sure what you mean here. Do you want a way to keep people from seeing posts, or are you looking for a BBcode that hides text from everyone except those in a specific usergroup?
φ
Posts: 1600
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Help for Hidden MOD
Posted March 3rd 2015, 8:34pm
Yes, only members which have a condition can view it
The condition is the number of their posts, for example, I check his {USER_POST}, a variable I have for him,
If {USER_POST} > 5 then he can view the infomation
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1
Help for Hidden MOD
Posted March 6th 2015, 2:13pm
If you want this to be part of a BBcode, then it would be difficult to add. It would require modifying the includes/bbcode.php file to check for a specific custom BBcode, and using preg_replace_callback() to add the functionality.

This modification has been done on this board with the HIDE and MEMBER BBcodes. Since you want this for phpBB 3.1, I will check whether the modifications made here will work on a phpBB 3.1 board. If they do, I will post them as a reply.
φ
Posts: 1600
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Help for Hidden MOD
Posted March 6th 2015, 9:14pm
My phpbb3 version is 3.0.12. Thanks for your further help
φ
Posts: 35
Joined: May 23rd 2013, 9:51pm
Likes Received: 1
1
#6
Help for Hidden MOD
Posted March 10th 2015, 10:40am
Here is how to create a [member] BBcode that will only display content to members. First, create a [member] BBcode with usage:

[member]{TEXT}[/member]

and replacement:

{TEXT}

Now, open includes/bbcode.php and find this line:

$message = preg_replace($preg['search'], $preg['replace'], $message);

replace it with:

if ($search=='!\[member:$uid\](.*?)\[/member:$uid\]!is' && !$user->data['is_registered']) {
$message = preg_replace($preg['search'], '<blockquote><b>Please log in to view this content.</b></blockquote>', $message);
}
else {
$message = preg_replace($preg['search'], $preg['replace'], $message);
}

You should now have a working [member] BBcode that displays its contents only to members.
φ
Posts: 1600
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357

Who is online

Users browsing this forum: No registered users and 0 guests