Discussbot 4.2 beta 1 released 10/5/06

Started by chadness, October 06, 2006, 02:28:41 AM

Previous topic - Next topic

chadness

OK, trying to revive this and make it compatible with Orstio's bridge 1.1.6 and SMF 1.1 RC3.

For discussing your Joomla content articles on designated SMF boards. These discussions can be displayed in the content article.

Install the same as any mambot, through the Administration mambot installer.

To upgrade from a previous version, the easiest way is to just upload the files in to your /mambots/content directory, overwriting the previous ones. Then go in to the mambot properties in Administration, and save the settings.

Here's the features I've added (though there may be some I forgot that I coded in a long time ago):

  • Orstio bridge version 1.1.6 compatibility.
  • Hopefully fixed the display problems when running on certain pages with other SMF modules.
  • Added option for nofollow rel tag so Google's bot (and possibly others) will not follow links.
  • Added option to choose whether or not to display in modules (apparently in Joomla 1.0.10 content mambots started to be able to display in modules).
  • Added option to use SMF board numbers instead of name

So far I've only tested this with Joomla 1.0.11, SMF 1.1 RC3, and Orstio's bridge 1.1.6.  I would appreciate feedback from testing any other configurations.  This is an early beta - I wouldn't go throwing it on any important production sites!

Thanks!  And thanks to Skydig and Orstio for various fixes!

Download here:
http://www.technoadvice.com/component/remository/Download/Joomla-and-Mambo/SMF-Discussbot-version-4.2-beta-1/

The following code should go at the end of your Joomla template:
<?php 
ob_start
('output');
$buffer ob_get_contents();
ob_end_clean();
$buffer str_replace('<input type="hidden" name="sc" value="" />'
,'<input type=hidden name="sc" value="'.$sc.'">'$buffer);
echo 
$buffer;
?>


Known Issues:


  • There are problems if you have two separate databases for Joomla and SMF.  The easiest workaround is to use the same database username and password for both your Joomla and your SMF database (both users should already have been set up with complete access to the other database to get the bridge to work).  In the SMF Admin Server Settings, you can easily change the username and password that your site is using.
  • Special characters such as ü do not seem to work.  You will run in to problems with special characters if they are in the subject of you articles.  When auto-generating the SMF thread, it will only make the subject up to the special character, then cut off the rest.  The only work-around for this at the moment is to manually fill in the rest of the subject line - if you do this, the link from the article should find the correct post.

    Any quoted articles will be cut off at any special characters as well.

M3g4d37h

Sorry to be an ignoramous here, but can you tell me what this (discussbot) mod does, or provide a link that does?
Conscience is the inner voice which warns us that someone may be looking. -- Henry Louis Mencken

Orstio

#2
http://www.everything-science.com/sci/Frontpage/

Take a look at the end of each article.  You'll see a speech balloon and link "(X) Comments posted about this in the forum".

If there is no topic started about the article, the bot creates one.  If there is, it the link takes you to the discussion.

Chad added the ability to display the topic at the bottom of the article, complete with BBC and smiley parsing, along with a whole lot of other features.

4.2 is really looking good.   ;D

M3g4d37h

#3
Wow, thanks Orstio .. That's wicked!

Chad, nice work indeed -- Do you have to use the tag at the bottom if you want the item posted to the default forum category?
Conscience is the inner voice which warns us that someone may be looking. -- Henry Louis Mencken

sektor

Quote from: chadness on October 06, 2006, 02:28:41 AM
Here's the features I've added (though there may be some I forgot that I coded in a long time ago):

  • Orstio bridge version 1.1.6 compatibility.
  • Hopefully fixed the display problems when running on certain pages with other SMF modules.
  • Added option for nofollow rel tag so Google's bot (and possibly others) will not follow links.
  • Added option to choose whether or not to display in modules (apparently in Joomla 1.0.10 content mambots started to be able to display in modules).
  • Added option to use SMF board numbers instead of name

Excellent.

I'll be testing this, and post for results.

maxigs

#5
just installed on my joomla (x.11) with smf RC3 and the 1.6bridge

seems to work fine so far (just looking through the options)

but i have one problem:

adding the following lines to my template as it should be done, i only get a empty page in my joomla everywhere, if i leave the code out its working (as far as i tested so far)

<?php ob_start('output');$buffer ob_get_contents();ob_end_clean();$buffer str_replace('<input type="hidden" name="sc" value="" />','<input type=hidden name="sc" value="'.$sc.'">'$buffer);echo $buffer;?>


do i have to worry about that?



edit:


