miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | 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
Partaker
#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 
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
Partaker
#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
Partaker
#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
Partaker
#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
Partaker
#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
Partaker
#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
Active Member
#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
Partaker
#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
 Share Topic's Link

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


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