miniBB ® miniBB®
miniBB Support Forums
 | Forums | Register | Reply | Search | Statistics | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /   

Allowing only some registered users post reply in certain topic

Page  Page 1 of 2:  1  2  Next »  
Author Lada
Guest
#1 | Posted: 24 Jan 2008 07:44 
I would like to the subject (reply in topic) give access only some registered users, perhaps by the help of NICK?

Author Paul
Lead Developer
#2 | Posted: 24 Jan 2008 07:53 
Nickname doesn't mean anything from the technical view - you need to assign user IDs, the same as topic IDs.

The code like

$restrictedTopics=array(TOPIC_ID_1, TOPIC_ID_2, ...);
//specify certain topics above

$allowedRestUsers=array(USER_ID_1, USER_ID_2, ...);
//specify certain user IDs above

if(isset(topic) and $topic>0 and in_array($topic, $restrictedTopics) and !in_array($user_id, $allowedRestUsers) ) $poForums[]=$forum;

pasted at the end of the bb_plugins.php should work.

Author Persian
Registered
#3 | Posted: 22 Jul 2008 08:59 
is it possible to make viewing some thread just for registered users, means: if not registered can't go into the thread, it must be registered to allow him go in the thread!

Thanks!

Author Paul
Lead Developer
#4 | Posted: 24 Jul 2008 03:59 | Edited by: Paul 
Put the code below in bb_plugins.php (substitute for YOUR_TOPIC_ID):

if($user_id==0 and $action=='vthread' and $topic==YOUR_TOPIC_ID){

$title=$l_accessDenied;

$errorMSG='Only registered users are allowed to view this thread.<br />';

//Loading header & warning page
echo load_header();
echo ParseTpl(makeUp('main_warning'));

//Loading footer
$endtime=get_microtime();
$totaltime=sprintf ("%01.3f", ($endtime-$starttime));
if(isset($includeFooter)) include($includeFooter); else echo ParseTpl(makeUp('main_footer'));
exit;
}


Author Persian
Registered
#5 | Posted: 24 Jul 2008 08:24 
Paul
thanks...but nothing happen...when i edit some code in it just showing that message in every page even for sign up, "Only registered users are allowed to view this thread"
...how can i set just for some thread not all...thank u so much!!!

Author Paul
Lead Developer
#6 | Posted: 24 Jul 2008 10:09 
Fix: the code above should contain $topic instead of $topic_id. Everything else works on my side, so I don't know what's happening with your code, sorry.

Author Persian
Registered
#7 | Posted: 25 Jul 2008 03:20 
Paul
I did but again not working....anyway...thank you so much mr.paul ;)

Author Paul
Lead Developer
#8 | Posted: 25 Jul 2008 04:01 
Persian
Just make sure you are pasting topic ID properly. Everything should work, it's a primitive code.

Author Persian
Registered
#9 | Posted: 25 Jul 2008 09:16 
Paul
thank you so much...it's working now ;)

is it possible also for thread? or just topic?

Author Paul
Lead Developer
#10 | Posted: 25 Jul 2008 11:00 
What is the difference between a thread and a topic in your opinion?

Author Persian
Registered
#11 | Posted: 25 Jul 2008 12:14 
Paul

yah, you are right....

I mean this is a thread :

forum/1_0.html >> (thread)

and this is the topic inside that ("forum/1_0.html")

forum/1_1_0.html >> (topic)

I want to do it for (forum/1_0.html)

is it possible?

Author Paul
Lead Developer
#12 | Posted: 25 Jul 2008 12:36 
Here is the code, you just need to modify the above example a bit:

if($user_id==0 and $action=='vtopic' and $forum==YOUR_FORUM_ID){

$title=$l_accessDenied;

$errorMSG='Only registered users are allowed to view this forum.<br />';

//Loading header & warning page
echo load_header();
echo ParseTpl(makeUp('main_warning'));

//Loading footer
$endtime=get_microtime();
$totaltime=sprintf ("%01.3f", ($endtime-$starttime));
if(isset($includeFooter)) include($includeFooter); else echo ParseTpl(makeUp('main_footer'));
exit;
}


Author Persian
Registered
#13 | Posted: 25 Jul 2008 17:20 
Paul
wow...thank you so much it's working now....one more question mr.paul:

can i put for two or three forum also?

Author tom322
Registered
#14 | Posted: 25 Jul 2008 18:49 
Persian:
can i put for two or three forum also?

You could try:

if($user_id==0 and $action=='vtopic' and ($forum==YOUR_FORUM_ID or $forum==YOUR_FORUM_ID2 or $forum==YOUR_FORUM_ID3)){

Author Persian
Registered
#15 | Posted: 27 Jul 2008 09:07 
it's working now...thanks....;)

Page  Page 1 of 2:  1  2  Next » 
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications / Allowing only some registered users post reply in certain topic Top

Your Reply Click this icon to move up to the quoted message

 Short link for this topic:

 ?
Only registered users are allowed to post here. Please, enter your username/password details upon posting a message, or register first.


Before posting, make sure your message is compliant with our forum posting rules. If not, it may be locked or deleted with no explanation.
 
 
miniBB Support Forums Powered by Forum Software miniBB ® Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contacts
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.
Captcha Addon for miniBB