PDA

View Full Version : How to allow users to edit their posts for limited time after posting?


XYZ500
03-07-2015, 09:48 PM
How to allow users to edit their posts for limited time after posting?

Also, is it possible to have different times for different categories?

For example,
I want the users to be allowed to edit their posts for 60 minutes after posting in the Introduction forum. And for 30 minutes in the General chat lounge forum. And so on. Different time allowed for different categories/forums.

Is this possible to do?

Lynne
03-07-2015, 11:25 PM
NOT TESTED, but probably a plugin at the global_bootstrap_complete with something like this:

if (THIS_SCRIPT == 'editpost')
{
global $foruminfo, $vbulletin;
if ($foruminfo['forumid']==xx)
{
$vbulletin->options['edittimelimit'] = yy;
}
}

change xx and yy to whatever you want. You can have as many if statements as you want within there.

XYZ500
03-08-2015, 03:01 PM
NOT TESTED, but probably a plugin at the global_bootstrap_complete with something like this:

if (THIS_SCRIPT == 'editpost')
{
global $foruminfo, $vbulletin;
if ($foruminfo['forumid']==xx)
{
$vbulletin->options['edittimelimit'] = yy;
}
}

change xx and yy to whatever you want. You can have as many if statements as you want within there.

I can't use this to set different edit times for different categories, can I?

kh99
03-08-2015, 05:17 PM
I can't use this to set different edit times for different categories, can I?

No, but maybe this will work:
if (isset($foruminfo))
{
global $vbulletin, $foruminfo;
$edittimes =array(c1=>t1, c2=>t2...);
$parents = array_intersect(explode(',',$foruminfo['parentlist']), array_keys($edittimes));
if (($parent = reset($parents)) !== FALSE)
{
$vbulletin->options['edittimelimit'] = $edittimes[$parent];
}
}


where you'd change c1, c2, etc to the category ids, and t1, t2, etc to the corresponding times in minutes.

I haven't test it except to see that there aren't any typos. I changed the 'if' condition because it looks like edittimelimit is used in some other places.

XYZ500
03-08-2015, 06:06 PM
No, but maybe this will work:
if (isset($foruminfo))
{
global $vbulletin, $foruminfo;
$edittimes =array(c1=>t1, c2=>t2...);
$parents = array_intersect(explode(',',$foruminfo['parentlist']), array_keys($edittimes));
if (($parent = reset($parents)) !== FALSE)
{
$vbulletin->options['edittimelimit'] = $edittimes[$parent];
}
}


where you'd change c1, c2, etc to the category ids, and t1, t2, etc to the corresponding times in minutes.

I haven't test it except to see that there aren't any typos. I changed the 'if' condition because it looks like edittimelimit is used in some other places.

How to find the category IDs?

https://vborg.vbsupport.ru/forumdisplay.php?f=251
Is the category ID for this 251?

https://vborg.vbsupport.ru/forumdisplay.php?f=250
Is this category ID for this 250?

kh99
03-08-2015, 06:07 PM
How to find the category IDs?

https://vborg.vbsupport.ru/forumdisplay.php?f=251
Is the category ID for this 251?

https://vborg.vbsupport.ru/forumdisplay.php?f=250
Is this category ID for this 250?

Right. And I believe you can include individual forums as well.

kh99
03-08-2015, 07:19 PM
Just out of curiosity, are you using "forum" and "category" to mean the same thing? If so then what Lynne posted would have worked. But when you asked about categories I thought you wanted to be able to set the time for a category and all child forums.

Bill Stuntz
03-12-2015, 12:32 PM
Is this what you're looking for under CP..Settings..Options? Or is this some add-in on our MB?