4
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 int, uname varchar(20), nposts int);
create table temp2 (uid int, uname varchar(20), nposts int);
insert into temp
(select xoops_users.uid as uid, xoops_users.uname, count(xoops_users.uid) as total from xoops_users, xoops_bb_posts where xoops_bb_posts.uid = xoops_users.uid group by xoops_users.uid)
union (select xoops_users.uid as uid, xoops_users.uname, count(xoops_users.uid) as total from xoops_users, xoops_xoopscomments where xoops_users.uid = xoops_xoopscomments.com_uid group by xoops_users.uid)
union (select xoops_users.uid as uid, xoops_users.uname, count(xoops_users.uid) as total from xoops_users, xoops_xcgal_pictures where xoops_users.uid = xoops_xcgal_pictures.owner_id group by xoops_users.uid)
order by uid;
insert into temp2 select uid, uname, sum(*) from temp group by uid;
update temp2, xoops_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.