compter_contributions_auteur

This pipeline is used to insert content onto the author list page showing the volume of each author’s contributions.

It is called as shown below from ecrire/inc/formater_auteur.php:

$contributions = pipeline('compter_contributions_auteur', array(
    'args' => array('id_auteur' => $id_auteur, 'row' => $row),
    'data' => $contributions));

Example

The "Forum" plugin adds the number of messages written by an author:

function forum_compter_contributions_auteur($flux){
    $id_auteur = intval($flux['args']['id_auteur']);
    if ($cpt = sql_countsel("spip_forum AS F", "F.id_auteur=".intval($flux['args']['id_auteur']))){
        // manque "1 message de forum"
        $contributions = ($cpt>1) ? $cpt . '  '. _T('public:messages_forum') : '1 ' . _T('public:message');
        $flux['data'] .= ($flux['data']?", ":"") . $contributions;
    }
    return $flux;
}

Author Mark Baber Published : Updated : 12/05/17

Translations : English, français