PDA

View Full Version : specific users to start new threads


Roxie
06-18-2002, 05:33 PM
I was wondering if it was possible to only let certain users start threads in a forum. I want my members to be able to have sort of a journal. They can start the thread in their forum (no one else can), but others can reply. Is this possible?
Thanks

Logician
06-18-2002, 05:38 PM
you can put thread starters in a special user group and assign forum access permissions so that only this group can create new threads in that forum and others can reply.. :)

Chris M
06-18-2002, 05:39 PM
Of course...

Just move them into another usergroup, say named "Journal", and set the Forum Permissions for their forum for that usergroup and the Registered usergroup, making sure that the "Journal" members can start new threads in that forum, but the Registered members can only reply:)

Satan

Chris M
06-18-2002, 05:41 PM
Lol...

Logican beat me to it again!:)

Satan

Broekie
06-18-2002, 06:02 PM
Actually, I was going to do something like this too

But, without using usergroups, 'cause otherwise I would have to make a lot of different groups :)

The idea I came up with: a few subfora where only the admins, super moderators and the moderators of that specific subfora can post new threads.

But then I'll need a peace of code to check wheter or not a user is moderator of that subforum.



Btw, a lot of hacks that concern moderators use if usergroup = 5, but that's a special usergroup at my board :D

Roxie
06-18-2002, 07:30 PM
yea, I will have to make a bunch of different usergroups, but I will see how that works.
Thanks!
:)

Logician
06-19-2002, 06:04 AM
If you dont want to use usergroups and access permissions and if you need to hack that's the line you need :

if ($bbuserinfo[usergroupid]!=X AND $forumid=Y) { show_nopermission();exit;}

This allows only usergroup X to pass the line when forumid is Y (You can add it to newthread.php for new threads, newreply.php for new replies)

for specific users choose this one:

if ($bbuserinfo[userid]!=X AND $forumid=Y) { show_nopermission();exit;}

Same applies, only userid X can pass the line in forum Y.

Hope this helps..

Broekie
06-19-2002, 07:40 AM
Yeah well, I figured that out allready, but I'd like moderators (which are actually users that are in the Registered usergroup) to be able to start new threads as well.

So, how about this:

if (ismoderator($forumid)) AND $forumid=Y OR $forumid=Z { code to continue }
elseif ($bbuserinfo[userid]!=W AND $bbuserinfo[userid]!=X AND $forumid=Y OR $forumid=Z) { show_nopermission();exit;}


Would that work?

btw, one more little question, where to put this code and what code should be placed at the "Code to continue" part? ;)

Logician
06-19-2002, 08:00 AM
himm.. the code:


if (!ismoderator($forumid) AND ($forumid==X OR $forumid==Y))
{show_nopermission();exit;}


should do the trick.

For new threads: in newthread.php insert it before:


if ($foruminfo[allowposting]==0) {
eval("standarderror(\"".gettemplate("error_forumnoreply")."\");");
exit;
}


For new replies: in newreply.php before:


updateuserforum($threadinfo['forumid']);

Broekie
06-19-2002, 08:04 AM
thanks :)

Actually, I just came up with the idea to use if != moderator too, so I surfed to this post to tell you but then I saw you allready posted that code :D

And even more thanks for giving the location to put the code :)

btw, I'd like it template driven. This code is correct, isn't it?


if (!ismoderator($forumid)) AND ($forumid=Y OR $forumid=Z))
{eval("standarderror (\"".gettemplate "error_newthreadnotallowed")."\");");exit;}

Broekie
06-19-2002, 08:22 AM
Found a bug: $forumid should be $foruminfo[forumid] :)
and some more in my code, a space to much (twice) and a ( missing

this is how it should be (for those interested in this):


if (!ismoderator($foruminfo[forumid]) AND ($foruminfo[forumid]=X OR $foruminfo[forumid]=Y)){
eval("standarderror(\"".gettemplate("error_newthreadnotallowed")."\");");
exit;
}


place it in newthread.php or newreply.php as Logician specified.
And make a template called error_newthreadnotallowed with something like "Sorry, but you can't post new threads in this subforum. " or whatever you want ;)

Logician
06-19-2002, 09:13 AM
Originally posted by Broekie
Found a bug: $forumid should be $foruminfo[forumid] :)
and some more in my code, a space to much (twice) and a ( missing
nope not a bug.. You should be fine with "$forumid" as well.. :)

you are correct on ( missing..(edited) and your sample of template driven error page is correct either..(nice work!)

BTW If you want to release it with your name, be my guest.. :) But I still think access permissions will be enough in many cases..

Enjoy..
Logician

Broekie
06-19-2002, 12:58 PM
Originally posted by Logician

nope not a bug.. You should be fine with "$forumid" as well.. :)

that gave a parse error on that line :)

Originally posted by Logician


BTW If you want to release it with your name, be my guest.. :) But I still think access permissions will be enough in many cases..

Enjoy..
Logician

is this release-worthy then?
I mean, it's just a very small hack...

Logician
06-19-2002, 01:39 PM
Originally posted by Broekie

that gave a parse error on that line :)

It was because of missing ) not $forumid..

is this release-worthy then?
IMO no, not release - worthy. As I said I wouldnt even use it because access permissions do the trick in most cases.. :)

Cya,
Logician

Broekie
06-19-2002, 01:51 PM
Originally posted by Logician

It was because of missing ) not $forumid..


I'll have to disagree with you here
I got a parse error on line 30 - the line with if (!ismoderator($forumid)) AND ($forumid=Y OR $forumid=Z))
and after I replaced $forumid with $foruminfo[forumid] the parse error on that line was solved
The parse error I got after that was on line 31, and that was indeed due to the missing ( :)

Logician
06-19-2002, 02:15 PM
Originally posted by Broekie

I got a parse error on line 30 - the line with if (!ismoderator($forumid)) AND ($forumid=Y OR $forumid=Z))
and after I replaced $forumid with $foruminfo[forumid] the parse error on that line was solved
The parse error I got after that was on line 31, and that was indeed due to the missing ( :)

IMO this is because of ) problem..

Try to reapply:

if (!ismoderator($forumid) AND ($forumid=1 OR $forumid=2))

Does this line give you a parse error? I think not.. :)

Broekie
06-19-2002, 02:44 PM
* Broekie takes his eraser and erases his last post

Did I say that didn't work?
I did not! ;)

You're right, it works. I guess the parse error was due to a typo at my side. It must be :)


I now see what ) you mean, and indeed, that must have been the missing character.

Broekie
08-18-2002, 10:16 AM
I just noticed a bug in the code :)

it should be $forumid==X (with dubble = ) :)