1
tamerlo
howto synchronize all users
  • 2008/4/17 9:09

  • tamerlo

  • Just popping in

  • Posts: 71

  • Since: 2004/1/30


Hi, after a problem in my MySQL db I recovered successfully the forum posts. The only issue is the number of posts assigned to each user, this number appears to be reseted.

Looking into the modules/admin/users directory I found that in the file users.php the method synchronize(%id,$type) could synchronize again all users but I don't find any link in the admin section to call this function, also I'm not able to call it in any way

I tried forming the link:

mysite/modules/system/admin.php?fct=users&op=synchronize&type=all+users

but this doesn't work.

Any of you knows how to use this "hidden" feature?

I'm also trying to figure out why the number of posts was reseted when the db lost the entries, but this doesn't happen when the db was repopulated.

2
tamerlo
Re: howto synchronize all users
  • 2008/4/17 16:52

  • tamerlo

  • Just popping in

  • Posts: 71

  • Since: 2004/1/30


I solved using sql command without go through php script.

3
noo-b
Re: howto synchronize all users
  • 2008/4/17 17:00

  • noo-b

  • Just can't stay away

  • Posts: 456

  • Since: 2007/10/23


can you share the command? thismight be useful to other user in the future
I Love Xoops

4
tamerlo
Re: howto synchronize all users
  • 2008/4/17 19:41

  • tamerlo

  • Just popping in

  • Posts: 71

  • Since: 2004/1/30


of course

the following code use to temporary table, instead of use sub-quaries, because my host supports am old MySQL version.

create table temp (uid intuname varchar(20), nposts int);
create table temp2 (uid intuname varchar(20), nposts int);

insert into temp
(select xoops_users.uid as uidxoops_users.unamecount(xoops_users.uid) as total from xoops_usersxoops_bb_posts where xoops_bb_posts.uid xoops_users.uid group by xoops_users.uid)
union (select xoops_users.uid as uidxoops_users.unamecount(xoops_users.uid) as total from xoops_usersxoops_xoopscomments where xoops_users.uid xoops_xoopscomments.com_uid group by xoops_users.uid)
union (select xoops_users.uid as uidxoops_users.unamecount(xoops_users.uid) as total from xoops_usersxoops_xcgal_pictures where xoops_users.uid xoops_xcgal_pictures.owner_id group by xoops_users.uid)
order by uid;

insert into temp2 select uidunamesum(*) from temp group by uid;

update temp2xoops_users set xoops_users.posts temp2.nposts where xoops_users.uid temp2.uid;

DROP TABLE `temp`, `temp2`;


with respect to the php function I also added into the count the xcgal posted pictures.

Login

Who's Online

150 user(s) are online (99 user(s) are browsing Support Forums)


Members: 0


Guests: 150


more...

Donat-O-Meter

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

Latest GitHub Commits