AjaxChat Integration (latest version 3.2.1)

Started by .HuNTeR., August 27, 2008, 12:59:06 AM

Previous topic - Next topic

TashaElizabeth

Quote from: mrtrc266 on March 07, 2009, 10:25:22 AM


For 1, 2 and 3 it looks like you just need to do the manual edits for your theme using a Package Parser




this worked great, thanks!!!

[unplugged]

Quote from: bluesinjid on May 17, 2009, 08:03:15 PM
hm...tried that but doesnt work, too bad because i need a php coed ;( not a html code ???

OK....the php code for that would be:

echo'<a href="javascript:window.open(\''.$boardurl.'chat/index.php\',\'Shoutbox\',\'width=600,height=400\');void(0);">View in Popup</a>';
;)
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



[unplugged]

#1942
Alright. Here is the first (of many, I hope) tweak for the AjaxChat mod.
Here's what I did:

Post Notification

The first step is to change a value for one of the database entries, so make backups! I think this could be made a permanent change without ill consequences maybe in future releases. ;)

The dateTime field of ajax_chat_messages needs the type changed to timestamp.

Next, open Sources/Post.php and search for
notifyMembersBoard($notifyData);
add after it:
// Ajax Chat New Topic Notification
global $user_info, $board, $scripturl, $boardName, $topic;
    $smcFunc['db_insert']('',
      'ajax_chat_messages',
      array(
         'userID' => 'int', 'userName' => 'string-255', 'userRole' => 'int', 'channel'=> 'int', 'ip' => 'string-255', 'text' => 'string-255',
         ),
      array(
         $posterOptions['id'], $user_info['name'], 1, 0, $posterOptions['ip'], '[color=red][b]New Topic: [url='.$scripturl . '?topic=' . $topic . '.new#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]'
         ),
      array('autopost')
   );
    // End Ajax Chat New Topic Notification


search for
sendNotifications($topic, 'reply');

replace it with:

     {
sendNotifications($topic, 'reply');

// Ajax Chat New Reply Notification
global $user_info, $board, $scripturl, $boardName, $topic;
    $smcFunc['db_insert']('',
      'ajax_chat_messages',
      array(
         'userID' => 'int', 'userName' => 'string-255', 'userRole' => 'int', 'channel'=> 'int', 'ip' => 'string-255', 'text' => 'string-255',
         ),
      array(
         $posterOptions['id'], $user_info['name'], 1, 0, $posterOptions['ip'], '[color=red][b]New Reply: [url='.$scripturl . '?topic=' . $topic . '.new;topicseen#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]'
         ),
      array('autopost')
   );
    // End Ajax Chat New Reply Notification
     }


That's it. Now, every time someone posts, a nice notification will popup in the chat/shoutbox displaying a link to the new post/reply.

This is by no means my creation, but rather a reworking of a tweak for nneonneo's shoutbox that I could not live without. ;)

Many thanks to hiver101 for pointing me in the right direction.

Enjoy!

EDIT: As pointed out by hcfwesker, the names of the tables may need to be changed from ajax_chat_messages to smf_chat_messages for this edit to work under SMF 2.0 Final.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



mrtrc266

OMG What a 2 days off, didn't even have a chance to log in. TYVM SK for your help here. I must say also WOW that is a great tweak for the Chat, I will add it to the FAQ's Tips N Trick right away....that's awesome!!!! :)

I will try to go through the posts that have not been addressed and reply in the morns and eves of the next few days as I have to get back to work  :(

[unplugged]

Hope you enjoy! There is more to follow. I am really liking the mod so far too.  :P

« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



TheListener

Its thanks to mrtrc266 that our members have a chatroom and games arcade.

Also saves us having to pay for a seperate chat too.

Now wheres the next job ;)

mrtrc266

SK...Lookin forward to them, your tweak has been added  ;)
~AJAX Chat Intergration FAQ's & Tips-N-Tricks~

I will do the notification edit in the Morn.

TYVM Listenerm glad I could help. The least I can to is payback what has been so freely given to me.

Have a great night all.

njdevils28

Hi all,

I had istalled this Mod a week ago and it worked great.

I installed a Gallery Mod yesterday and now I'm getting the following error for chat.......


