Skip to:
Content
Pages
Categories
Search
Top
Bottom

How the Online block can appear as a a grid


  • ronia
    Participant

    @ronia

    Can some one please guide me on this :

    I want to make the online block appear as a grid of ( 3×3 ) or similar

    Apprently the online block now presents the avtaar of logged in user

    in a list form so that the right side remains a wide vacant.

    A grid pattern block can well use that space and appear nice.

    Is there any admin option hidden anywhere to define this grid?

    Any other way?

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)

  • Jeff Sayre
    Participant

    @jeffsayre

    This is a CSS issue. I have not tried this out, but you can use this as a basic idea. There are different ways to do this. This is just a quick stab at a possible solution for you, to get you down the road. You’ll need to adjust based on your desired cell size and how and where you’re placing this grid in your theme.

    If you are not using FIrefox with FIrebug Add-on, you will want to do so. It will make it a lot easier to tweak your CSS.

    In your site-wide.css:

    div.cells {
    width: 50px;
    float:left;
    padding: 2px;
    }

    In your theme:

    <div class="cells">1st user avatar</div>
    <div class="cells">2nd user avatar</div>
    <div class="cells">3rd user avatar</div>

    <div class="clear"></div>

    <div class="cells">4th user avatar</div>
    <div class="cells">5th user avatar</div>
    <div class="cells">6th user avatar</div>

    <div class="clear"></div>

    <div class="cells">7th user avatar</div>
    <div class="cells">8th user avatar</div>
    <div class="cells">9th user avatar!</div>

    You’ll need to mess around with the padding and figure out how you want to position each avatar within its cell.

    Also, instead of hard coding the grid dimensions within your theme, you could use a looping structure, allowing you more flexibility in setting the grid dimensions. For example, you could easily change the grid from a 3×3 dimension to a 4×8. The next day, switch it to 6×6. You could change the size automatically based on certain parameters.


    ronia
    Participant

    @ronia

    Hi Jeff! Thanks a lot for the detailed examples. I do have Firebug – its a helpful tool

    The problem here is how to tell the code to generate the stuff so that the output is in a grid or table-cell pattern. The rest can be then done with css.

    Usually the admin interface for many cms has option to define the elements in a block on one of the chosen ways : list, grid etc. Here we do not have that. So css only probably can’t help.

    The relevant code is

    <div class="avatar-block">

    <?php foreach ( (array) $users['users'] as $user ) : ?>

    <div class="item-avatar">

    user_id) ?>" title="<?php bp_fetch_user_fullname( $user->user_id, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?>

    </div>

    <?php endforeach; ?>

    Question is how I tweak the code so that the output is in table-row-column or cell form or grid form ?


    ronia
    Participant

    @ronia

    I tried with the following.

    This gives a row but not grid.

    <div class="avatar-block"><table><tr>

    <?php foreach ( (array) $users['users'] as $user ) : ?>

    <td><div class="item-avatar">

    user_id) ?>" title="<?php bp_fetch_user_fullname( $user->user_id, true ) ?>"><?php echo bp_core_get_avatar( $user->user_id, 1 ) ?>

    </div></td>

    <?php endforeach; ?></tr></table>


    5053583
    Inactive

    I’d really like to do this as well. Anyone had luck turning the Who’s Online Avatars into a grid of say 3×3, or even creating slightly smaller icons, a-la ning?

    I’d like to display a 4×3 grid of members on my front page. I found what I believe to be the necessary code here: https://codex.buddypress.org/developer-docs/custom-buddypress-loops/the-members-loop/

    My problem is I don’t know where to put that code. Can anyone help me out?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How the Online block can appear as a a grid’ is closed to new replies.
Skip to toolbar