Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Chat Room Integration with Vanilla - Testing One Now

edited August 2007 in Vanilla 1.0 Help
I just wanted to share that I had been looking for a chat program that would integrate with Vanilla and the current member database so that our members wouldn't have to sign up again and so they would be using their current usernames and I found a chat called V3 Chat for the very reasonable price of $35 that the programmer Jeff had integrated with a number of other forums and CMS's. We just got it installed yesterday and have been testing it and so far so good. the installation was to install the v3chatrooms folder on the site root and then this code below was added to the menu.php. This gave me an additional tab titled "Chat Room" on the far right. While the installation seems to work very good and do just what I want it too there is one thing that I would prefer. I would prefer as Mark suggests to have this integration as an extension or addon with the code in the extension folder instead of editing the themes/menu.php as was done. Mainly so that updates won't affect this install. My question is "Do you see any problems with this install by editing the menu.php file?" other than the updating issue? You can check out the program at their site here http://www.v3chat.com/chatroom.php and you can see the integration on my forum here at http://www.pasofinohorsedirectory.com/Forum/ . You will have to be registered and logged in to test it so just register and let me know. Jeff also helped me add my iframe code for my banner ad rotator so that my ads would display on the bottom of the chat window. Awesome. Just wanted to share in case someone else was looking for a chat and to get feedback on how it was integrated and any suggestions on creating an extension setup for it. Thank for any feedback and suggestions. Here are the instructions..... #### Start Of Installation Instructions #### FILE TO EDIT: themes/menu.php PURPOSE: Creates header menu tab 'Chat Rooms' Step 1) Add the following code directly to the top of the file before the first <?php <?php if ($this->Context->Session->UserID > 0) { ?> <script language="JavaScript"> <!-- var userName = "<?php echo $this->Context->Session->User->Name;?>"; var userID = "<?php echo $this->Context->Session->UserID;?>"; // --> </script> <script language="JavaScript" type="text/javascript" src="http://localhost/v3chatrooms/chat.js"></script> <?php }?> Step 2) Now scroll to line 34 (approx) which looks like, echo '</ul> And replace with this code instead, if ($this->Context->Session->UserID > 0) { echo '<li'.$this->TabClass($this->CurrentTab, $Tab['Value']).'><a href="#" onClick="launchChat();return false;">Chat Room</a></li>'; }else{ echo '<li'.$this->TabClass($this->CurrentTab, $Tab['Value']).'><a href="people.php">Chat Room</a></li>'; } echo '</ul> #### End Of Installation Instructions ####
«1

Comments

  • Check out the $Menu->AddTab function. This would be super easy to turn into an extension.
  • Is it just me, or has the first comment broken this discussion? Blocking the comment makes things even worse :/
  • In trying to fix it i broke it even more so I've just swapped the formatting of it to text - it seems alright-ish now.
  • mini: put it all around code tags
  • I did do but it messed up and split up the code blocks. Would you like me to do it again so you can see?
  • #### Start Of Installation Instructions #### FILE TO EDIT: themes/menu.php PURPOSE: Creates header menu tab 'Chat Rooms' Step 1) Add the following code directly to the top of the file before the first <?php <?php if ($this->Context->Session->UserID > 0) { ?> <script language="JavaScript"> <!-- var userName = "<?php echo $this->Context->Session->User->Name;?>"; var userID = "<?php echo $this->Context->Session->UserID;?>"; // --> </script> <script language="JavaScript" type="text/javascript" src="http://localhost/v3chatrooms/chat.js"></script> <?php }?> Step 2) Now scroll to line 34 (approx) which looks like, echo '</ul> And replace with this code instead, if ($this->Context->Session->UserID > 0) { echo '<li'.$this->TabClass($this->CurrentTab, $Tab['Value']).'><a href="#" onClick="launchChat();return false;">Chat Room</a></li>'; }else{ echo '<li'.$this->TabClass($this->CurrentTab, $Tab['Value']).'><a href="people.php">Chat Room</a></li>'; } echo '</ul> #### End Of Installation Instructions ####looks fine to me...?

    In regard to 'extensifying' it, you could do something as simple as this:
    <?php
    /*
    Extension Name: Chat Launcher
    Extension Url: http://lussumo.com/addons
    Description: Creates a tab which will launch a js-powered chat client
    Version: 1.0
    Author: your name here
    Author Url: N/A
    */
    
    if(isset($Head) && $Context->Session->User->UserID)
    {
    	$Head->AddString('<script language="JavaScript">
    		<!--
    		var userName = \''.$Context->Session->User->Name.'\';
    		var userID = \''.$Context->Session->UserID.'\';
    		// -->
    		</script>
    		<script language="JavaScript" type="text/javascript" 
    		src="http://localhost/v3chatrooms/chat.js"></script>'
    	);
    	
    	$Menu->AddTab('Chat Room', 'chat_room', '#', 'onclick="launchChat(); return false;"', 120);
    }
    
    ?>
  • Hmm. I was putting it into seperate code blocks for each step and it didnt seem too happy. Oh well.
  • If someone wouldn't mind helping a PHP noob out here, would they mind just describing what each bit of this line does?if(isset($Head) && $Context->Session->User->UserID)
  • In essence it just checks that both the object $Head and UserID are set. Technically you could wrap "$Context->Session->User->UserID" in an isset() function too and it would have the same effect.
  • And if the UserID is set it means that the user is logged in, yes? And then goes on to do everything else...
  • Actually I believe a non logged in user has a userID of 0 in which case it's a pretty pointless check. I might be wrong though.
  • mini: it's not quite like that. The isset function make sures there's a $Head variable to add strings to, so we won't generate errors in ajax and other situations where there isn't a rendered page. The other part ($Context->Session->User->UserID) checks if the user is logged in.
  • Thanks guys, much appreciated :)
  • Somehow it didnt occur to me that a userID of 0 would force that check to fail so you're right, it does check theyre logged in. *bows to sirnot.
  • You guys are the best! Thanks so much. SirNot your extension code worked like a charm! Hope you don't mind that I put you as the Author of yet another extension......Plus I passed this on to Jeff at V3Chat so that he can use it with future versions so that editing the Menu.php will not be necessary. I love it!

    Thanks Everyone for your attention to this !!
  • Hi, Anyone managed to inegrate v3 chat with vanilla yet? Or can any one explain how to integrate this please?
  • Ok guys, I've purchased the V3 Chat for $35 and I got it working fine but now I don't have any use for it! :) I can send the zip to the first person who reply for free or I would appreciate if you can link back to my site. Thanks.
  • OK am I the first to reply?

    Posted: Monday, 16 April 2007 at 3:41PM

  • sjeepssjeeps
    edited April 2007
    Hi Wanderer, please give me your email and I'll send it to you. Question: how did you get the "Who's online" to show up to visitors on this website?: http://www.debono.com.au/forum/index.php Thanks.
  • My contact details are here.

    I just checked my extensions-mods document and don't see anything I changed except for the CSS, however this is an older version of "Who's online" which I have not updated because it was not broken!

    Posted: Monday, 16 April 2007 at 4:31PM

This discussion has been closed.