PDA

View Full Version : [v1.2] Edit / Report Button Hack


Dean C
03 Nov 2002, 14:41
Edit / Report Button Hack - based on your permissions

What does this hack do?

Basically it allows you to insert a variable into your postbit template and if you posted the thread then it shows up with the edit link/button. If you didn't post it it shows the report link.

This is just like the hack installed here at vbulletin.org

Latest Version: 1.3

Thanks to:

- Hellsatan (for helping with a parse error)
- PPN for beta testing v1.2
- Dan_UPC for fixing two bugs


+++++++++++++++++ Extra Notes +++++++++++++++++
If you would like the report button in the default vbulletin style then here is the link:

http://www.vbulletin.org/forum/attachment.php?s=&postid=325196
________________________________________________

If you install this hack then please click the INSTALL (http://www.vbulletin.org/forum/misc.php?s=&action=install&threadid=45344) button.

Regards

- miSt

assassingod
03 Nov 2002, 14:44
Ah, great work miSt!:) Except wheres the download file?

Chris M
03 Nov 2002, 14:47
Nice:)

Satan

assassingod
03 Nov 2002, 14:47
Yeah, there is is:) Thanks miST, will use this

Dean C
03 Nov 2002, 14:50
Thanks assasingod :)

I didn't add the attachment in right away because i wanted to include the install link in the file :)

Regards

- miSt

Dean C
03 Nov 2002, 15:58
Note: Minor bug fix.... Re-apply the changes to showthread.php

Regards

- miSt

assassingod
03 Nov 2002, 16:35
Looks good. I had no troubles at all with it:)

Ps. Check your PM inbox miSt;)

DrkFusion
03 Nov 2002, 16:36
Mist you stole my friends avatar!!
Simple, but nice hack:)

Thats one for your profile ;)
Keep it coming
-Arunan

LOD-squa
03 Nov 2002, 16:36
Hey Nice hack Thanks!

DrkFusion
03 Nov 2002, 16:50
I was gonna install this, but just saw i had put the code in the phpinclude template cuz I am lazy, maybe when I have time I will move it to showthread.php :p

Good Job Though
-Arunan

Dean C
03 Nov 2002, 16:51
Thanks for the feedback..

A new version is on the way..

Regards

- miSt

assassingod
03 Nov 2002, 16:56
Originally posted by DrkFusion
I was gonna install this, but just saw i had put the code in the phpinclude template cuz I am lazy, maybe when I have time I will move it to showthread.php :p

Good Job Though
-Arunan

Does it work if you place it in the phpinclude template? Because technically this could be a template mod if it does:p

Check you PMs miSt :sleep:

Dean C
03 Nov 2002, 17:02
I did and thats why there will be a new version on the way.

In the new version you'll have to put the code into showthread.php....

- miSt

assassingod
03 Nov 2002, 17:04
Ah, I get it. Cool:D

Got my PM?:ninja:

Dean C
03 Nov 2002, 17:08
Yes I got your PM..

A new version will be released soon!

- miSt

assassingod
03 Nov 2002, 17:25
Cool - Cant wait
(Check you PM box again;))

Unknown553
03 Nov 2002, 17:52
This has already been done before because I've had it installed for quite sometime now. However, it was never formally published.

Here's the thread, from the Requests forum: http://www.vbulletin.org/forum/showthread.php?s=&threadid=32414

assassingod
03 Nov 2002, 17:59
Yeah, but look at the date is was posted:
11-15-01 12:24 PM
Nearly a year ago - People arent going to see threads that old. Besides, miSt's hack is differently coded to fireflies:P

Dean C
03 Nov 2002, 20:20
Indeed...

The next release candidate will be coded differently too..

Hopefully i'll sort it out before Monday night :)

- miSt

assassingod
03 Nov 2002, 20:23
:DCant wait - Love this hack!
Great work again miSt
Edit:
I suppose this could be used for other things as well?

camikazi2k
07 Nov 2002, 17:26
DOnt get it
i did put the
$post[editreport]
in the postbit template
but whats the point if there is already a edit button in the thread?

assassingod
07 Nov 2002, 17:55
What it does is show the Edit Button if you posted it, and shows the report button if you dont.

Dean C
07 Nov 2002, 18:34
Update: I'm having huge problems with my testboard so anyone with a testboard that can help me would be highly appreciated :)

PM me

I'm normally on between 7.30-8.30pm GMT

Regards

- miSt

kreftt
07 Nov 2002, 19:16
nice

it checks for your admin status as well, very nice

2 minutes --> works

thx

kreftt

Areku
13 Nov 2002, 11:24
Regarding admin status, can I add a new groupid so my coadmin (different than admin) can still see the edit button everywhere?

The code for this would be appreciated!

Dean C
13 Nov 2002, 19:12
Yes whats yourusergroupid?

- miSt

Areku
14 Nov 2002, 09:01
Say that in addition to Admin (groupid 6) I wanna add Coadmin (groupid 9).

