Status
Not open for further replies.
Ok sorry about that.. File has been updated.

No worries, my members know our website is in a constant state of "Trekkan messing around with things". ;)

So I installed this version and it works as advertised, nice work!

This does however bring up an issue though.

There's no way to display only specific shouts to specific usergroups. So right now, we're displaying a thank you from a private forum where others might not have access to. Since it shows the thread title (which I do like), it does have the potential of giving out information we don't want to. For instance, I have a forum that is specifically for reporting issues with members. All of those posts include the members name in the title for easy searching. We don't want that kind of info going out.

Not sure what the best solution here is, but probably a field for "Include the following forums" and list forum IDs or something. Excluding all others.

Now, if we could get a shoutbox that displayed only messages to specific usergroups... that'd be very awesome! *hint hint!* ;) I'm, sure that might be pretty resource intensive, etc. But.. a guy can dream, right? =)
 
No worries, my members know our website is in a constant state of "Trekkan messing around with things". ;)

So I installed this version and it works as advertised, nice work!

This does however bring up an issue though.

There's no way to display only specific shouts to specific usergroups. So right now, we're displaying a thank you from a private forum where others might not have access to. Since it shows the thread title (which I do like), it does have the potential of giving out information we don't want to. For instance, I have a forum that is specifically for reporting issues with members. All of those posts include the members name in the title for easy searching. We don't want that kind of info going out.

Not sure what the best solution here is, but probably a field for "Include the following forums" and list forum IDs or something. Excluding all others.

Now, if we could get a shoutbox that displayed only messages to specific usergroups... that'd be very awesome! *hint hint!* ;) I'm, sure that might be pretty resource intensive, etc. But.. a guy can dream, right? =)

The problem with perm-checking shouts is it would eliminate cache unless redesigned - even then it would still be fairly intensive. I've thought about it myself and it's a considerable issue to overcome, but that doesn't mean we've given up on it :)
 
The problem with perm-checking shouts is it would eliminate cache unless redesigned - even then it would still be fairly intensive. I've thought about it myself and it's a considerable issue to overcome, but that doesn't mean we've given up on it :)

Sounds good, I'll bug you every once in a while to keep it in your minds. ;) Tons of new features possible if that were implemented as well.
 
Nice.. Idea... I could integrate a usergroup option, I guess comma separated? And also Perma based, will look into.. shouldn't be hard :)

also I am going to be adding another add-on sooner or later that allows specific usergroup to chat together.. I was thinking about this a while back so admins could have their own chats without users seeing it. It shouldn't be hard... I'll give u updates as I go along. :)

Also should I embed the post thanks forum permissions with the notice 'newthread' and 'reply' permission or should I create its own? What u guys think?

UPDATE: After some research and trial and error.. for the usergroup permissions I found a solution which involves changing the query around to include a parent forumid. This way the forum could run "$vbulletin->userinfo['forumpermissions']" against the forumid in the table for that notification shout... and if its out of range, then its not displayed aka ~~$blockforums = '';~~ or the noshout option if it still exist.

Also I have updated the the xml file in the zip since I left out the alter table query. ^_^
 
Last edited:
Nice.. Idea... I could integrate a usergroup option, I guess comma separated? And also Perma based, will look into.. shouldn't be hard :)

also I am going to be adding another add-on sooner or later that allows specific usergroup to chat together.. I was thinking about this a while back so admins could have their own chats without users seeing it. It shouldn't be hard... I'll give u updates as I go along. :)

Also should I embed the post thanks forum permissions with the notice 'newthread' and 'reply' permission or should I create its own? What u guys think?
These are hopefully going to be features in v4.5 :) Great minds think alike, eh?

UPDATE: After some research and trial and error.. for the usergroup permissions I found a solution which involves changing the query around to include a parent forumid. This way the forum could run "$vbulletin->userinfo['forumpermissions']" against the forumid in the table for that notification shout... and if its out of range, then its not displayed aka ~~$blockforums = '';~~ or the noshout option if it still exist.

Also I have updated the the xml file in the zip since I left out the alter table query. ^_^
Yeah, that's pretty much what we're going to be doing - good job! =D

I'm going to re-structure the database ever so slightly to accomodate the forum permissions - will also need to change the fetch shouts query to not simply hide the shouts, but also fetch other shouts in its place (so that a large number of "hidden" shouts won't cause the shoutbox to display only 1-2 shouts :p)

It'll be interesting, to say the least xP
 
Ok, I officially REALLY like this thread now. ;) Can't wait for more mods (thanks again Cold Assassin) and vBShout 4.5!

If you're bored Cold Assassin (or anyone really), I'd like to see integration with the ibp Arcade mod. Mostly just when someone get's a high score or beats someone's score. I think that'll generate a lot of interest in the arcade/website and keep people around more. It's much more of a competition that way.
 
Since the API is actually becoming important now, I'm updating the manage_shout() function to be fully capable as a replacement for manually inserting shouts.

I'll let slip a v4.5 feature: Shoutbox PMs when you receive a forum PM. It also uses this new improved API :)
 
Ok, I officially REALLY like this thread now. ;) Can't wait for more mods (thanks again Cold Assassin) and vBShout 4.5!

If you're bored Cold Assassin (or anyone really), I'd like to see integration with the ibp Arcade mod. Mostly just when someone get's a high score or beats someone's score. I think that'll generate a lot of interest in the arcade/website and keep people around more. It's much more of a competition that way.

Hey no problem... Glad I can help :) ..

I'm currently working on the admin chat feature... so only admins can see a chat... Should be easy because its pretty much the PM system :P

The ibp arcade addon sounds great.. I'll start on it once I'm done the admin shout feature (either today or tommorow)

Fillip H. when you get the chance... if you want :) .. could I get some info on the API so I can start implementing it into the plugins I'm working on?.. you can send it via PM if u would like :P Thanks
 
Here's the new function:
PHP:
    public function manage_shout($message, $shoutid = 0, $type = 1, $dofetch = true, $userid = 0, $id = 0)
    {
        global $vbphrase;
        
        // Get rid of junk characters
        $message = str_replace("\n", ' ', trim(convert_urlencoded_unicode($message)));
        
        // Do character count checking
        if ($this->registry->options['dbtech_vbshout_maxchars'] != 0 AND ($postlength = vbstrlen($message)) > $this->registry->options['dbtech_vbshout_maxchars'])
        {
            $this->fetched['error'] = construct_phrase($vbphrase['dbtech_vbshout_charlimit'], $postlength, $this->registry->options['dbtech_vbshout_maxchars']);
            return false;
        }
        
        // Ensure we got BBCode Parser
        require_once(DIR . '/includes/functions_misc.php');
        require_once(DIR . '/includes/class_bbcode_alt.php');
        
        // Do image count checking
        $bbcode_parser = new vB_BbCodeParser_ImgCheck($this->registry, fetch_tag_list());
        $bbcode_parser->set_parse_userinfo($this->registry->userinfo);

        if ($this->registry->options['dbtech_vbshout_maximages'])
        {
            $imagecount = fetch_character_count($bbcode_parser->parse($message, 'nonforum', $this->registry->options['dbtech_vbshout_allowsmilies'], true), '<img');
            if ($imagecount > $this->registry->options['dbtech_vbshout_maximages'])
            {
                $this->fetched['error'] = construct_phrase($vbphrase['dbtech_vbshout_imagelimit'], $imagecount, $this->registry->options['dbtech_vbshout_maximages']);
                return false;
            }
        }
        
        if ($this->registry->options['dbtech_vbshout_maxsize'])
        {
            // Replace the SIZE BBCode if needed
            $message = preg_replace("#\[size=(\d+)\]#ie", "\$this->process_bbcode_size('\\1')", $message);
        }
        
        // Initiate the shout arguments
        $fetch_shout_args = array();        
        
        if ($shoutid)
        {    
            if (!$exists = $this->registry->db->query_first("SELECT * FROM " . TABLE_PREFIX . "dbtech_vbshout_shout WHERE shoutid = " . $this->registry->db->sql_prepare($shoutid)))
            {
                // The shout doesn't exist
                //$this->fetched['error'] = $vbphrase['dbtech_vbshout_invalid_shout'];
                //return false;
            }            
            else
            {
                // Type will always be what it used to be
                $type = $exists['type'];
                $id = $exists['id'];
                $userid = $exists['userid'];
                
                if ($exists['userid'] == $this->registry->userinfo['userid'] AND !$this->permissions['caneditown'])
                {
                    // We can't edit our own shouts
                    $this->fetched['error'] = $vbphrase['dbtech_vbshout_may_not_edit_own'];
                    return false;
                }
                
                if ($exists['userid'] != $this->registry->userinfo['userid'] AND !$this->permissions['caneditothers'])
                {
                    // We don't have permission to edit others' shouts
                    $this->fetched['error'] = $vbphrase['dbtech_vbshout_may_not_edit_others'];
                    return false;
                }
                
                if ($type != $this->shouttypes['me'] AND $type != $this->shouttypes['notif'])
                {
                    // Checks if we got an action code of some description
                    list($type, $id, $userid) = $this->parse_action_codes($message, $type, $exists['id'], $exists['userid']);
                }
                
                if ($message)
                {
                    // Update the shout
                    $this->registry->db->query_write("
                        UPDATE " . TABLE_PREFIX . "dbtech_vbshout_shout
                        SET
                            message = " . $this->registry->db->sql_prepare($message) . ",
                            type = " . $type . ",
                            userid = " . $userid . ",
                            id = " . $id . "
                        WHERE shoutid = " . $this->registry->db->sql_prepare($shoutid)
                    );
                }
                
                ($hook = vBulletinHook::fetch_hook('dbtech_vbshout_shout_edit')) ? eval($hook) : false;
                
                // Log this command
                $this->log_command('shoutedit', serialize(array('old' => $exists['message'], 'new' => $message)));            
                
                // And a winrar is us
                $this->fetched['success'] = $vbphrase['dbtech_vbshout_edited_shout_successfully'];
            }
        }
        else
        {
            if (!$this->permissions['canshout'])
            {
                // We aren't allowed to post shouts
                $this->fetched['error'] = $vbphrase['dbtech_vbshout_may_not_shout'];
                return false;
            }
            
            if ($type == $this->shouttypes['shout'])
            //if ($type != $this->shouttypes['me'] AND $type != $this->shouttypes['notif'])
            {
                // Checks if we got an action code of some description
                list($type, $id, $userid) = $this->parse_action_codes($message, $type, $id, $userid);
            }
            
            if ($type == $this->shouttypes['pm'] AND !$id)
            {
                // We're sending a PM from the advanced pm interface
                $id = $this->registry->input->clean_gpc($this->fetchtype, 'userid', TYPE_UINT);
                
                // Check if user exists
                if (!$exists = $this->registry->db->query_first_slave("
                    SELECT userid
                    FROM " . TABLE_PREFIX . "user
                    WHERE userid = " . $this->registry->db->sql_prepare($id)
                ))
                {
                    // We has an error
                    $this->fetched['error'] = $vbphrase['dbtech_vbshout_invalid_user'];
                    return false;
                }
                
                // We need this local info since we came from a PM tab
                //$fetch_shout_args['userids']     = array($this->registry->userinfo['userid'], $id);
                $fetch_shout_args['types']        = $this->shouttypes['pm'];
                $fetch_shout_args['onlyuser']    = $id;                
            }            
            
            // Just to ensure this hasn't cocked up
            $userid = ($userid ? $userid : $this->registry->userinfo['userid']);
            $id     = ($id ? $id : 0);
            
            if ($this->fetched['error'])
            {
                // Aaand we're done
                return false;
            }            
            if ($message)
            {
                // Insert shout
                $this->registry->db->query_write("
                    INSERT INTO " . TABLE_PREFIX . "dbtech_vbshout_shout
                        (userid, dateline, message, type, id)
                    VALUES (
                        " . $userid . ",
                        " . TIMENOW . ",
                        " . $this->registry->db->sql_prepare($message) . ",
                        " . $this->registry->db->sql_prepare($type) . ",
                        " . $this->registry->db->sql_prepare($id) . "
                    )
                ");
                
                // Get the shout ID
                $shoutid = $this->registry->db->insert_id();
                
                ($hook = vBulletinHook::fetch_hook('dbtech_vbshout_shout_insert')) ? eval($hook) : false;                
                
                if ($userid > 0)
                {
                    // increment shouts count
                    $this->registry->db->query_write("
                        UPDATE " . TABLE_PREFIX . "user
                        SET dbtech_vbshout_shouts = dbtech_vbshout_shouts + 1
                        WHERE userid = $userid
                    ");
                }
            }
        }
            
        if ($type == $this->shouttypes['notif'])
        {
            // We're done, notifications need no fetching
            return;
        }
        
        if ($message)
        {
            // Maybe we need to update AOP
            $this->set_aop();
        }
        
        if ($dofetch)
        {
            // We do want to fetch all shouts, though
            $this->fetch_shouts($fetch_shout_args);
            
            // Flag for clearance
            $this->fetched['clear'] = 'editor';
        }
    }

I can't promise it works 100%, I haven't tested it with custom commands yet.

Here's how I use it to send a PM when someone has sent a forum PM:
PHP:
                    // Insert the shout
                    global $vBShout, $vbphrase;                    
                    $vBShout->shoutbox->manage_shout(construct_phrase(
                            $vbphrase['dbtech_vbshout_i_sent_you_a_forum_pm_x'],
                            $this->registry->options['bburl'],
                            $this->registry->session->vars['sessionurl'],
                            $this->dbobject->insert_id(),
                            $this->pmtext['title']                            
                        ),
                        0,
                        $vBShout->shoutbox->shouttypes['pm'],
                        false,
                        $fromuserid,
                        $userid
                    );
 
Do keep in mind that that won't be implemented before v4.5 is out, so you might not want to release plugins that use the new function just yet :p
 
Triple posting because I can:

It might be a hackish solution, but in 4.5 the API will have support for forumid as well, for usage with permission checks. So technically, it would be possible to do "admin chat" by somehow limiting the shout to a certain (admin-defined) forum ID.
It would save having to further alter the shout table with usergroupid or something to that effect.

Then again, some forums might not have an admin forum...
 
yeh some forums might not have an admin forum plus some forums might have 2 or 3 different admin groups. So I might add a setting in the admincp for which usergroups id's are allowed to use admin chat. Since they want moderators included in the admin chat or something or other.
 
Status
Not open for further replies.

Legacy vBShout

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
3,179
Customer rating
5.00 star(s) 1 ratings
Back
Top