Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Shoutbox dimensions and location

2

Comments

  • Options

    @KEP said:
    Whoops sorry. I wasn't paying close enough attention I guess. Thanks again.

    care or she can cut u head! trust me!! haha

    anyway i talking in PM with @caerostris , he working soon in a new version :)))

  • Options

    I still couldn't figure out how to get the shoutbox to the top of the content asset without using javascript to do so... Moving posts and stuff down using css didn't really work.. Can anybody point me in the right direction?

  • Options
    422422 Developer MVP

    is there a hook for afterMenu , have you tried beforeDiscussions

    There was an error rendering this rich post.

  • Options

    Oh, I'm sorry, I should have provided some code...
    I tried doing it like this:

    public function DiscussionsController_Render_Before($Sender) {
                    $this->includev2s($Sender);
            }

    where $this->includev2s (surprise) includes the van2shout module
    (like this):

    private function includev2s($Sender)
            {
                    $Session = GDN::Session();
                    if($Session->CheckPermission('Plugins.Van2Shout.View'))
                    {
                            //Display the delete icon?
                            if($Session->CheckPermission('Plugins.Van2Shout.Delete'))
                            {
                                    $Sender->AddDefinition('Van2ShoutDelete', 'true');
                            }
    
                            include_once(PATH_PLUGINS.DS.'Van2Shout'.DS.'modules'.DS.'class.van2shoutdiscussionsmodule.php');
                            $Van2ShoutDiscussionsModule = new Van2ShoutDiscussionsModule($Sender);
                            $Sender->AddModule($Van2ShoutDiscussionsModule, 'Content');
                    }
            }
  • Options
    caerostriscaerostris ✭✭
    edited March 2013

    I figured out a way to do it, but it is necessary to modify
    applications/vanilla/views/discussions/helper_functions.php
    because there seems to be no event or other hook in place that is fired before the discussionsTab begins. So right now it is necessary to add a line right after line 112. It has to look like this (Line 3 in this snippet is the added line):

    if (is_numeric($CountDrafts) && $CountDrafts > 0)
          $MyDrafts .= ''.$CountDrafts.'';
     $Sender->FireEvent('BeforeDiscussionTabsDiv');

    Is there any way to get the vanilla devs to add that event or is there another hook point I missed that would fit my needs?

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    I just used css to move it, it is not hard at all....

    
    #van2shout.Box {
    position: relative;
    margin-top: -650px;
    left: -700px;
    }
    #Content {
    float: left;
    width: 680px;
    margin: 400px 0 40px;
    }
    
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    @caerostris @Konquet @KEP

    Ok I tested this and it works like a charm !! Change to this in the default.php of the van2shout plugin for it to appear before the content. No need for css or anything else, this works.

    define('VAN2SHOUT_ASSETTARGET', 'Content');

    The chat box appears before the content . I must say I like it there better than the Panel.
    I guessed this right from the start, why nobody tested it is beyond me...Why I did not test it ? I just did :)

    van2.png 312.2K
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    If you want it after the content in the Foot

    define('VAN2SHOUT_ASSETTARGET', 'Foot');

    This will put it in the Head section

    define('VAN2SHOUT_ASSETTARGET', 'Head');

  • Options

    So strange. Yesterday, setting the AssetTarget to 'Content' in

    public function DiscussionsController_Render_Before($Sender) {

    made the shoutbox appear below the content. On your forum, the content asset is loaded above the content, which I suppose is related to theme you are using. But when I tried the Content asset again today, it look like this (find attached). I am so confused! :P

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    @caerostris

    no this line does not go anywhere near a controller. It is at the very beginning of the van2shout default.php.

    I am using the old version of the shout box not your upgrade, it could be something else you changed, I was able to repeat the procedure on other forums with the same result.

    Your screenshot looks like when I used Head as the target.

    
    define('VAN2SHOUT_ASSETTARGET', 'Content');
    
    // Define the plugin:
    $PluginInfo['Van2Shout'] = array(
        'Name' => 'Van2Shout',
        'Description' => 'A simple shoutbox for vanilla2 with support for different groups and private messages',
        'Version' => '1.03',
        'Author' => "Caerostris",
        'AuthorEmail' => 'email',
        'AuthorUrl' => 'http://caerostris.com',
            'SettingsPermission' => array('Plugins.Van2Shout.View', 'Plugins.Van2Shout.Post', 'Plugins.Van2Shout.Delete', 'Plugins.Van2Shout.Colour'),
            'RegisterPermissions' => array('Plugins.Van2Shout.View', 'Plugins.Van2Shout.Post', 'Plugins.Van2Shout.Delete', 'Plugins.Van2Shout.Colour'),
    );
    
    

    thanks for the heads up @peregrine I removed the email off the plugin info !

  • Options

    you might be careful when posting discussions with a persons email in it . Consider the privacy of the of the user. - e.g. could lead to more spam.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Options
    caerostriscaerostris ✭✭
    edited March 2013

    right peregrine, thanks, I didn't even think about that!
    @vrijvlinder Yeah, it's defined at the very beginning, but used in the controller :)
    If you follow the code, vanilla calls Base_Render_Before() (or in my case DiscussionsController_Render_Before()), which includes modules/class.van2shoutdiscussionsmodule.php. And that file uses the define you changed to as return value for the AssetTarget function.
    The controller shouldn't change anything though... If you'd use Base_Render_Before it shouldn't change anything at all... But I've changed the very same line you did anyway ;)

    I'm pretty sure there's something wrong with the new version of Van2Shout as 1.04 still works fine. But setting the shoutbox Asset to 'Content' definitely makes it appear below the content. I suppose this is related to the theme you are using...

    update: found the error, as excepted it's one of those you'd respond to with a 'facepalm'.
    'Content' Asset is still below the Content though ;)

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    I don't think it is theme related , I made this theme and the others I tested this on and also tested it with the default theme and the result is the same.

    I can move the chatbox anywhere I want using css, but that seemed like a hack. Pointing the asset elsewhere seemed less hassle and worked for me.

    I notice this line in my version of van2shout discussionscontroller.php maybe that is why it works , because it is a variable in case the target is defined to go in the content.

            if(defined('__VAN2SHOUT_INCLUDE__')) {
                echo "$('#van2shout').insertBefore('#Content');";
            }
        
    

    Edit:

    I changed that to insertAfter and it appeared after the content. That must have something to do with it no?

  • Options
    caerostriscaerostris ✭✭
    edited March 2013

    Yep, it has something to do with it, but for some reason it looks like VAN2SHOUT_INCLUDE is defined in your version of vanilla... (In default settings, the if shouldn't be true).
    I thought about doing it like that, but it's also some kind of dirty hack: It's a javascript, php inserts the code after the content but when the page finished loading, the javascript moves the Shoutbox above the content. That javascript way isn't exactly clean coding :P To be honest, that line of code is a relic from a custom version of Van2Shout that I forgot to remove ;-)

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Well seems like a fix , css seemed like a bigger hack though ;)

  • Options
    caerostriscaerostris ✭✭
    edited March 2013

    Haha ;) It kind of is, because the css code depends on the theme. If the theme changes, it might break your css. But the content element is the same in every theme (As long is it doesn't turn your vanilla forum into a blog, or does some equally dramatic change to it ;-) ). On the other hand, this code only works with js enabled (Well, the whole shoutbox only works with js enabled...). I'm still hoping to get it done on the php side of life...

  • Options

    I updated the code at github to use the js instead of my php hack... It's both dirty and the js hack is easier for the admin...

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited March 2013

    Well for a long time I relied on css for everything and for me it is not hard to use it for things like this on any theme. The shout box has the .Box class so it adopts the style , I did have to edit the style to match what I wanted it to look like, buttons size etc. It was easy and I did not have crazy results so far... I hope the people who wanted this mod can use this if it helps them. If you want I can zip my version and you can offer it as an alternative to the panel.

    It is interesting though that just by changing the target to anywhere like Head or Foot works as well. I was playing around with it and placed it everywhere by only changing the target. I thought that was way cool even for a hack !

  • Options

    Changing the asset isn't a dirty hack but the clean way to do it ;D I guess a lot of people would love your send button, maybe not so oversized for the Panel. It would be great if you could send me some code for that! My 'Content' asset is working pretty smooth now. The new version is going to be so much better then this old peace of crap (please excuse the bad language) ;)

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    actually I gave the input Button the class Button in the discussionscontroller.php and changed the Post to send . In my custom.css all my Buttons have that style. The title of the shout box I changed it in the h4 title of the same file. One can actually do all the styling from the custom.css by adding the elements to it.

    input type='submit' value='•SEND•' id='van2shoutsubmit' class='Button'

Sign In or Register to comment.