Dean C
15 Nov 2002, 16:27
If you already have the hack installed find this line:


if (($bbuserinfo[usergroupid] == 5) OR ($bbuserinfo[usergroupid] == 6) OR ($bbuserinfo[usergroupid] == 7) OR ($post[userid] == $bbuserinfo[userid])){


And change it to:


if (($bbuserinfo[usergroupid] == 5) OR ($bbuserinfo[usergroupid] == 6) OR ($bbuserinfo[usergroupid] == 7) OR ($bbuserinfo[usergroupid] == 9) OR ($post[userid] == $bbuserinfo[userid])){


- miSt

lalo landa
23 Nov 2002, 18:18
i doit a change..
I prefer an image button.

Then i made a report.gif and upload in images foulder (the report button in your forum style)

Remplace in showthread...



////////// Start edit or report buttons hack //////////
if (($bbuserinfo[usergroupid] == 5) OR ($bbuserinfo[usergroupid] == 6) OR ($bbuserinfo[usergroupid] == 7) OR ($post[userid] == $bbuserinfo[userid])){
$post[editreport] = "<a href=\"editpost.php?s=$session[sessionhash]&action=editpost&postid=$post[postid]\"><img src=\"./images/edit.gif\" border=\"0\" alt=\"Edit/Delete Post\"></a> <a href=\"report.php?s=$session[sessionhash]&postid=$post[postid]\"><img src=\"./images/report.gif\" border=\"0\" alt=\"Report\"></a>";
}else{
$post[editreport] = "<a href=\"report.php?s=$session[sessionhash]&postid=$post[postid]\"><img src=\"./images/report.gif\" border=\"0\" alt=\"Report\"></a>";
}
/////// End edit or report buttons hack /////////////



and i made 1 change more..
I'm an admin and if i want to report some post to the moderators i can't ... then i add the report button to admins, mods, supermods and the user who made the post..

Sorry about my verry poor english..

I hope u understand and enjoy the modificattion

Cool Hack!

Dean C
23 Nov 2002, 21:41
Yes i do understand what you mean..

All these things will be in v2 mate :)

I got exams starting a week on monday so i haven't got time to test the next version out so im trying to get some help off someone :)

Regards

- miSt

Dean C
24 Nov 2002, 13:15
Here's an image for the report in standard vbulletin 2.2.x style :)

Dean C
24 Nov 2002, 13:21
Update: Version 1.1 has been released.

Please read this (http://www.vbulletin.org/forum/showthread.php?s=&postid=318187#post318187) post for more info

Regards

- miSt

Chris M
24 Nov 2002, 13:22
Cool:)

Satan

Dean C
24 Nov 2002, 13:23
Indeed

Kars10
24 Nov 2002, 13:26
Man this hack is so cool!!!
Thanks 4 sharing with us.

/me klicks install!

Dean C
24 Nov 2002, 13:27
Thanks Minifreunde

Glad you like it

Regards

- miSt

N9ne
24 Nov 2002, 14:46
I've got a question...I saw that you're using an if statement, with the usergroupids for mods, smods and admins I think...that will mean it's going to show the edit button to normal moderators, even if they don't mod that forum right?

(note to people who have conditional templates installed: this can be done through the postbit template)

Good work MiSt, release more hacks :p

Dean C
24 Nov 2002, 15:36
Yes thats correct lol

- miSt

N9ne
24 Nov 2002, 16:12
Then shouldn't you use the ismoderator function instead?

Dean C
24 Nov 2002, 17:03
Hmmm yea i thought about doing this just after i read your post... I'll try n beta test it now...

- miSt

Dean C
24 Nov 2002, 17:12
Ok im updating the file now :)

- miSt

Dean C
24 Nov 2002, 17:20
Update:

V1.2 now released :)

http://www.vbulletin.org/forum/showthread.php?s=&postid=318187#post318187

- miSt

N9ne
24 Nov 2002, 17:25
hehe, glad I could help :D now if you are not a moderator of the forum the post is in, you will not see the edit button ;)

Kars10
24 Nov 2002, 17:31
Ive updatet to 1.2. and it works like a charm on 2.2.8!!
Thank you Mist... :)

N9ne
24 Nov 2002, 18:13
I'm gonna install this hack later, I think I can't use the ismoderator function with the conditionals...although I'm not sure, I don't have enough time to "try" it, so I'll just install this hack :)

Dean C
24 Nov 2002, 18:19
Awesome :)

Thanks for installing btw N9ne :)

- miSt

N9ne
24 Nov 2002, 19:56
You need to fix one more thing, if you are not the post creator, but can edit the post, you can see the edit link, but not the report link ;)

Dean C
25 Nov 2002, 18:54
Yes but if your a staff member then why would you need to report the post seems as the report emails goto the staff members :)

- miSt

N9ne
25 Nov 2002, 19:06
I remembered that after I posted ;)

but it's still cool to report someone's post even if you're admin lol...anyway...good work on the hack, I've got it installed.

