Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/01/2012 10:08:50 PM (10 years ago)
Author:
johnjamesjacoby
Message:

Add template tags and supporting functions to display user role in topics and replies. Fixes #1815. Props cnorris23 for original patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-core-caps.php

    r3758 r3860  
    556556 * sites that have global forums enabled want to create topics and replies
    557557 *
     558 * @since bbPress (r3860)
     559 *
     560 * @uses apply_filters() Allow override of hardcoded anonymous role
     561 * @return string
     562 */
     563function bbp_get_anonymous_role() {
     564    return apply_filters( 'bbp_get_anonymous_role', 'bbp_anonymous' );
     565}
     566
     567/**
     568 * The participant role for registered users without roles
     569 *
     570 * This is primarily for multisite compatibility when users without roles on
     571 * sites that have global forums enabled want to create topics and replies
     572 *
    558573 * @since bbPress (r3410)
    559574 *
     575 * @uses apply_filters() Allow override of hardcoded participant role
     576 * @return string
     577 */
     578function bbp_get_participant_role() {
     579    return apply_filters( 'bbp_get_participant_role', 'bbp_participant' );
     580}
     581
     582/**
     583 * The moderator role for bbPress users
     584 *
     585 * @since bbPress (r3410)
     586 *
    560587 * @param string $role
    561  * @uses apply_filters()
     588 * @uses apply_filters() Allow override of hardcoded moderator role
    562589 * @return string
    563590 */
    564 function bbp_get_participant_role() {
    565 
    566     // Hardcoded participant role
    567     $role = 'bbp_participant';
    568 
    569     // Allow override
    570     return apply_filters( 'bbp_get_participant_role', $role );
    571 }
    572 
    573 /**
    574  * The moderator role for bbPress users
    575  *
    576  * @since bbPress (r3410)
    577  *
    578  * @param string $role
    579  * @uses apply_filters()
    580  * @return string
    581  */
    582591function bbp_get_moderator_role() {
    583 
    584     // Hardcoded moderated user role
    585     $role = 'bbp_moderator';
    586 
    587     // Allow override
    588     return apply_filters( 'bbp_get_moderator_role', $role );
     592    return apply_filters( 'bbp_get_moderator_role', 'bbp_moderator' );
    589593}
    590594
Note: See TracChangeset for help on using the changeset viewer.