[MODDB] Topic Multi-Moderation & Topic Prefixes

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Scam Warning
Locked
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC2] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

Alright, someone already found a bug. It will be fixed in the next version, but if you would like to go ahead and fix it, you're welcome to. Just remember that if you do this now, you will not be able to install the update in AutoMOD because the fix will already be applied. If you want to wait, you can do that as well.
EDIT: Actually, nevermind... the fix will be included in the file, so simply overwriting the old file with the new one will fix it. So disregard that whole thing about not applying it now. xD

The issue is that moving and copying topics did not work because improper variables were being used.

Here's the fix posted on the official support forum on my website:
Open: includes/mods/functions_tmm.php
Find:

Code: Select all

public static function apply_tmm($mod_id, $topic_id, $forum_id)
    {
        global $db, $template, $user, $phpbb_root_path, $phpEx;
        
        // make sure the multi-mod exists
        self::$multi_mods_cache = self::$tmm_cache->get_multi_mods();
        if(!array_key_exists($mod_id, self::$multi_mods_cache))
        {
            trigger_error("INVALID_MULTI_MOD");
        }
        
        //Check each mutli-mod action to see if it should be done.
        if(self::$multi_mods_cache[$mod_id]['autoreply_bool'] == 1)
        {
            $poster = (self::$multi_mods_cache[$mod_id]['autoreply_poster'] != 0) ? self::$multi_mods_cache[$mod_id]['autoreply_poster'] : 0;
            $auto_reply = self::auto_reply(self::$multi_mods_cache[$mod_id]['autoreply_text'], $topic_id, $forum_id, $poster, true, true);
            if(!$auto_reply)
            {
                self::$error[] = $user->lang['AUTOREPLY_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['prefix'] != '')
        {
            // Allow for multiple prefixes to be applied with one multi-mod ^_^
            $prefixes = explode(',', self::$multi_mods_cache[$mod_id]['prefix']);
            $fails = 0;
            foreach($prefixes AS $prefix)
            {
                $pre = self::apply_prefix($prefix, $topic_id);
                if(!$pre)
                {
                    $fails++;
                }
            }
            if($fails != 0)
            {
                self::$error[] = sprintf($user->lang['PREFIX_ERROR'], $fails);
            }
        }
        if(self::$multi_mods_cache[$mod_id]['lock'] == 1)
        {
            $lock = self::lock_topic($topic_id);
            if(!$lock)
            {
                self::$error[] = $user->lang['LOCK_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['sticky'] == 1)
        {
            $stick = self::stick_topic($topic_id);
            if(!$stick)
            {
                self::$error[] = $user->lang['STICK_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['copy'] == 1)
        {
            $copy = self::copy_topic($topic_id, self::$multi_mods_cache[$mod_id]['copy_dest_id'], $topicrow['forum_id']);
            if(!$copy)
            {
                self::$error[] = self::$multi_mods_cache[$mod_id]['copy_dest_id'] . '<br />' . $user->lang['COPY_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['move'] == 1)
        {
            $move = move_topics($topic_id, self::$multi_mods_cache[$mod_id]['move_dest_id'], $topicrow['forum_id'], true);
        }
        return (empty(self::$error)) ? true : false;
    } 
Replace With:

Code: Select all

public static function apply_tmm($mod_id, $topic_id, $forum_id)
    {
        global $db, $template, $user, $phpbb_root_path, $phpEx;
        
        // make sure the multi-mod exists
        self::$multi_mods_cache = self::$tmm_cache->get_multi_mods();
        if(!array_key_exists($mod_id, self::$multi_mods_cache))
        {
            trigger_error("INVALID_MULTI_MOD");
        }
        
        //Check each mutli-mod action to see if it should be done.
        if(self::$multi_mods_cache[$mod_id]['autoreply_bool'] == 1)
        {
            $poster = (self::$multi_mods_cache[$mod_id]['autoreply_poster'] != 0) ? self::$multi_mods_cache[$mod_id]['autoreply_poster'] : 0;
            $auto_reply = self::auto_reply(self::$multi_mods_cache[$mod_id]['autoreply_text'], $topic_id, $forum_id, $poster, true, true);
            if(!$auto_reply)
            {
                self::$error[] = $user->lang['AUTOREPLY_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['prefix'] != '')
        {
            // Allow for multiple prefixes to be applied with one multi-mod ^_^
            $prefixes = explode(',', self::$multi_mods_cache[$mod_id]['prefix']);
            $fails = 0;
            foreach($prefixes AS $prefix)
            {
                $pre = self::apply_prefix($prefix, $topic_id);
                if(!$pre)
                {
                    $fails++;
                }
            }
            if($fails != 0)
            {
                self::$error[] = sprintf($user->lang['PREFIX_ERROR'], $fails);
            }
        }
        if(self::$multi_mods_cache[$mod_id]['lock'] == 1)
        {
            $lock = self::lock_topic($topic_id);
            if(!$lock)
            {
                self::$error[] = $user->lang['LOCK_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['sticky'] == 1)
        {
            $stick = self::stick_topic($topic_id);
            if(!$stick)
            {
                self::$error[] = $user->lang['STICK_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['copy'] == 1)
        {
            $copy = self::copy_topic($topic_id, self::$multi_mods_cache[$mod_id]['copy_dest_id'], $forum_id);
            if(!$copy)
            {
                self::$error[] = self::$multi_mods_cache[$mod_id]['copy_dest'] . '<br />' . $user->lang['COPY_ERROR'];
            }
        }
        if(self::$multi_mods_cache[$mod_id]['move'] == 1)
        {
            $move = move_topics($topic_id, self::$multi_mods_cache[$mod_id]['move_dest'], $forum_id, true);
        }
        return (empty(self::$error)) ? true : false;
    } 
Another thing that was brought up was that permissions were added but language variables do not exist for them. The story behind that is that I had originally tried to implement the native phpBB permissions system into the MOD, but I found it would be easier to do it as it is now, and have permissions set per-prefix and per-multi-mod instead of per-forum globally for all prefixes/multi-mods.

So, for now, please do not mess with the permissions that are added by this MOD into the Permissions area, but rather only use the options located on the add/edit page for multi-mods and prefixes.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC2] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

There have been a couple more fixes I found that are on my official support board if you would like to see them.

Also, I will have limited access from Wednesday to Saturday, just so that everyone's aware.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC2] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

MOD Updated to 1.0.0 RC3

Changes from RC2 to RC3:
[fix] language variable in PMs being overwritten
[fix] bug in ACP module when deleting multi-mods
[fix] method being declared twice

Update instructions in contrib/ folder. (Just overwrite the changed files, listed in the rc2_to_rc3.xml file).

Important information, and download/repository links in first post.

Please report any bugs or suggestions either here or on the Official Support Forum.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC3] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

I would like to point out that there is currently a known issue with any MOD that rewrites the URL (i.e. SEO mods that make "friendly" urls). The only issue that has been brought up due to that MOD being installed is that topic prefixes cannot be applied to new topics because the topic ID was being taken from the redirect URL, which is changed in the rewritten URLs.

A fix is planned for RC4 (or 1.0.1 if it gets validated some time soon, but more than likely RC4). However, prefixes can still be added to existing topics, and multi-mods still work fine; at least there have been no bug reports on those in conjunction with the use of the SEO MOD.

That is all.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC3] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

Alright, I have confirmed a working fix for the issue stated in the previous post and will release RC4 when I get a chance, probably tomorrow morning.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

MOD Updated to 1.0.0 RC4

Changes from RC3 to RC4:
[fix] incompatibility with SEO friendly URL MOD when posting a new topic with prefixes

Update instructions in contrib/ folder. There is one file edit and one file to overwrite.

Important information, and download/repository links in first post.

Please report any bugs or suggestions either here or on the Official Support Forum.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
callumacrae
Former Team Member
Posts: 2662
Joined: Tue Feb 12, 2008 12:28 pm
Location: London, UK
Name: Callum Macrae
Contact:

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by callumacrae »

Add/Edit Mutli-Mod
It's the title in the ACP page.

~Callum
macr.ae = my website. you probably won't like it.
Proud user ofProud user of
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

What do you mean?
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
User avatar
callumacrae
Former Team Member
Posts: 2662
Joined: Tue Feb 12, 2008 12:28 pm
Location: London, UK
Name: Callum Macrae
Contact:

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by callumacrae »

When adding a new multi-mod in the ACP the title is spelt "Add/Edit Mutli-Mod"

~Callum
macr.ae = my website. you probably won't like it.
Proud user ofProud user of
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

Callum95 wrote:When adding a new multi-mod in the ACP the title is spelt "Add/Edit Mutli-Mod"

~Callum
oooooooh. xD Thanks for pointing that out. I'm surprised no one noticed that before (including me).

I'll change that in the repository and it'll be fixed in the next major release. But I don't think i'll make a whole new RC for a minor language change.
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
Bolfri
Registered User
Posts: 2
Joined: Wed Jun 02, 2010 11:27 pm

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by Bolfri »

So... is that ready to use?
User avatar
callumacrae
Former Team Member
Posts: 2662
Joined: Tue Feb 12, 2008 12:28 pm
Location: London, UK
Name: Callum Macrae
Contact:

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by callumacrae »

Bolfri wrote:So... is that ready to use?
I tested it for a bit, it looked fine for me and I'm using it on a live board. Haven't had any problems yet :)

~Callum
macr.ae = my website. you probably won't like it.
Proud user ofProud user of
User avatar
imkingdavid
Former Team Member
Posts: 2673
Joined: Sun Jul 26, 2009 7:59 pm
Location: EST
Name: David King

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by imkingdavid »

In the latest RC I have not gotten any bug reports or anything, except for that minor language thing that was pointed out. You're welcome to try it out, but be sure to make a backup of your database and files before installing so that if it does somehow mess something up, you can easily overwrite the changes. ;)
Don't forget to smile today. :)
Please do NOT contact for support via PM or email.
ricjonhay
Registered User
Posts: 247
Joined: Tue Feb 16, 2010 6:08 pm

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by ricjonhay »

David Have you got a demo/screen shot of the Topic Prefixes?
Bolfri
Registered User
Posts: 2
Joined: Wed Jun 02, 2010 11:27 pm

Re: [1.0.0 - RC4] Topic Multi-Moderation & Topic Prefixes

Post by Bolfri »

Och, that was good question. Have you got a screenshot or a demo version (maybe on your forum)? I would love to see it.
Locked

Return to “[3.0.x] MODs in Development”