serendipity_event_forum<>PHPbb3
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
serendipity_event_forum<>PHPbb3
Hi, just started setting up de first serendipitysite with a PHPbb combination.
I run into the fact that the serendipity_event_forum plugin is made for PHPbb-2.x.
Has anybody finished a adapted plugin allready ?
I have myself adapted a piece of the plugin to work with the PHPBB-3 forum, and it 'seems' to be working now for me. It had some apearent bug as standard and those were fixed as well.
Adapting the plugin globally is needed because the phpbb3 has dropped the seperate table phpbb_posts_texts table and merged it with phpbb_posts. This requires some renaming, and altering inserts into Updates. Also fields like topic_replies_real need filling and poster_id fields need proper id entries.
One issue remains, and I wonder if anyone can tell me if its legacy or new:
-i'm unable to remove any comments in the serendipity site below an article.
any idea ?
I run into the fact that the serendipity_event_forum plugin is made for PHPbb-2.x.
Has anybody finished a adapted plugin allready ?
I have myself adapted a piece of the plugin to work with the PHPBB-3 forum, and it 'seems' to be working now for me. It had some apearent bug as standard and those were fixed as well.
Adapting the plugin globally is needed because the phpbb3 has dropped the seperate table phpbb_posts_texts table and merged it with phpbb_posts. This requires some renaming, and altering inserts into Updates. Also fields like topic_replies_real need filling and poster_id fields need proper id entries.
One issue remains, and I wonder if anyone can tell me if its legacy or new:
-i'm unable to remove any comments in the serendipity site below an article.
any idea ?
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: serendipity_event_forum<>PHPbb3
Hi!
That's true, it's suitable for 2.x only, the DB structure has changed a lot.
So it would be cool if the plugin could get a config option switch so that people can choose between 2.x and 3.x, and the code forks to the appropriate SQL insert statements.
Thus, I'd be very interested in your code changes, could you provide a patch so that I can merge it with the official plugin?
Regards,
Garvin
That's true, it's suitable for 2.x only, the DB structure has changed a lot.
So it would be cool if the plugin could get a config option switch so that people can choose between 2.x and 3.x, and the code forks to the appropriate SQL insert statements.
Thus, I'd be very interested in your code changes, could you provide a patch so that I can merge it with the official plugin?
That's actually a missing feature, and didn't work with 2.x before. Since comments are stored in the phpbb table, you'd need to delete "comments" inside phpbb, instead of in s9y. Codewise, I don't think it would be possible to replace s9y's comment routine to access the phpbb installation completely.One issue remains, and I wonder if anyone can tell me if its legacy or new:
-i'm unable to remove any comments in the serendipity site below an article.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
A patch set is a little difficult for me now, but i'd be happy to give you the changed file so you can do a diff yourself (sry about that).
Let me explain my problem in more detail, as I get the impression you misunderstood;
Adding a comment in my current setup adds the comment to BOTH serendipity and PHPbb3.
When I try to remove a comment from the serendipity site comment list, it popups with a confirmation, but then does not delete the comment from the s9y comment list. (i did not expect it to do it in phpbb anyway, but would be cool
)
I'll add some comment to the places I refactored to make it work with phpbb3 and mail or PM you the file. If you want it to another address just PM me with it.
Let me explain my problem in more detail, as I get the impression you misunderstood;
Adding a comment in my current setup adds the comment to BOTH serendipity and PHPbb3.
When I try to remove a comment from the serendipity site comment list, it popups with a confirmation, but then does not delete the comment from the s9y comment list. (i did not expect it to do it in phpbb anyway, but would be cool
I'll add some comment to the places I refactored to make it work with phpbb3 and mail or PM you the file. If you want it to another address just PM me with it.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!

Actually, the plugin should not be responsible for not deleting the comment; it shouldn't affect that. Can you delete a comment frmo the s9y administration panel successfully?
Are you logged in as an admin when deleting a comment? It might be that the internal s9y comment deletion routine performs stricter checks than those that are performed when showing you the "delete comment" link, that could be a bug indeed.
Regards,
Garvin
Sure, that would be fine enough for meReLight wrote:A patch set is a little difficult for me now, but i'd be happy to give you the changed file so you can do a diff yourself (sry about that).
Ah, okay. Indeed I misunderstood you, sorry for that.When I try to remove a comment from the serendipity site comment list, it popups with a confirmation, but then does not delete the comment from the s9y comment list. (i did not expect it to do it in phpbb anyway, but would be cool)
Actually, the plugin should not be responsible for not deleting the comment; it shouldn't affect that. Can you delete a comment frmo the s9y administration panel successfully?
Are you logged in as an admin when deleting a comment? It might be that the internal s9y comment deletion routine performs stricter checks than those that are performed when showing you the "delete comment" link, that could be a bug indeed.
A PM to this forum would be sufficient, thanks a lot.I'll add some comment to the places I refactored to make it work with phpbb3 and mail or PM you the file. If you want it to another address just PM me with it.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
Indeed I can delete the comments from the AdminInterface, its the same user loged in so it seems a bug in s9y.
I PM'd the diff text to you. The mirror plugin is great but can be expanded in functionality. A functional switch for phpbb2 or phpbb3 would be best.
->update.
Comments added to articles created before the phpbb3 intergration can be deleted. So there is a relation to the plugin i think.
I PM'd the diff text to you. The mirror plugin is great but can be expanded in functionality. A functional switch for phpbb2 or phpbb3 would be best.
->update.
Comments added to articles created before the phpbb3 intergration can be deleted. So there is a relation to the plugin i think.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Hm, I can't exactly reproduce this here. A link when deleting a comment should look like:
http://.../comment.php?serendipity[delete]=1239&serendipity[entry]=67&serendipity[type]=comments
Can you check if the comments you made after phpbb integration have a similar link?
This link should open comment.php, which calls the serendipity_deleteComment() function. That is defined in include/functions_comments.inc.php. Could you check that function?
And please check, how the entry of a phpbb-comment looks in your serendipity_comments DB table, and can you see if it looks different than the comments made before phpbb3 integration? I think it could be, that a column like "type" or "status" could be different?
Regards,
Garvin
Hm, I can't exactly reproduce this here. A link when deleting a comment should look like:
http://.../comment.php?serendipity[delete]=1239&serendipity[entry]=67&serendipity[type]=comments
Can you check if the comments you made after phpbb integration have a similar link?
This link should open comment.php, which calls the serendipity_deleteComment() function. That is defined in include/functions_comments.inc.php. Could you check that function?
And please check, how the entry of a phpbb-comment looks in your serendipity_comments DB table, and can you see if it looks different than the comments made before phpbb3 integration? I think it could be, that a column like "type" or "status" could be different?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
Normal link of article before plugin intergration:
Remove link of article AFTER plugin intergration:
-> seems the same.
Content of DB is totally different.
SQL-query: SELECT * FROM `comments` LIMIT 0, 30 ;
Rijen: 2
normal s9y comment
phpbb mirror comment
Code: Select all
/serendipity/comment.php?serendipity[delete]=10&serendipity[entry]=2&serendipity[type]=commentsRemove link of article AFTER plugin intergration:
Code: Select all
/serendipity/comment.php?serendipity[delete]=28&serendipity[entry]=15&serendipity[type]=commentsContent of DB is totally different.
SQL-query: SELECT * FROM `comments` LIMIT 0, 30 ;
Rijen: 2
Code: Select all
id entry_id parent_id timestamp title author email url ip body type subscribed status referer
normal s9y comment
Code: Select all
10 2 0 1199274991 Remon remon@mail.net 212.123.144.148 Een net artikel. NORMAL false approved http://moederwordennaje36ste.nl/serendipity/index....
Code: Select all
11 15 0 NULL phpbb_mirror NULL NULL http://www.xxxxxxx.nl/phpBB3/viewtop... NULL NORMAL false approved NULL-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Could you please replace your serendipity_deleteComment() function in include/functions_comments.inc.php with this:
I've added debug output that you should see after clicking the delete link of a comment.
Regards,
Garvin
Could you please replace your serendipity_deleteComment() function in include/functions_comments.inc.php with this:
Code: Select all
function serendipity_deleteComment($id, $entry_id, $type='comments') {
global $serendipity;
$id = (int)$id;
$entry_id = (int)$entry_id;
if ($id < 1 OR $entry_id < 1) {
die('No valid entryid!');
return false;
}
if ($_SESSION['serendipityAuthedUser'] === true) {
$admin = '';
if (!serendipity_checkPermission('adminEntriesMaintainOthers')) {
$admin = " AND authorid = " . (int)$_SESSION['serendipityAuthorid'];
}
/* We have to figure out if the comment we are about to delete, is awaiting approval,
if so - we should *not* subtract it from the entries table */
$q1 = "SELECT type, status, parent_id, body FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = ". $entry_id ."
AND id = ". $id;
$sql = serendipity_db_query($q1, true);
/* Check to see if the comment has children
* if it does, don't delete, but replace with "*(COMMENT DELETED)*"
to delete a tree, delete children first */
$has_parent = serendipity_db_query("SELECT count(id) AS count
FROM {$serendipity['dbPrefix']}comments
WHERE parent_id = ". $id . "
LIMIT 1", true);
if (is_array($has_parent) && isset($has_parent['count']) && $has_parent['count'] > 0 && $sql['body'] != 'COMMENT_DELETED') {
// Comment has childs, so don't delete it.
$q2 = "UPDATE {$serendipity['dbPrefix']}comments
SET body = 'COMMENT_DELETED'
WHERE id = " . $id;
serendipity_db_query($q2);
$q3 = $q4 = "EMPTY-A!";
} else {
// Comment has no childs or had already been deleted., it can be safely removed.
$q2 = "DELETE FROM {$serendipity['dbPrefix']}comments
WHERE entry_id = ". $entry_id ."
AND id = ". $id;
serendipity_db_query($q2);
if (is_array($sql) && $sql['status'] !== 'pending') {
if (!empty($sql['type']) && $sql['type'] != 'NORMAL') {
$type = 'trackbacks';
} else {
$type = 'comments';
}
$q3 = "UPDATE {$serendipity['dbPrefix']}entries SET $type = $type-1 WHERE id = ". $entry_id ." AND $type > 0 $admin";
serendipity_db_query($q3);
} else {
$q3 = "EMPTY-B!";
}
$q4 = "UPDATE {$serendipity['dbPrefix']}comments SET parent_id = " . (int)$sql['parent_id'] . " WHERE parent_id = " . $id;
serendipity_db_query($q4);
}
$addData = array('cid' => $id, 'entry_id' => $entry_id);
serendipity_plugin_api::hook_event('backend_deletecomment', $sql, $addData);
die($q1 . "\n" . $q2 . "\n" . $q3 . "\n" . $q4);
return true;
} else {
die('Not authorized!');
return false;
}
}
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
output when deleting a comment that was initially made on the s9y site with phpbb3 plugin active:
I did not realise the interaction was 2 ways, postings added on the forum also show on the s9y site
very cool !
There is a little bug in the number of reactions counted beneath the article on the frontpage of s9y though. The forum added comments are not counted.
Code: Select all
SELECT type, status, parent_id, body FROM comments WHERE entry_id = 15 AND id = 28 DELETE FROM comments WHERE entry_id = 15 AND id = 28 EMPTY-B! UPDATE comments SET parent_id = 0 WHERE parent_id = 28
There is a little bug in the number of reactions counted beneath the article on the frontpage of s9y though. The forum added comments are not counted.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
Hm, according to that Debout output, the comment #28 should actually be deleted from your serendipity-comment database?
I think the reason it might still show up is because the comment still exists on the phpbb side, can that be?
Regards,
Garvin
Hm, according to that Debout output, the comment #28 should actually be deleted from your serendipity-comment database?
I think the reason it might still show up is because the comment still exists on the phpbb side, can that be?
Yeah, that's sadly not changeable. s9y does not count this dynamically, it uses the serendipity_entries.comments counter for that. This could only be corrected, if the phpbb forum would also update the s9y table, which I doubt can happen...There is a little bug in the number of reactions counted beneath the article on the frontpage of s9y though. The forum added comments are not counted.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
YESgarvinhicking wrote:Hi!
Hm, according to that Debout output, the comment #28 should actually be deleted from your serendipity-comment database?
I think the reason it might still show up is because the comment still exists on the phpbb side, can that be?
addition:
The comments added via phpBB to the s9y comment view all have ánonymous' as author.
Is this normal ? Extrapolating on your earlier reply on author names should this not be the member name from the phpbb forum ?
Hmm, there no triggers in mysql possible, so that might be difficult. Only option would be to make it dynamic/ realtime so that its checked everytime the phpbb comments are retrieved anyway. (I pesume that the comment display function just retieves the s9y comments and the phpbb comments and puts them in order befor print)[/b]Yeah, that's sadly not changeable. s9y does not count this dynamically, it uses the serendipity_entries.comments counter for that. This could only be corrected, if the phpbb forum would also update the s9y table, which I doubt can happen...
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
>seperate double reaction to keep the overview.
Hi Garvin,
The 0,28 update contains 2 problems.
1) The phpbb2 or 3 detection does not work properly. Workarround hack by hard coding $phpbb_mirror = 3; in the plugin on line 2326.
2) The s9y comments are inserted into the phpbb3 forum DB but are not visible. The poster_id in the db is set to 0, and this makes phpbb3 not show the post. Changing it to another (existing id) makes it show. This is why I created the 53 user id. (line 2655, -1 to 53)
Hi Garvin,
The 0,28 update contains 2 problems.
1) The phpbb2 or 3 detection does not work properly. Workarround hack by hard coding $phpbb_mirror = 3; in the plugin on line 2326.
2) The s9y comments are inserted into the phpbb3 forum DB but are not visible. The poster_id in the db is set to 0, and this makes phpbb3 not show the post. Changing it to another (existing id) makes it show. This is why I created the 53 user id. (line 2655, -1 to 53)
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
looks good to me - can you try if it works by using "==" instead of "==="?
You can try this by posting to your board with an anonymous user (who has entered his username on posting) and see what his userid is set to. This should be possible, phpbb2 at least never required users to register before they can post.
Regards,
Garvin
Hm, I wonder why?1) The phpbb2 or 3 detection does not work properly. Workarround hack by hard coding $phpbb_mirror = 3; in the plugin on line 2326.
Code: Select all
if ((int)$phpbb_mirror === 3) {
$phpbb_mirror = 3;
} elseif ((int)$phpbb_mirror === 2) {
$phpbb_mirror = 2;
} elseif (serendipity_db_bool($phpbb_mirror)) {
$phpbb_mirror = 2;
} else {
$phpbb_mirror = false;
}
Can you please try what phpbb3 requires so that a non-registered user can post?2) The s9y comments are inserted into the phpbb3 forum DB but are not visible. The poster_id in the db is set to 0, and this makes phpbb3 not show the post. Changing it to another (existing id) makes it show. This is why I created the 53 user id. (line 2655, -1 to 53)
You can try this by posting to your board with an anonymous user (who has entered his username on posting) and see what his userid is set to. This should be possible, phpbb2 at least never required users to register before they can post.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
ReLight
- Regular
- Posts: 22
- Joined: Tue Jan 01, 2008 5:40 pm
- Location: Rotterdam, netherlands
- Contact:
Anonymous posting from the webinterface without registration is disabled at my phpbb forum. (who ever has that still turned on?), that might be it.garvinhicking wrote:Hi!
Hm, I wonder why?1) The phpbb2 or 3 detection does not work properly. Workarround hack by hard coding $phpbb_mirror = 3; in the plugin on line 2326.
looks good to me - can you try if it works by using "==" instead of "==="?Code: Select all
if ((int)$phpbb_mirror === 3) { $phpbb_mirror = 3; } elseif ((int)$phpbb_mirror === 2) { $phpbb_mirror = 2; } elseif (serendipity_db_bool($phpbb_mirror)) { $phpbb_mirror = 2; } else { $phpbb_mirror = false; }
> Tried, no good.
in s9y i see: "Table 'mwnj36ste_phpbb.phpbb_posts_text' doesn't exist ", so its defaulting to phpbb2.
Can you please try what phpbb3 requires so that a non-registered user can post?2) The s9y comments are inserted into the phpbb3 forum DB but are not visible. The poster_id in the db is set to 0, and this makes phpbb3 not show the post. Changing it to another (existing id) makes it show. This is why I created the 53 user id. (line 2655, -1 to 53)
You can try this by posting to your board with an anonymous user (who has entered his username on posting) and see what his userid is set to. This should be possible, phpbb2 at least never required users to register before they can post.
but as these are direct db inserts thats not prevented. I guess there is a double post-rights lookup making sure non registered users can not show posts even if they hack direct into the db.
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi!
And see with which message it dies?
Regards,
Garvin
Hm, can you modify it to:> Tried, no good.
Code: Select all
if ((int)$phpbb_mirror === 3) {
$phpbb_mirror = 3;
die('3!');
} elseif ((int)$phpbb_mirror === 2) {
$phpbb_mirror = 2;
die('2a!');
} elseif (serendipity_db_bool($phpbb_mirror)) {
$phpbb_mirror = 2;
die('2b!');
} else {
$phpbb_mirror = false;
die('0!');
}
Would be nice if you could test it. It's really required to not use a fixed username.Anonymous posting from the webinterface without registration is disabled at my phpbb forum. (who ever has that still turned on?), that might be it.
That would be a new feature of phpb3 then, which I don't think is really useful in our usage scenario. There must be a way to circumvent that, or else you would never know who commented what on your phpbb forum!but as these are direct db inserts thats not prevented. I guess there is a double post-rights lookup making sure non registered users can not show posts even if they hack direct into the db.
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/