PDA

View Full Version : Show Thread Enhancements - [OzzModz] First Post Editable Indefinitely Per Usergroup


ozzy47
07-11-2014, 10:00 PM
Another mod brought to you by,
https://vborg.vbsupport.ru/external/2015/01/1.png

This is a small mod that will allow admins to have selected usergroups bypass Time Limit editing their first posts in a thread.

It is a simple installation, just import the product XML, ozzmodz_editable_post

You can edit the options under the settings, [OzzModz] First Post Editable Indefinitely Settings

Note: This was originally done by Lynne (https://vborg.vbsupport.ru/member.php?u=65230), here First Post Editable Indefinitely (https://vborg.vbsupport.ru/showthread.php?t=228210) but it did not have usergroup perms, and you had to edit each forum individually.

Should you want a specific usergroup to be able to edit all their posts indefinitely, use
[OzzModz] Disable Time Limit On Editing Of Posts By Usergroup (https://vborg.vbsupport.ru/showthread.php?t=312739)

Complete Feature List
Option to disable the mod completely.
Option to set which usergroups this mod will affect.
Option to select which forums this mod affects.Frequently Asked Questions.

Q. Why do I need such a thing, you ask?

A. Sometimes you want your users to be able to edit the first post in their thread indefinitely but still have a time limit on all other posts in the thread. This can be useful if you want your users to be able to constantly update their first thread with new information, or new releases to things way past the normal editing time limit. This modification will allow them to edit that first post indefinitely.


-------------------------------------------------------------------------------------------

If you like this mod please hit the https://vborg.vbsupport.ru/external/2015/08/1.png button to the right ---->

Please remember to click the, https://vborg.vbsupport.ru/external/2015/08/2.png button to the right if you installed the mod ---->

What does 'Marking As Installed' do ?

* It helps you to stay on top of updates - members who have installed modifications will be notified whenever new updates are available.

* For security issues - vbulletin.org will contact all members who have installed a modification whenever a security issue is brought to their attention.

* Marking a modification as installed also helps me know how many people are using my work, giving me extra incentive to provide more features and new modifications.

I appreciate the support!
-------------------------------------------------------------------------------------------

* History (Changelog) *
-------------------------
v1.0.0 (July 12, 2014)
- Initial public release.
v1.0.1 (December 12, 2014)
- Fixed a issue with it not working on some sites.

ozzy47
07-12-2014, 07:55 PM
Reserved.

civicf
07-17-2014, 05:13 PM
I installed this mod in VB 4.2.2, but I have a problem.
I have a set limit editing posts. After installing, the first posts still can not be edited. I have a set usergroup perms and which forums options.

ozzy47
07-17-2014, 06:22 PM
I installed this mod in VB 4.2.2, but I have a problem.
I have a set limit editing posts. After installing, the first posts still can not be edited. I have a set usergroup perms and which forums options.

Hmmm, if you pm me a admin account, I can look into it on your site.

civicf
07-17-2014, 06:36 PM
I have tested it and it seems that the variables are empty. I mean postinfo['userid'] and $postinfo['postid'].
I don't know why.

ozzy47
07-18-2014, 10:02 AM
Neither do I, that is why I would need to test it out on your site as I can't replicate the issue.

Grouper
08-11-2014, 04:25 PM
This is exactly what I needed! Of course you customized it for my needs and I thank you for taking the time to make this so I didn't have too!

Grouper
08-11-2014, 04:30 PM
A feature that would be great is the ability to assign user groups per forum. I could see the need for some forums to need to allow some user groups while other forums need to disable the other user group but enable a different user group.

ozzy47
08-11-2014, 06:21 PM
A feature that would be great is the ability to assign user groups per forum. I could see the need for some forums to need to allow some user groups while other forums need to disable the other user group but enable a different user group.

That would be quite a bit trickier, would require some recoding I believe.

Grouper
08-11-2014, 07:09 PM
Is this supposed to work on threads started before this plugin was installed? I'm looking at the code and don't see why it wouldn't work, but my users are saying it is only working on new threads started after this was installed.

ozzy47
08-11-2014, 07:15 PM
No it should work on all first posts.

Grouper
08-11-2014, 09:18 PM
I created a test user and tested this, it doesn't seem to enable the edit post button after the timeout of 15 minutes for the OP in the specified forums I enabled for in the settings. Seems to be the same issue civicf is having

ozzy47
08-11-2014, 09:24 PM
If you could give that test user full admin privileges, and send me the info for that test user, I can try to debug it on your site.

Grouper
08-11-2014, 11:36 PM
I did debugging and the issue lies with the is_member_of() code. It is returning false

Here is my debug code
print_log('checking if active: '. $ozzmodz_editable_post['active']);
print_log('users: ' . implode(',',$allowed_users));
print_log('forums: ' . implode(',',$included_forums));
print_log('Post uid: ' . $this->post['userid']. ' VB uid: ' . vB::$vbulletin->userinfo['userid']);
print_log('Post id: ' . $this->post['postid'] . ' First PostID: ' . $this->thread['firstpostid']);
print_log('Forum in array: ' . in_array($this->thread['forumid'], $included_forums));
print_log('is_member_of: ' . is_member_of($vbulletin->userinfo, $allowed_users));

output
11.08.2014 19:37:03 testaccount checking if active: 1
11.08.2014 19:37:03 testaccount users: 2,-1
11.08.2014 19:37:03 testaccount forums: 61,66
11.08.2014 19:37:03 testaccount Post uid: 334 VB uid: 334
11.08.2014 19:37:03 testaccount Post id: 115630 First PostID: 115630
11.08.2014 19:37:03 testaccount Forum in array: 1
11.08.2014 19:37:03 testaccount is_member_of:
11.08.2014 19:37:03 testaccount checking if active: 1
11.08.2014 19:37:04 testaccount users: 2,-1
11.08.2014 19:37:04 testaccount forums: 61,66
11.08.2014 19:37:04 testaccount Post uid: 3 VB uid: 334
11.08.2014 19:37:04 testaccount Post id: 115679 First PostID: 115630
11.08.2014 19:37:04 testaccount Forum in array: 1
11.08.2014 19:37:04 testaccount is_member_of:
11.08.2014 19:37:04 testaccount checking if active: 1
11.08.2014 19:37:04 testaccount users: 2,-1
11.08.2014 19:37:04 testaccount forums: 61,66
11.08.2014 19:37:04 testaccount Post uid: 63 VB uid: 334
11.08.2014 19:37:04 testaccount Post id: 115681 First PostID: 115630
11.08.2014 19:37:04 testaccount Forum in array: 1
11.08.2014 19:37:04 testaccount is_member_of:
11.08.2014 19:37:04 testaccount checking if active: 1
11.08.2014 19:37:04 testaccount users: 2,-1
11.08.2014 19:37:04 testaccount forums: 61,66
11.08.2014 19:37:04 testaccount Post uid: 3649 VB uid: 334
11.08.2014 19:37:04 testaccount Post id: 115682 First PostID: 115630
11.08.2014 19:37:04 testaccount Forum in array: 1
11.08.2014 19:37:04 testaccount is_member_of:
11.08.2014 19:37:04 testaccount checking if active: 1
11.08.2014 19:37:04 testaccount users: 2,-1
11.08.2014 19:37:04 testaccount forums: 61,66
11.08.2014 19:37:04 testaccount Post uid: 63 VB uid: 334
11.08.2014 19:37:04 testaccount Post id: 115683 First PostID: 115630
11.08.2014 19:37:04 testaccount Forum in array: 1
11.08.2014 19:37:04 testaccount is_member_of:
11.08.2014 19:37:05 testaccount checking if active: 1
11.08.2014 19:37:05 testaccount users: 2,-1
11.08.2014 19:37:05 testaccount forums: 61,66
11.08.2014 19:37:05 testaccount Post uid: 334 VB uid: 334
11.08.2014 19:37:05 testaccount Post id: 115687 First PostID: 115630
11.08.2014 19:37:05 testaccount Forum in array: 1
11.08.2014 19:37:05 testaccount is_member_of:

also not sure why it has -1 as a group as I really only have Registered Users group active right now

ozzy47
08-11-2014, 11:57 PM
Ok I'll check it out on my site when I get a chance. It may be tomorrow.

Grouper
08-12-2014, 12:00 AM
is there a need to have -1 in there?

Grouper
08-12-2014, 12:07 AM
Fixed it

$vbulletin->userinfo should be vB::$vbulletin->userinfo

ozzy47
08-12-2014, 12:10 AM
Hmmm, I have never used,

vB::$vbulletin->userinfo

Grouper
08-12-2014, 12:23 AM
Also you need to create a new hook ajax_start and add $ozzmodz_editable_post['active'] = $vbulletin->options['ozzmodz_editable_post_active']; //Is mod active
$allowed_users = explode(',', $vbulletin->options['ozzmodz_editable_post_groups']); //Allowed users
$included_forums = explode(",", $vbulletin->options['ozzmodz_editable_post_forums']); //Enabled forums

global $threadinfo, $postinfo, $foruminfo, $vbulletin;

if (($threadinfo['firstpostid'] == $postinfo['postid']) AND ($vbulletin->userinfo['userid'] == $postinfo['userid']) AND ($ozzmodz_editable_post['active']) AND (is_member_of(vB::$vbulletin->userinfo, $allowed_users) AND in_array($forumid, $included_forums)))
{
$vbulletin->options['edittimelimit'] = 0;
}

Grouper
08-12-2014, 12:24 AM
Hmmm, I have never used,

vB::$vbulletin->userinfo

yea... i don't know why $vbulletin->user info works on other things in that script but not is_member_of()... its weird. But i managed to get the plugin working with those edits I listed

ozzy47
08-12-2014, 12:30 AM
I appreciate the help, I will have to look into why it's needed.

Grouper
08-13-2014, 09:59 PM
Any update on this?

ozzy47
08-13-2014, 10:00 PM
No I have been busy debugging other things, but it is working for you with the edits you did correct?

Grouper
08-14-2014, 04:13 PM
Yep, if you want I can do an export of my changes and post them for anyone else having issues.

ozzy47
08-14-2014, 10:24 PM
Yep, if you want I can do an export of my changes and post them for anyone else having issues.

Nah they are here in the thread, as soon as I get a chance I will update the mod, possibly Saturday. :)

tommyxv
11-14-2014, 11:29 PM
I'm a little unsure if I need this one over the one I'm using right now from Lynn. I just like Ozzy's Mods I guess. :)

I allow the first post to be editable forever in vendor forums and only vendors can create threads in their forums.

I also allow the Group-Buy forum to have it's first post edited forever by any thread starter.

ozzy47
11-14-2014, 11:32 PM
Yeah Lynne's is fine, it just did not have usergroup perms, and you had to set each forum individually. This mod you don't. :)

