vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Message Edit Time Limit in Social Group Discussions (https://vborg.vbsupport.ru/showthread.php?t=284177)

Chris8 06-08-2012 07:45 PM

Message Edit Time Limit in Social Group Discussions
 
Similarly to post editing time limit option it would be great if social group discussions would offer an option to limit edit time of a message to certain period only.
It seams there is only option to allow or disallow message editing by usergroup (Can manage own messages [Yes][No]) which is not good enough.
Does anyone could help with writing the plugin for that? I'm not sure were to start.
I would like to limit poster to 30 minutes to edit his/her messages within social group discussions.
Of course the ability of Admin to edit all messages anytime should stay intact.
I would be grateful for any help/ideas.

kh99 06-09-2012 12:47 AM

Well, you could make the "Edit" control go away by creating a plugin using hook group_messagebit_display_complete and setting $message['edit'] to false. I guess strictly speaking that doesn't stop someone from editing the message, but someone would have to be really desperate to figure out how to do it without having the control. (Or you could just use a second plugin to guard against that).

Anyway, you could do something like this:

Code:

if ($message['edit'])
{
    if ((TIMENOW - $message['dateline']) > (60 * 30))
        $message['edit'] = false;
}


but that doesn't account for admins being able to edit forever. It's easy enough to check if the current user is an admin, but what you really want is to know if they have permission to edit that discussion and that message. (The code that figures that out is in includes/class_groupmessage.php, in class vB_Group_Bit_Message, if that helps).

Chris8 06-10-2012 08:34 PM

Thank you Kevin. Once again your suggestions were crucial to achieve the target.
Yup, that was great start and gave me the whole idea how to use the dateline info, now all stuff works like a charm! And this plug itself is also helpful.
I'm sure you've already got loads of good karma for helping here! :)


All times are GMT. The time now is 11:37 AM.

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.01071 seconds
  • Memory Usage 1,710KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete