vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Allow all members to edit first post of a thread if it has certain prefix (https://vborg.vbsupport.ru/showthread.php?t=279337)

0lly 02-29-2012 08:53 AM

Allow all members to edit first post of a thread if it has certain prefix
 
I would like to make it so that any member of my forum can edit the first post of a thread if it had a specific prefix.

EG: When a member posts a thread, they can choose a prefix called "editable", which then allows any member of the forum to edit that post.

So like, on my gaming forum, if I have a thread dedicated to one console, the first post can be used to keep track of all the latest news. I want to be able to use it as an index type of thing where users can add links to news articles etc with a few other ideas floating around in my head.

I tried doing it for ages but couldn't get it to work. What I did was ducplicate the "editpost.php" file and called the duplicate "editable.php". I tried adding some conditonals for the prefix but I'm not exactly very good at php so I couldn't figure out how to edit the permissions while fitting the conditional in :p

Thanks!

BirdOPrey5 03-03-2012 05:26 PM

This idea grabs my attention- I have some ideas I may play around with. No promises or estimate though so if someone else wants to do this feel free to jump in.

Simon Lloyd 03-04-2012 10:09 AM

1 Attachment(s)
Here's my first shot at it, [S]i haven't tested [/S]tested it minimally on test forum, so you can be the guinea pig :)

BOP5, feel free to take this and edit change it to make it work if it doesn't, i just saw this post and knew i could knock something out that may help :)

BirdOPrey5 03-04-2012 10:55 AM

Quote:

Originally Posted by Simon Lloyd (Post 2306003)
Here's my first shot at it, [S]i haven't tested [/S]tested it minimally on test forum, so you can be the guinea pig :)

BOP5, feel free to take this and edit change it to make it work if it doesn't, i just saw this post and knew i could knock something out that may help :)

Thanks but I don't think that is what he is looking for. This will allow the original author to edit the first post indefinitely...

He wants to allow ALL users to be able to edit the first post- almost like a "Wiki"

My thought was to mark a thread as a "Wiki Thread" and if it was marked as a "Wiki Thread" go ahead and show the "Edit" button to everyone and then allow everyone to edit it.

In my testing so far however editpost.php does not have the hooks necessary to bypass the permissions- so what I'm trying to figure out is if I can intercept the permissions themselves somewhere to give everyone permission to edit a wiki-thread.

Unfortunately making a copy of editpost.php without the permission checks isn't working either... It's actually very very weird behavior- it seems to update the post cache but somewhere along the line another permission check must fail and it doesn't update the post... so it looks like it works but a little later when I come back all the "edits" I thought I did had been "magically" undone... so that is definitely not the avenue to pursue IMO.

The key to this is going to be if I can do a test for when vBulletin builds its permissions and override them when on a wiki-thread ($thread['iswiki'] == 1 for example).

Simon Lloyd 03-04-2012 11:00 AM

From my effort you could just remove the
HTML Code:

$this->registry->userinfo['userid'] == $post['userid']
, the post is then always editable by anyone in the selected groups in vboptions only if the post has the prefix, isn't that how it would work?

Simon Lloyd 03-04-2012 11:07 AM

1 Attachment(s)
Just checked it and it seems to work :)

BirdOPrey5 03-04-2012 11:11 AM

Your mod will show the edit link, no problem... but if you actually try to edit a post as a different/non-mod user you will get a permission error because editpost.php checks for permission to edit the post before doing anything else.

Simon Lloyd 03-04-2012 11:59 AM

I did try on my test forum as editing as different user, the edit window opened fine (i didnt edit though, maybe i should check that too :))

BirdOPrey5 03-04-2012 12:01 PM

Yeah, it's when you try to save the edit the permissions kick in.

Simon Lloyd 03-04-2012 04:21 PM

Yes i see, when i get home i'm going to mess with GETting the users usergroupid and save it as a variable, change their usergroup to say moderator at postdata_presave then back to their original at postdata_postsave i know thats 3 queries but it's hardly going to happen very often, i'll have to see what time i've got when i get home.


All times are GMT. The time now is 02:06 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01104 seconds
  • Memory Usage 1,739KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete