I thought I'd share this since IP.Downloads is going to be used. I figure if a user uploads a file they get the contributor badge in the member's Topic View (under their post count). I would assume that someone could make a new contributor badge.
//==============================================
IP.Board Topic: http://community.inv...tributor-badge/
By Charles, IPS Staff
//==============================================
I thought I would preempt anyone asking and just explain how we did the new contributor badge that is showing on the topic view and member profiles. This badge only shows if someone has contributed a file for download in our community resources section. We could have done this (probably better) with a hook but we chose to do it with skin edits. Here is how we did it:
Created a new custom profile field in the AdminCP called Resource Contributors. We then populated that field with the text: Total file submissions: # (where # is the number of files). To do this we created a PHP page in IP.Content which we will execute once a day to refresh the content of that field. On our IP.Board install, the field is number 18:
$this->DB->update( 'pfields_content', array( 'field_18' => null ) );
$this->DB->build( array( 'select' => 'file_submitter,COUNT(*) as submissions', 'from' => 'downloads_files', 'where' => 'file_open=1', 'group' => 'file_submitter' ) );
$outer = $this->DB->execute();
while( $r = $this->DB->fetch($outer) )
{
$this->DB->update( 'pfields_content', array( 'field_18' => 'Total file submissions: ' . $r['submissions'] ), 'member_id=' . $r['file_submitter'] );
}
The script is very short because one of the huge advantages of IP.Content is that it inherits the complete power and framework of IP.Board itself so that's all there is to it.
Edited the custom profile field's Topic View Format setting with the following text:
<span style='display: inline-block; margin-left: 65px; margin-top: 8px'>
<a href='http://community.invisionpower.com/index.php?app=core&module=search&do=user_posts&mid=#member_id#&view_by_title=&search_filter_app[downloads]=1'>
<img src="http://community.invisionpower.com/contributor.png" title="This member is a contributor to community resources. {content}" />
</a></span>
To replace the #member_id# variable in the above code, we edited the skin template Global Templates - userInfoPane and replaced the {$field} call in that skin with:
{parse expression="str_replace("#member_id#", $author['member_id'], $field)"}