1
toddherrold
$$ Job for Xoops Pro Bug Fixer - # of Posts/Member Rank Dbase Random Dumping/Reset

I couldn't find a job board section in these forums, so I thought I would post this here. I own, www.hotdogblog.com, and have been experiencing an annoying issue where the member posts # database resets seemingly randomly. It has been happening for about a year and I have not been able to isolate the problem. Sometimes when the # of Posts database gets dumped, it affects everyone. Sometimes it's only a subset of users whose rank goes down to -1. This has implications for the site, because some of the features do not know how to deal with # of posts = a negative number. For instance, when this happens, the member with -1 posts will begin to have the default avatar show up in addition to any custom avatar they may have selected. They also sometimes get "you are not authorized" messages but I can't remember on what features.

I don't know if this bug was introduced as part of a module that I added to the site or as part of a 2.2.x upgrade. Either way, I've only seen a few people mention it here and never has anyone ever responded to the issue.

So, I'm am so freaking tired of dealing with all my members complaining about getting their rank bumped down, that I want to PAY SOMEONE TO DIAGNOSE AND FIX this error.

If you think you are up to it and want the challenge, PM me.

Thanks!

2
jdseymour
Re: $$ Job for Xoops Pro Bug Fixer - # of Posts/Member Rank Dbase Random Dumping/Reset

Need a little more information. If your around shortly come to my site www.warpigw2.com and click on my "Live Help" block and we can discuss some of your problems.

3
toddherrold
Re: $$ Job for Xoops Pro Bug Fixer - # of Posts/Member Rank Dbase Random Dumping/Reset

thanks. sorry i missed you. will get in touch.

4
toddherrold
Re: $$ Job for Xoops Pro Bug Fixer - # of Posts/Member Rank Dbase Random Dumping/Reset

Someone found the solution to the user rank reset issue and I thought I would post it here in case someone finds this post.

Add the following as sync.php to your modules/profile/admin folder. . log in, access this page, press the button. User ranks re-established!

Thanks Onokazu!

Quote:
<?php
// $Id: sync.php,v 1.1 2005/012/1 10:30:33 irmtfan Exp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <https://xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu) //
// URL:http://www.myweb.ne.jp/,https://xoops.org/,http://www.xoopscube.jp/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
/*********************************************************/
/* Users Synchronize Function */
/*********************************************************/
include '../../../include/cp_header.php';
include_once XOOPS_ROOT_PATH."/class/xoopsformloader.php";
xoops_cp_header();
$form = new XoopsThemeForm(_PROFILE_AM_SYNCHRONIZE, 'form', 'sync.php');
$form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
$form->display();
// Synchronize all users after click on submit button
if (isset($_POST['submit'])){
$sql = "SELECT uid FROM ".$xoopsDB->prefix("users")."";
if ( !$result = $xoopsDB->query($sql) ) {
exit(_PROFILE_AM_CNGUSERID);
}
while ($row = $xoopsDB->fetchArray($result)) {
$id = $row['uid'];
synchronize($id, "user");
}
redirect_header('user.php', 2, sprintf(_PROFILE_AM_SAVEDSUCCESS, _PROFILE_AM_UPDATEUSER));
exit();
}
// synchronize function modified from XOOPS 2.0
function synchronize($id,$type)
{
global $xoopsDB;
switch($type) {
case 'user':
// Array of tables from which to count 'posts'
$tables = array();
// Count comments (approved only: com_status == XOOPS_COMMENT_ACTIVE)
include_once XOOPS_ROOT_PATH . '/include/comment_constants.php';
$tables[] = array ('table_name' => 'xoopscomments', 'uid_column' => 'com_uid', 'criteria' => new Criteria('com_status', XOOPS_COMMENT_ACTIVE));
// Count forum posts
$tables[] = array ('table_name' => 'bb_posts', 'uid_column' => 'uid');
$total_posts = 0;
foreach ($tables as $table) {
$criteria = new CriteriaCompo();
$criteria->add (new Criteria($table['uid_column'], $id));
if (!empty($table['criteria'])) {
$criteria->add ($table['criteria']);
}
$sql = "SELECT COUNT(*) AS total FROM ".$xoopsDB->prefix($table['table_name']) . ' ' . $criteria->renderWhere();
if ( $result = $xoopsDB->query($sql) ) {
if ($row = $xoopsDB->fetchArray($result)) {
$total_posts = $total_posts + $row['total'];
}
}
}
$sql = "UPDATE ".$xoopsDB->prefix("user_profile")." SET posts = $total_posts WHERE profileid = $id";
if ( !$result = $xoopsDB->query($sql) ) {
exit(sprintf(_PROFILE_AM_CNUUSER %s ,$id));
}
break;
case 'all users':
$sql = "SELECT uid FROM ".$xoopsDB->prefix("users")."";
if ( !$result = $xoopsDB->query($sql) ) {
exit(_PROFILE_AM_CNGUSERID);
}
while ($row = $xoopsDB->fetchArray($result)) {
$id = $row['uid'];
synchronize($id, "user");
echo $id;
}
break;
default:
break;
}
}
xoops_cp_footer();
?>

Login

Who's Online

191 user(s) are online (120 user(s) are browsing Support Forums)


Members: 0


Guests: 191


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits