REGISTER or LOGIN to have the annoying ads removed.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Jammerx2's "Guests cannot view threads" Edited
#1
Code:
<?php
$plugins->add_hook('showthread_start', 'gcvt_thread');
$plugins->add_hook('archive_thread_start', 'gcvt_thread');

function gcvt_info()
{
    return array(
  'name'    => 'Guests Can\'t View Threads',
  'description'    => 'Guests cannot view threads.',
  'website'  => 'http://mybbplug.in/',
  'author'  => 'Jammerx2',
  'authorsite'    => 'http://mybbplug.in/',
  'version'  => '1.1',
  'guid'  => '8ac34edb831b6a420c48602ed5384b59'
    );
}

function gcvt_activate()
{
}

function gcvt_deactivate()
{
}
function gcvt_thread()
{
    global $db, $mybb,$lang, $thread;

  if(!$mybb->user['uid'] || $mybb->user['usergroup'] == 0 || $mybb->user['usergroup'] == 5)
  {
  error_no_permission();
  }

    $lang->send_thread = "";
}
?>

Just save it as php then upload it in "/inc/plugins/" then activate it in your adminCP This is working in mybb 1.6.5

This will redirect the guests and un-activated account whenever they're gonna try to view thread contents.

Please let me know if there's a vulnerability in this code. I'm really noob at PHP XD

Credits to Jammerx2
Reply
#2
I will try , thank man
Reply
#3
Redirect you to member.php?action=profile&uid=8?
If this 'plugin' does infact work Why redirect to user 8?
You could also add the boardurl using some simple php aswell as the users uid if thats what your trying to achieve by the redirect.
Although redirecting to an error would be much more suitable.

Is this your first plugin?
Reply
#4
(Dec 13, 2011, 11:37 PM)BleepyEvans Wrote: Redirect you to member.php?action=profile&uid=8?
If this 'plugin' does infact work Why redirect to user 8?
You could also add the boardurl using some simple php aswell as the users uid if thats what your trying to achieve by the redirect.
Although redirecting to an error would be much more suitable.

Is this your first plugin?

Yeah, it is my first time editing something XD. thanks for letting me know XD

Fixed.
Reply
#5
Id like to do some testing and experimenting with this, you've given me some ideas.
Reply
#6
This is a good plugin however I think it should be modded to where it disables print thread as well. They can still view threads via print thread unless go and edit your showthread template.
Reply
#7
good plugin , thanks !
Reply
#8
how to redirect guests to register link ?
Reply
#9
Change 'error no permissions' to 'GOTO(your register URL)'
Let me know if that doesn't work because there's a couple of different ways
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [Plugin] View Member Reported Posts Xerotic 16 9,356 Aug 18, 2015, 06:33 PM
Last Post: Glungie
  user groups can't access specific threads michalrudas007 0 790 Aug 19, 2012, 08:05 PM
Last Post: michalrudas007
  user groups can't access specific threads michalrudas007 0 894 Aug 19, 2012, 08:01 PM
Last Post: michalrudas007

Forum Jump:


Users browsing this thread: 1 Guest(s)