Loading...
 
Features / Usability

Features / Usability


How to create 'top author' module?

posts: 6

Hi all,

I'm very new to TikiWiki so apologies for newbie questions! I need to create a module that will display a list of the users who have made the most edits to the site recently. It is the same list that you get from the "top_authors" ranking page. Any idea how to get it to work in a module that can then be assigned to the right or left side bar?

Thanks!
ccm

posts: 1092
If you don't customize the score to be based only on page editing, it will be more difficult as tiki doesn't keep (as far as I know) the pages modifications (the history can be erased , the logs can be erased. I began to work on this module

posts: 6

ummm....I'm not sure that I understand what you were getting at. I'll need some pretty basic, step-by-step instructions.....

Thanks anyway though :-)

ccm


posts: 2881 United Kingdom

Hi ccm,

I think sylvie has mis-understood that you want.

The top x authors can be obtained from the tiki-wiki_rankings.php, it is quite an easy task to chop out this ranking list and make it into a module for left and right display.

Basically the php side needs to call the query and pass the returns into a smarty variable. Look at the .php files in /modules/*.php for examples on that side and then you'll need the tpl side to do the actual data display templates/modules/*.tpl

There are loads that could be used as a starting point, top forum posters for example.

Let me know if you have trouble.

Hope sylvie isnt developing something we already have wink

--
Damian
TikiWiki Development/Support/Hosting Services
** Christmas Specials Now Available **

posts: 1092

1) the wiki_ranking_top_authors is buggy.
The request is
select distinct `user`, count(*) as `numb` from `tiki_pages`
In user you have the last wiki pages editor , so the function computes .. hard to explain ... the user that did the most last change on a wiki page - not very useful

For author, you must select the column creator

2) if you understand "author" as "editor" - ccm said "users who have made the most edits" , we don't have the function and the necessary table for that.

Am I right? or I miss something

posts: 6

Hi Damian,

Thanks for the info. I'll give it a shot and see how I go. Not being very familiar with php etc it could be quite an interesting experience. :-)

Thanks,
ccm

posts: 6

Hi Damian,

I haven't had much of a chance to muck around with this but I gather that the php side of things should look something like:

$ranking = $ranklib->wiki_ranking_top_authors($module_rows);

When it comes to assigning this to a smarty variable, can you use any variable name? Would the following work?

$smarty->assign('modTopAuthor',$ranking%22data%22);

If all of the above is OK (which I doubt), how do you get the results to display as a module? I've had a look at a couple of the tpl files but I'm not really sure how to proceed. Any advice would be extremely welcome :-)

Thanks,
ccm