Warning: require_once(./gwbbcode/gwbbcode.inc.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/c/i/t/cityofgamers/html/smf/gwbbcode/gwbbcode.php on line 23

Fatal error: require_once() [function.require]: Failed opening required './gwbbcode/gwbbcode.inc.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/c/i/t/cityofgamers/html/smf/gwbbcode/gwbbcode.php on line 23


Any clue what went wrong other than the new Mod screwing up Chat?

mrtrc266

@ njdevils28 try uninstalling the gallery and then the chat.

Then install the Gallery first and then the chat. I had a similar prob with another Mod and that seemed to work for me.

mrtrc266

@ SK, I tried the edit for the notification...

editing the table seems to be no problem    ALTER TABLE `ajax_shout_messages` CHANGE `dateTime` `dateTime` TIMESTAMP NOT NULL     After I do the second edit add after "sendNotifications($topic, 'reply'); I can't reply to or create new topics. Takes me to a 500 error page.

Any ideas?

File attatched if that's helpful

[unplugged]

I am at work currently, but will be happy to take a look at it when I get home in about 5 hours. :D
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



[unplugged]

#1951
I'm home. ;)

On the second block of code, it needs to be wrapped in { } like this:

if ($topic_info['approved'])
{


sendNotifications($topic, 'reply');

   // Ajax Chat New Reply Notification
global $user_info, $board, $scripturl, $boardName, $topic;
    $smcFunc['db_insert']('',
      'ajax_chat_messages',
      array(
         'userID' => 'int', 'userName' => 'string-255', 'userRole' => 'int', 'channel'=> 'int', 'ip' => 'string-255', 'text' => 'string-255',
         ),
      array(
         $posterOptions['id'], $user_info['name'], 1, 0, $posterOptions['ip'], '[color=red][b]New Reply: [url='.$scripturl . '?topic=' . $topic . '.new;topicseen#new'.']'.html_entity_decode($_POST['subject']).'[/url][/b][/color]'
         ),
      array('autopost')
   );
    // End Ajax Chat New Reply Notification
}
else


so that the sendNotifications($topic, 'reply'); and the AjaxChat code block are both inside the brackets. I will go and change my original post to reflect this as well. The reason for the oversight is I have mine inside an array of boards to skip notification. ;) The first block of code should work as is.

I used your posted Post.php (modded and attached) on my test site and it worked fine for posting.
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



Hiver101

Hello,
Is there any of you guys know how to tweak this mod in such a way that when we post an internal forum link to it, it won't open another window. I think Sunking also love this idea. Thanks in advance.

primetime

Quote from: primetime on May 18, 2009, 12:56:24 PM
Does this MOD have the capability to archive chats?

I guess the answer is a resounding no ? :) Maybe? not yet?  :)

mrtrc266

Quote from: primetime on May 21, 2009, 01:03:46 PM
Quote from: primetime on May 18, 2009, 12:56:24 PM
Does this MOD have the capability to archive chats?

I guess the answer is a resounding no ? :) Maybe? not yet?  :)

Sorry, missed this one. It does archive chat logs. To view them simply goto http://yoursite.com/chat/?view=logs

SK, still havin probs with the notification edit, will post in more detail when I get home.

clashbot

hello, I installed the chat, no errors in the log, button where it should be, etc. When I click on chat, the window pops up like it should, but for some reason it is not passing the user information to the chat. I repeatedly show no one online, logout does nothing, etc. Any ideas where to start to find the issue?

dzinerfusion

#1956
Hm my chat still never opens in a popup!!! When i use the default all is good but in the ''prof'' theme, it opens in the same window!! What did i do wrong???

Ok heres my index.template...

I put it the code

if ($modSettings['enableChatBelowPM']){
$count = count(chatOnlineUsers());
if ($count == 0 )
echo '<br />' . $txt['chat_no_user'];
elseif ($count == 1 )
  echo '<br />  1' . $txt['chat_aUser']. '.<br />';
else
  echo '<br /> ' . $count. $txt['chat_users']. '<br />';
}
$num = ($modSettings['enableChatButtonNo']) ? $count : 0;
$context['menu_buttons']['chat']['title'] .= ($num > 0) ?  ('('.$num.')') : '';
if ($modSettings['chatPopUp']){
$context['menu_buttons']['chat']['href'] .= '" onclick="openWindow(this.href);this.blur();return false;';
echo '
<script type="text/javascript">
          function openWindow(url,width,height,options,name) {
          width = width ? width : 800;
            height = height ? height : 600;
              options = options ? options : \'resizable=yes\';
              name = name ? name : \'openWindow\';
              window.open(
              url,
              name,
              \'screenX=\' (screen.width-width)/2 \',screenY=\' (screen.height-height)/2 \',width=\' width \',height=\' height \',\' options
              )
          }
</script>';
}



But not sure if this code points to the wrong place of my forum buttons :(

THe html code for the page source would be this

<div id="main_menu">
<ul class="clearfix">
<li id="button_home" class="active">
<a title="home" href="http://modernopolis.byethost32.com/forum/index.php">
<span>Home</span>

</a>
</li>
<li id="button_Forum">
<a title="Forum" href="http://modernopolis.byethost32.com/forum/index.php?action=forum">
<span>Forum</span>
</a>
</li>
<li id="button_help">

<a title="help" href="http://modernopolis.byethost32.com/forum/index.php?action=help">
<span>Help</span>
</a>
</li>
<li id="button_search">
<a title="search" href="http://modernopolis.byethost32.com/forum/index.php?action=search">
<span>Search</span>
</a>

</li>
<li id="button_admin">
<a title="admin" href="http://modernopolis.byethost32.com/forum/index.php?action=admin">
<span>Admin</span>
</a>
</li>
<li id="button_profile">
<a title="profile" href="http://modernopolis.byethost32.com/forum/index.php?action=profile">

<span>Profile</span>
</a>
</li>
<li id="button_pm">
<a title="pm" href="http://modernopolis.byethost32.com/forum/index.php?action=pm">
<span>My Messages</span>
</a>
</li>

<li id="button_calendar">
<a title="calendar" href="http://modernopolis.byethost32.com/forum/index.php?action=calendar">
<span>Calendar</span>
</a>
</li>
<li id="button_affiliates">
<a title="affiliates" href="http://modernopolis.byethost32.com/forum/index.php?action=affiliates">
<span>Affiliates</span>

</a>
</li>
<li id="button_mlist">
<a title="mlist" href="http://modernopolis.byethost32.com/forum/index.php?action=mlist">
<span>Members</span>
</a>
</li>
<li id="button_downloads">

<a title="downloads" href="http://modernopolis.byethost32.com/forum/index.php?action=downloads">
<span>Downloads</span>
</a>
</li>
<li id="button_chat">
<a title="chat" href="http://modernopolis.byethost32.com/forum/chat/index.php">
<span>Chat</span>
</a>

</li>
<li id="button_logout" class="last">
<a title="logout" href="http://modernopolis.byethost32.com/forum/index.php?action=logout;dda542f15ae0=c9997b349c3498c9fabea356076525ef">
<span>Logout</span>
</a>
</li>
</ul>
</div>


Ok i got this code from the modsettings of ajax chat.

'" onclick="openWindow(this.href);this.blur();return false;';
echo '
<script type="text/javascript">
          function openWindow(url,width,height,options,name) {
          width = width ? width : 800;
            height = height ? height : 600;
              options = options ? options : \'resizable=yes\';
              name = name ? name : \'openWindow\';
              window.open(
              url,
              name,
              \'screenX=\' (screen.width-width)/2 \',screenY=\' (screen.height-height)/2 \',width=\' width \',height=\' height \',\' options
              )
          }
</script>';


How would i add it so it WILL popup not ''if $modsettings allow it''?

windrider

I don't know...I keep getting a Connection Status: 404 error no matter what I try to do with the mod, I have every file at 777 and it still doesn't work.

[unplugged]

404 means something cannot be found.


Did you try all of the suggestions post here?
« Next Edit: Tomorrow at 08:34:45 PM by SunKing »   <---- « someone stole my sig... :o »



njdevils28

Quote from: mrtrc266 on May 20, 2009, 10:37:26 AM
@ njdevils28 try uninstalling the gallery and then the chat.

Then install the Gallery first and then the chat. I had a similar prob with another Mod and that seemed to work for me.

@mrtrc266....

Thanks for the tip.  I ended up hosing my whole site.  I had to re-install a full package Thank God the DB was not corrupted.

Would you happen to know if this mod works for 2.0 RC1-1?

Also, does this mod handle the logs efficiently?  What I mean is, does it perform it's on maintenance to avoid logs becoming to large and slowing down the chat?  If not, is there a tool to handle the chat logs to avoid them becoming to large?  Is there a way to automate a rename of the current log to a log with a time stamp and then have the mod create a new log?  Is this even an issue or am I worrying about nothing?

Where would I find the logs so I can do it myself?

Advertisement: