New and improved Joomla compatible discuss bot (4.1 beta 5 released 11-14-05)

Started by chadness, October 18, 2005, 01:17:39 PM

Previous topic - Next topic

torkil

Does that discussbot facilitate quick-reply directly after articles, or do you have to follow a link to the forums?

Btw: Found a new bug: Smileys aren't parsed at all... I just get the BBC-tags in the middle of the messages, like this:
:confused:

Perhaps difficult to fix?

sastrugi

Quote from: torkil on November 04, 2005, 06:52:28 AM
Does that discussbot facilitate quick-reply directly after articles, or do you have to follow a link to the forums?

In the working versions I've seen it takes you to your forum with n-lines of the article pasted into your new forum post as a quote.


torkil

Quote from: torkil on November 04, 2005, 04:58:34 AM
Bug report:
I get this error message on my frontpage:
Warning: preg_replace(): Unknown modifier '/' in /path/to/my/site/mambots/content/smf.discussbot.php on line 205

Found out that this line (number 149) is causing the error:
"/jpg([^\]http://]*)\]{1}/",

sastrugi

Quote from: torkil on November 04, 2005, 11:22:51 AM
Quote from: torkil on November 04, 2005, 04:58:34 AM
Bug report:
I get this error message on my frontpage:
Warning: preg_replace(): Unknown modifier '/' in /path/to/my/site/mambots/content/smf.discussbot.php on line 205

Found out that this line (number 149) is causing the error:
"/jpg([^\]http://]*)\]{1}/",


a combined effort (wel, mostly a friend of mine ;) ) over here has made some progress with the non-functioning smf.discussbot.

line 60 reads

if ( (!strpos($row->text,"{mos_smf_discuss")  && $default_discuss == "")) {

changing it to

if ( (!strpos($row->text,"{mos_smf_discuss") === false && $default_discuss == "")) {

clears the error of showing the 'code' as text and displays the button and its text to link to the forum -YAY!!


However, something else breaks; the articles now have the error message :

Warning: preg_replace(): Unknown modifier '/' in /hsphere/local/home/.../cms/mambots/content/smf.discussbot.php on line 198


However(2), all is not lost, if you actually click on the "discuss" link, thereby creating an article in the forum the error message goes away - YAY!!

However(3), if you delete the forum post the error message come back


Well, as I say, progress of sorts. My mate, who gave me the "=== false" idea is too busy to help further and, tbh, its largely beyond me but hopefully what I've found/posted above can help nail this gremlin once and for all.


Follwoing on from Torkil's post above:


at line 144 (in my version of smf.discussbot.php, commenting out the line :

//                                              "/jpg([^\]http://]*)\]{1}/",

and at line 175 :

//                                              ($quote_images=="1" ? "jpg[/img]" : ""),

gets rid of the error message but I've no idea if it breaks anything else

HTH




torkil

Take the code at line 144 and change it so that it looks like the code on the lines 145 and 146. That should solve the problem. I think I just removed the http://-bit.

I now have another problem: I can't turn the discussbot off! Not even if I unpublish it! I actually had to uninstall to turn it off. Kind of troublesome when you don't want it to be autoenabled :)

chadness

#25
Wow, busy day!  Good work, I'll look at these changes.

Torkil, your suggestions should both be doable - I'll post more specifics in a little while.

QuoteQuestion:
Why does that block of code need to be added to the template? What does it do?
It's necessary for the quick reply box to function.  It's Orstio's coding, so I don't know the exact details - I just hack and edit simple stuff.

QuoteBtw: Found a new bug: Smileys aren't parsed at all... I just get the BBC-tags in the middle of the messages, like this:
:confused:

Perhaps difficult to fix?
That's a good question - I'm not exactly sure how to fix that - it would either be translating over to use Joomla's smileys, or pulling them from SMF correctly.  The posts don't really get parsed, like the articles do when getting copied to the forums.

I'm working on other replies to you guys - hold tight....

chadness

Quote from: sastrugi on November 04, 2005, 11:40:37 AM
a combined effort (wel, mostly a friend of mine ;) ) over here has made some progress with the non-functioning smf.discussbot.

line 60 reads

if ( (!strpos($row->text,"{mos_smf_discuss")  && $default_discuss == "")) {

changing it to

if ( (!strpos($row->text,"{mos_smf_discuss") === false && $default_discuss == "")) {

clears the error of showing the 'code' as text and displays the button and its text to link to the forum -YAY!!

That's bizarre - you basically made it a double negative.  Try removing the ! at the beginning of strpos and see if it still works, like so:
if ( (strpos($row->text,"{mos_smf_discuss:")===false && $default_discuss == "")) {


If that works, it means your system doesn't like the !.

chadness

All right, try this, 4.1 beta 2:
http://www.technoadvice.com/component/option,com_docman/task,doc_download/gid,5/Itemid,53/

This beta version adds:

  • Ability to turn off the icon linking to the discussion.
  • Ability to turn off viewing the discusion links on the front page. (note - this doesn't affect the {mos_smf_discuss:no_discuss} tag.)
  • Fixes the inability to unpublish the bot.
  • Fixes problems some were having parsing jpg files.
  • Hopefully fixes problems with the bot working for some.

I whipped this together pretty quickly, so hopefully it's OK :)

torkil

Chad: I made some improvements on your previous version of the bot and made it possible to link to the users profile and to display the time too.
(when the comment was posted)

Do you want the code? It's just a couple of modified lines, so it might be just as quick to write it yourself :)

Orstio

Try putting no_discuss as the default discussion board in the bot params.

chadness

Quote from: Orstio on November 05, 2005, 10:15:31 AM
Try putting no_discuss as the default discussion board in the bot params.
Should that help with the problems sastrugi was having?

Do you know why that http:// was after the jpg in the parsing?

Torkil - go ahead and post the code changes and I'll add them.  Did you try the beta 2 version of the bot?

Orstio

QuoteDo you know why that http:// was after the jpg in the parsing?

There are a few extra "http://"s in there.  It looks like somebody edited the file with DreamWeaver or MS Frontpage, which like to "help" by adding that stuff in automatically.

chadness

Ah, OK, I couldn't figure out why those would possibly be in there.  Wasn't me, I only use Source Edit :)  I'll try to clean those out in the next version.

Orstio

You can probably just copy the arrays from the original discussbot.  There should be no reason for changing them;  They are there just to convert HTML to SMF's BBC.

chadness

Looks like the table and td code was messed up, too.

OK, I've put together 4.1 beta 3.

This beta version adds:


  • Ability to turn off quick reply box for guests (turned off by default).
  • Removed some problem tags.


torkil

#35
To add a link to the posters name you have to make 2 changes:
1) Load the posters ID in the db query so you have to change this
SELECT posterName, (...)
to this
SELECT ID_MEMBER, posterName, (...)

2) You have to insert a link on the posters name
I inserted this code where the posters name is printed:
if ($posts['ID_MEMBER'] > 0) {
    $showlink .= '<a href="'.$myurl.'&amp;action=profile;u='.$posts['ID_MEMBER'].'">'.$posts['posterName'].'</a>';
} else {
    $showlink .= $posts['posterName'];
}


A couple of other things I edited:

1) I didn't want the posternames and the "comments" headline to appear in the same style as the article headline (css style contentpagetitle or something), so I edited all class-declarations to this:

- The header text (Typically "COMMENTS:"): discussbot_heading
- Post title: discussbot_postheader

This gives the site owner better control of how he/she wants the discussion to look :)

