
<?php
global $bp_members, $members_template;
if( ! $bp_members ) $bp_members = bp_has_members( bp_ajax_querystring( 'members' ) );
?>

<?php do_action( 'bp_before_members_loop' ); ?>

<?php if ( $bp_members ) : ?>

	<div id="pag-top" class="pagination">

		<div class="pag-count" id="member-dir-count-top">

			<?php bp_members_pagination_count(); ?>

		</div>

		<div class="pagination-links" id="member-dir-pag-top">

			<?php bp_members_pagination_links(); ?>

		</div>

	</div>

	<?php do_action( 'bp_before_directory_members_list' ); ?>

	<ul id="members-list" class="item-list" role="main">

	<?php $i_row = 0; $i = 0; $i_column = 0; while ( bp_members() ) : bp_the_member(); ?>
		<?php
		if( $i++ % 2 == 0 ) $i_row++;
		$i_column++;
		if( $i_column > 2 ) $i_column = 1;
		?>

		<li rel="row<?php echo $i_row ?>" class="column<?php echo $i_column ?> row<?php echo $i_row ?> row-<?php echo $i_row % 2 == 0 ? 'even' : 'odd' ?>">
			<div class="item-avatar">
				<a href="<?php bp_member_permalink(); ?>"><?php bp_member_avatar( 'width=35&height=35' ); ?></a>
			</div>

			<div class="item">
				<div class="item-title">
					<a href="<?php bp_member_permalink(); ?>"><?php bp_member_name(); ?></a>
				</div>

				<div class="item-meta"><span class="nickname"><?php bp_member_last_active(); ?></span></div>

				<?php do_action( 'bp_directory_members_item' ); ?>

			</div>

			<div class="action">

				<?php do_action( 'bp_directory_members_actions' ); ?>

			</div>

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

	<?php endwhile; ?>

	</ul>

	<?php do_action( 'bp_after_directory_members_list' ); ?>

	<?php bp_member_hidden_fields(); ?>

	<div id="pag-bottom" class="pagination">

		<div class="pag-count" id="member-dir-count-bottom">

			<?php bp_members_pagination_count(); ?>

		</div>

		<div class="pagination-links" id="member-dir-pag-bottom">

			<?php bp_members_pagination_links(); ?>

		</div>

	</div>

<?php else: ?>

	<div id="message" class="info">
		<p><?php _e( "عفوا .. لا يوجد اعضاء ..", 'MCL' ); ?></p>
	</div>

<?php endif; ?>

<?php do_action( 'bp_after_members_loop' ); ?>