tommyxv
12-12-2014, 07:13 PM
Having an issue with this. A member reported that he had the edit post button but when he clicked it, it gave him x amount of minutes have passed error. His usergroup and that forum were selected in the options.

EDIT: Nevermind, I just re-read this thread. I see the issue has been reported already. I'll switch back to the other one until this is updated. Nice being able to see the forums you have it set for all on one page. Great Mod!

ozzy47
12-12-2014, 09:51 PM
Can you provide step by step instructions to reproduce this, so I can try and replicate it on my site.

tommyxv
12-12-2014, 10:02 PM
Can you provide step by step instructions to reproduce this, so I can try and replicate it on my site.

It's the same issue that Lynn's mod (https://vborg.vbsupport.ru/showthread.php?t=228210)had but she fixed it with a new plugin. For version 4.1.12 and above.

tommyxv
12-12-2014, 10:12 PM
I just tested on my test board and I have the usergroup and the forum selected. I set the time limit to edit to 1 min for testing purposes. After 1 min, I lose the edit button. This is different now.

ozzy47
12-12-2014, 10:17 PM
Try this version.

tommyxv
12-12-2014, 10:18 PM
Will do. I just created a test admin and test user acct for you on my test board. If this one doesn't work, I'll PM the details.

tommyxv
12-12-2014, 10:20 PM
Didn't work. I'll PM the logins

ozzy47
12-12-2014, 10:20 PM
Ok cool. :)

ozzy47
12-12-2014, 10:35 PM
Alright try the XML in the first post, I updated it. :)

tommyxv
12-12-2014, 10:40 PM
All good man! Let me know if you can help me with other thing I PM'ed you about. With the 2nd post, or just all posts in said forums.

ozzy47
12-12-2014, 10:43 PM
Excellent, glad to hear. :)

tommyxv
12-13-2014, 12:09 AM
Ozzy, I check my apache error logs and I have a bunch of these now....

[Fri Dec 12 20:59:16 2014] [error] [client removed ip] PHP Warning: trim() expects parameter 1 to be string, array given in /home/mypathto/public_html/includes/adminfunctions_options.php on line 1032, referer: http://www.mysite.com/admincp/options.php?do=options&dogroup=ozzmodz_editable_post_settings

any idea how to fix? Thanks

ozzy47
12-13-2014, 12:42 AM
Use the new version, 1.0.2 and it should be fixed.

ozzy47
12-13-2014, 12:43 AM
Hold on, that does not work either.

ozzy47
12-13-2014, 12:53 AM
I dunno, it seems it will throw that error any time you change the Forums settings, for now it should be safe to ignore, but I will look into it some more.

tommyxv
12-13-2014, 01:10 AM
Ok no problem. Thanks for checking. I have to get with Tapatalk as their app doesn't following this mods permissions. Ugh

ozzy47
12-13-2014, 02:05 AM
Figures tapatalk would not work with it. :(

tommyxv
12-13-2014, 12:47 PM
It's doesn't follow auto-merge either. Too bad so many members use it or I would get rid of it and use a clean mobile style and regain control of my forums.

I have OCD when it comes to apache errors. I got rid of all the errors I had in the past except the ones by TapaTalk... go figure. I'll wait until you figure it out. My error log is almost clear.

Thanks again for these great mods!

ozzy47
12-13-2014, 12:54 PM
Yeah I been looking into it, and i have no explanation why. It happens on changing forums, or changing usergroups. The code I am using has been around forever in vB and is used by many developers. I don't know if there is a fix to get rid of them, but I will continue digging.

Alan_SP
12-13-2014, 09:40 PM
Well, I also had errors logged in error.log caused by TapaTalk, but made to look like they come from other mod (namely VaultWiki). I opened thread there: https://www.vaultwiki.org/issues/4091/

I was getting double posts, not just errors in error.log. It started immediately after I installed latest TapaTalk (5.3.1) and I downgraded to (5.2.2) after that. I don't get double posts and this error in error.log, so it definitely is something TapaTalk related.

That's the reason I believe it's not something caused with VaultWiki.

I'm writing this just so you know it maybe isn't related with your mod, but can be caused with TapaTalk, although it looks like your mod causes this.

ozzy47
12-13-2014, 09:41 PM
The errors are from any mod I have that has the usergroup check boxes, or the forum selectors. But I don't think it is a issue with the mod, it's how vB handles it.

tommyxv
12-14-2014, 05:27 PM
The errors are from any mod I have that has the usergroup check boxes, or the forum selectors. But I don't think it is a issue with the mod, it's how vB handles it.

Can you change the check boxes to text field for usergroup ids or a list like the forums? If that makes the errors go away.

ozzy47
12-14-2014, 06:25 PM
Possibly, but I don't think the tradeoff is worth the occasional error, that seems to be a false positive anyway. :)

tommyxv
12-14-2014, 10:12 PM
It is weird though. I use few mods what have usergroup check boxes, but never had any errors before. I think these require to upload a few files though so that could be it.

ozzy47
12-14-2014, 11:02 PM
If it is a vBoption, then the error will happen, if it is a separate page, to set options then you will not get the error.