• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Online widget max show option

dethfire

Baby Penguin
XenWord Professional
I think there should be a max shown option. Busy forums will end up showing too many users. Also would be cool to only show those members who have a custom avatar. Seeing a dozen or so default avatars isn't pretty.
 

LPH

Flight Director
Flight Instructor
Never worked with next() in PHP but it returns the comma really well.

PHP:
        foreach ( $onlineUser AS $online ) {

            $user_id = $online['user_id'];

            $url = esc_url( XenWord::getBoardUrl() . '/' . XenForo_Link::buildPublicLink( 'members', $online ) );

            /**
            * Loads the XenWord options saved in the XenWord panel.
            * @var  $xenword_options
            */
            $xenword_options = get_option( 'xenword_options' );

            if ( $xenword_options['use_online_members_avatars'] == true ) {

                echo '<div class="onlineUsers_avatar"><a href="' . $url
                    . '" title="' . $online['username'] . '">'
                    . get_avatar( $user_id, 32 ) . '</a></div>';
            } else {

                echo '<div class="onlineUsers_username"><a href="' . $url
                    . '" title="' . $online['username'] . '">'
                    . $online['username'] . '</a>';

                if ( next( $onlineUser )) {
                    echo ',';
                }

                echo '</div>';

            }

Screen Shot 2016-04-01 at 12.46.04 AM.png


Next, I'll work on the widget option to limit the number by wrapping a counter around things. What sizes should be available?
 
Top