torkil

#36
To add the post time to each comment:

1) Edit the DB query from this:
SELECT ID_MEMBER, posterName, subject, body (...)

to this:
SELECT ID_MEMBER, posterName, subject, body, FROM_UNIXTIME(posterTime, '%d.%m.%y - %H:%i') AS msgTime (...)

This data should probably be a value that you can change in the settings to make the date appear differently:
%d.%m.%y - %H:%i

It could say: "Enter the date format you wish the post date to appear in, or leave blank if you do not want the post date to be displayed"

Then you have to print out the date too. I inserted this code where the posts are printed:
$showlink .= "<span class=\"discussbot_publishtime\">// ".$posts['msgTime']."</span>";

This will print out something like this: // 06.11.05 - 12:33
(a post made on november 6th, at 12:33. ..... Typical Norwegian date format :) )

torkil

Ah yes, one last thing I added:

I put a container around all comments like this:

<div class="discussbot_container">
comment 1 here
comment 2 here
comment 3 here
etc.
</div>

I did this because I immediately had a problem with a long word in one comment. It was a very long URL that was pasted in, with the result that the webdesigns center column was expanded accordingly, making the whole site look messed up.

With the div in place I could easily just set it to overflow: hidden so that all extra long words got cut away. Maybe not the ideal solution, but hey. A wordwrap might be better?

hshan

Quote from: chadness on November 06, 2005, 12:12:26 AM
Looks like the table and td code was messed up, too.

OK, I've put together 4.1 beta 3.

This beta version adds:


  • Ability to turn off quick reply box for guests (turned off by default).
  • Removed some problem tags.



Thank you guys for delving into fixing this mambot as it is very usefull. I can confirm that it is now working again. Previously, I couldn't get around this error..

QuoteBug report:
I get this error message on my frontpage:
Warning: preg_replace(): Unknown modifier '/' in /path/to/my/site/mambots/content/smf.discussbot.php on line 205

Now all is well again and I can use the bot. Thanks for your efforts!

fj0

I just wanted to thank you for this great mod!

And I have a question, is it possible to get the whole article in the forumpost as well? I don't want no cutoff.

Thanks in advance!

Cheers,
Mario

Advertisement: