PDA

View Full Version : Permission to post, only if userid is the owner of the thread?


ArchangelX
01-22-2008, 07:18 AM
Hi all...I know that you can restrict users by usergroup...but I have a comment system that I'm trying to figure out...where I only want the user that owns the comment section to post. It's like their own personal journal sorta thing.

I'm trying to figure out what the code is that would keep only the userid of the person that owns the journal to post.

I hope this makes sense...thanks for the help...I'm really new to this.

Dismounted
01-22-2008, 07:41 AM
So, basically a blog?

ArchangelX
01-22-2008, 07:53 AM
Yepz...sorta like that. I'm thinking I can do it in the template rather than in the PHP.

Similar to how Member Info works...I just want the Add Comment button to not show if the person doesn't own the page.

I've tried <if condition="$userinfo[userid] == $vbulletin->userinfo[userid]">

But it doesn't work. Am I doing something wrong? I've included global.php in the .php for the system.

Dismounted
01-22-2008, 07:56 AM
<if condition="$thread['postuserid'] == $vbulletin->userinfo['userid']">
It doesn't prevent someone from accessing the post reply URL directly though...

ArchangelX
01-22-2008, 07:59 AM
Well...see...that's the problem. This isn't using VB's thread system...it's a homegrown...that's why I just want to disable it by not showing it?

So...basically...just giving the person the only allowance to make comments. I suck at coding...I've been looking for the answer all night...they say the best way to learn is to do it yourself, and that's what I've been doing, but it's hard...heh.

Thanks for your help...any ideas on how to restrict it simply on User ID?

Dismounted
01-22-2008, 08:12 AM
Well, I really can't help you if you're not using the vBulletin thread system, as I don't know how it works.

ArchangelX
01-22-2008, 08:19 AM
Ahh...well, I basically just want to make an <if> statement that excludes the member if he's not the owner of the page...just like memberinfo. To explain it again...it has nothing to do with the comments itself...I just want to hide a button.

So how would I hide a button depending on whether or not that person owned that page...you know what I mean? Like say if it was a button on User CP...

Gah. Still searching...

Dismounted
01-22-2008, 08:37 AM
It is an easy conditional, but I don't have any information on how the script works, so no matter how much you explain to me in words, I won't have the variables to compare.

ArchangelX
01-22-2008, 08:41 AM
Woot! Figured it out! I was able to use the ids that I had alread defined in the MySQL tables.

Thanks for your help, Dismounted...I sincerely appreciate it! Sorry if I sounded frustrated, I've been working at this all day! Thanks!

lordtopcat
03-20-2008, 07:19 PM
Just out of interest, how did you get it to work?

Cheers

King Kovifor
03-20-2008, 08:22 PM
Just out of interest, how did you get it to work?

Cheers

Mostly likely was done by a simple if() statement. This would require having a "userid" stored within the table on who started it. And then just using vBulletin variables to check it.

if($userid != $userid_fetched_from_database)
{
print 'you cannot post here';
}