PEAK XOOPS - Comment count lost after upgrade from MyAlbum 1.1.3 in englishin japanese

Comment count lost after upgrade from MyAlbum 1.1.3

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 | Posted on 2004/6/23 17:05
kaper  办霹始   Posts: 17
I lost comment count after upgrading to 1.75 from MyAlbum 1.1.3. Comments are displayed properly, but displayed number of comments is 0.

Kaper
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2004/6/25 18:37
GIJOE  黎扦烦菱   Posts: 4110
hmmm.
Since it's a very old issue for me, I've already forgot compatiblities about daniel's myalbum.

But you can repair comment count easily.

Put this script named 'comment_repair.php' in your XOOPS_ROOT_PATH.
Access "XOOPS_URL/comment_repair.php".
That's all.

<?php
include 'mainfile.php';

echo '<html><head><title></title></head><body>';

if (isset($HTTP_POST_VARS['submit'])) {

	$module_handler =& xoops_gethandler("module");
	$module =& $module_handler->getByDirname("myalbum");
	$mid = $module->getVar('mid') ;

	$result = $xoopsDB->query( "SELECT lid FROM ".$xoopsDB->prefix("myalbum_photos") ) ;
	while( list( $lid ) = $xoopsDB->fetchRow( $result ) ) {
		$comments = xoops_comment_count( $mid , $lid ) ;
		echo "$lid: $comments <br />\n" ;
		if( $comments > 0 ) {
			$xoopsDB->query( "UPDATE ".$xoopsDB->prefix("myalbum_photos")." SET comments='$comments' WHERE lid='$lid'" ) ;
		}
	}

} else {
	echo '
<form action="" method="post">
<input type="submit" name="submit" value="Repair it" />
</form>';
}

echo '</body></html>';
?>
Votes:1 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2004/6/25 21:55
kaper  办霹始   Posts: 17
So easy... thanks

Why don't you add this tool to the package and mention it in INSTALL?

And I'd add some description to the displayed page - a message like "MyAlbum-P Comment Count Update Tool" and button description like "Update CommentCount".

Kaper
Votes:0 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!