when leaving a comment it does not affect the discussbot, and everytime someone klicks on the link to the discussion it opens a new topic.
i have joomla and smf in seperate DBs but since there is a field in the config of the bot this should not be the matter.

and i dont get the topic to show up (and neither the quick reply box) under the article.

both problems may be because of the problem with the code inserting, so i dont want to say its a error.

i would be glad if you could give me a clue what is going wrong here

chadness

Quote from: Orstio on October 06, 2006, 06:14:07 AM
4.2 is really looking good.   ;D
Thanks!  That conditional statement for the SSI was the real key.  :)

chadness

Quote from: M3g4d37h on October 06, 2006, 06:22:59 AM
Chad, nice work indeed -- Do you have to use the tag at the bottom if you want the item posted to the default forum category?
If you set up a default board for comments to be posted to, you do not have to add in the {mos_smf_discuss:board name} code to your articles - it will automatically add it to each one.

chadness

maxigs - where exactly were you putting the code?

maxigs

Quote from: chadness on October 06, 2006, 09:19:08 AM
maxigs - where exactly were you putting the code?

at the very end of the index.php template file

but i think i found the error anyway already. in IE the page did not work when the output compression was turned on (while the code was inserted), in opera it did not make any problems.

now i turned the output compression of and the pages show up again, but still i have the other problems as described.

i have one more clue:
the board for the comments is yet only accessible from moderators since its only for testing purposes, would this affect the bot?

chadness

I wouldn't think so, as long as the person who is posting has access to it.  I've done it on boards that aren't publicly accessible before.

It seems like it's not finding your post at all.  Try changing line 173 from this:

        $database->setQuery("SELECT ID_BOARD FROM {$db_prefix}boards WHERE name='$catid';");

to this:

        $database->setQuery("SELECT ID_BOARD FROM {$db_prefix}boards WHERE name='" . $catid . "';");


If that doesn't work, try changing to using board numbers instead of board names.

maxigs

i tried both ways, ids and name

with the id it at least finds the right board (i anyway used that front the beginning) and with the board name its just showing an error "the topic you want to view does not exist or you dont have the permission to view it" (permission definately should not be it since i'm properly logged in)

with the code change you gave me it did not work either.. :(

i really wonder whats going wrong. it can find the right board (the link leads to the right board and opens a topic in it) but it does not want to find a matching topic and always opens a new one.

chadness

OK, I'm kind of reaching here, but is your board using english?  Also, are there any other topics or boards with the same name?

maxigs

Quote from: chadness on October 07, 2006, 11:03:38 PM
OK, I'm kind of reaching here, but is your board using english?
no, both joomla and smf are in german  :-[

Quote from: chadness on October 07, 2006, 11:03:38 PM
Also, are there any other topics or boards with the same name?
definately not

Orstio

On some servers, when using SMF and Joomla in separate databases, you can't use the $database object to access the SMF database.

maxigs

any good way to go around this, or do i really have to merge my databases again, after finally splittting them  :'(

Orstio

No.  This:

        $database->setQuery("SELECT ID_BOARD FROM {$db_prefix}boards WHERE name='$catid';");
        $boardid=$database->loadResult();


Needs to be something more like this:

        $query = mysql_query("SELECT ID_BOARD FROM {$db_prefix}boards WHERE name='$catid';");
        list($boardid) = mysql_fetch_array($query);



satcom

#17
hey all, im having problems with the bot.

once installed, when i access the forum, it kinda starts refreshing the page like crazy!
this happens on IE only.
does this sound familiar?

i cant keep the site with the bot installed as example, since 80% is using IE.

it might be handy to note that im using OPENSEF on the website too.

www.webturd.com

Farix

#18
I have gone through the code of the discussbot and thought it could use a lot of cleanup. For starters, it is hard to tell what the bot is doing at any point because of the general lack of comments. Second, I have noticed many variables are declared as globals two or three—and in one case four—different times, some of which are not being used. Also, the bot's parameters could be passed from one function to another in a more eloquent manner then by using globals. And finally, the format of the code should be made much more consistent and readable.

All of these problems makes the discussbot far more difficult to modify then it should.

EDIT: One question I do have is what is the advantage of switching between the two databases (Joomla and SMF) using mysql_select_db() instead of opening a second connection for the SMF queries?

Orstio

QuoteEDIT: One question I do have is what is the advantage of switching between the two databases (Joomla and SMF) using mysql_select_db() instead of opening a second connection for the SMF queries?

Two connections are open, but you still need to switch databases when Joomla and SMF tables are not installed in the same database.

Advertisement: