Making WordPress.org

Changeset 7200


Ignore:
Timestamp:
05/13/2018 02:00:02 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Support Forums, User Notes: Introduce .has-user-notes class to allow for custom styling.

See #2272.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-user-notes.php

    r5780 r7200  
    361361
    362362    /**
     363     * Checks whether the user has any notes.
     364     *
     365     * @param int $user_id User ID. Defaults to the current post author.
     366     * @return bool True if the user has notes, false otherwise.
     367     */
     368    public function has_user_notes( $user_id = 0 ) {
     369        return (bool) $this->get_user_notes( $user_id )->count;
     370    }
     371
     372    /**
    363373     * Displays the form for adding a new note or editing an existing note.
    364374     *
     
    457467
    458468        $class = 'wporg-bbp-user-notes';
     469
     470        if ( $this->has_user_notes( $user_id ) ) {
     471            $class .= ' has-user-notes';
     472        }
     473
    459474        if ( ! $show_user_notes ) {
    460475            $class .= ' hidden-notes';
Note: See TracChangeset for help on using the changeset viewer.