Dean C
26 Nov 2002, 18:58
Awesome get all your friends and future grandchildren to install too :)

- miSt

Boofo
09 Dec 2002, 09:32
Great hack, Mist. :) Just a question or two, though.

What if you don't allow your Mods to edit posts in certain forums? And what if I want to report a post to my moderators if I come across one that I think they should know about? The only thing is that you don't want to have the report button show up on your own post, Admin or not. But I think you need it there, otherwise.

Dean C
09 Dec 2002, 17:04
I thought this is why most sites have a forum for their staff.

To be honest i can't see a way around this...

Feel free to post any ideas :D

- miSt

Boofo
09 Dec 2002, 22:52
It's simple, just do 2 pieces of code instead of combining them into one. Sometimes a Mod or Admin can run across a message that they want the other Mods to know about and it would be easier to report it in the post than to go to a separate area and report it, you know what I mean? :)

Edit: That's ok, Mist, I went ahead and installed Firefly's code for this. It handles it like I explained. Good hack, though. Congrats! ;)

Dean C
10 Dec 2002, 16:42
Are you sure firefly's code shows this for admins?

I dont think it does..

- miSt

Boofo
10 Dec 2002, 16:59
Originally posted by Mist
Are you sure firefly's code shows this for admins?

I dont think it does..

- miSt

Yes, ma'am, it does. That's what I was using before I tried your hack. It shows the edit button AND the report button for Admins and Moderators, like it really should be. :) Just the regular users will only see one or the other.

N9ne
10 Dec 2002, 18:06
Originally posted by Boofo


Yes, ma'am, it does. That's what I was using before I tried your hack. It shows the edit button AND the report button for Admins and Moderators, like it really should be. :) Just the regular users will only see one or the other.

LOL!

" ma'am "

Classic, Mist won't be happy :D

Dean C
10 Dec 2002, 18:30
Ahhhh i see... so it shows both...

I'll intigrate this into the hack then... brb

- miSt

Bison
11 Dec 2002, 13:41
Nice hack!

Dean C
11 Dec 2002, 19:17
Thanks ^ :D

- miSt

Boofo
11 Dec 2002, 19:23
Originally posted by Mist
Ahhhh i see... so it shows both...

I'll integrate this into the hack then... brb

- miSt

Let me know when you do this and I will take another look at it. :)

Dean C
11 Dec 2002, 19:30
I'm just waiting on a question

It should be done by the weekend :)
- miSt

Boofo
28 Jan 2003, 21:59
Ok, I finally found a way to have the edit button only show up for the user who wrote the post and the moderator of that forum. If you are not a moderator of the forum, you will not see the edit button unless it is your post. First of all, you need to install Logician's Dynamic Template hack. Once that is installed, go to your "postbit" template and enter the code like this and viola!

[[((ismoderator($thread['forumid'])) or $post[userid]==$bbuserinfo[userid])]]
$post[editpost]
[[/((ismoderator($thread['forumid'])) or $post[userid]==$bbuserinfo[userid])]]

NOTE: Admins and Supermoderators will see the edit button at all times, since they are usually allowed to edit all posts.

Dean C
29 Jan 2003, 16:42
Hehe i gave up on this project - i know so much more. I'll try and get this done without using dynamic templates :)

- miSt

Boofo
29 Jan 2003, 16:48
I gave you the answer. Shouldn't be too hard.

Dean C
29 Jan 2003, 16:49
The point of this was for the report button as well - that's the problem. I wanted to get it all in one code statement but i have an idea how to do it when i get some time.

- miSt

Dan_UPC
18 Feb 2003, 13:34
Mist,

Great hack but there are a couple of problems in the current version:

1) you are running ismoderator() for each post on the page. This is serious because if you have 40 posts on the page, it would add 40 queries to the page and that's just plain murder for the server.

2) if you have a max edit time, the button should change from edit to report once the user is no longer able to edit the post.

I've attached your hack in this post with the above problems fixed.

Dean C
18 Feb 2003, 13:39
Thanks buddy for that fix. I've updated the first post and added credits in the textfile to you too.

Regards

- miSt

Natch
18 Feb 2003, 14:03
Can you advise on which changes need to be made if just upgrading from 1.2 to 1.3 ?

Dean C
18 Feb 2003, 14:06
If you have the instructions from v2 then simply undo the changes to the php files and then re-apply the new changes in v3.

If you haven't then i'll write a textfile on how to upgrade

- miSt

Natch
18 Feb 2003, 14:11
LOL - I just looked at the instructions and I understand how this things works ...

I'll nut it out - thanks to you both :) :)

/me is a bit lazy eh ?

Dean C
18 Feb 2003, 14:18
No it's understandable ;) hehe

- miSt

Kohhal
15 Jul 2003, 09:10
Another great hack Mist, makes you wonder why these things were never default....
Maybe you can help me out here (http://www.vbulletin.org/forum/showthread.php?s=&postid=416686#post416686) again?