<div class="sidebar-conatnier">
   <div class="col-md-4">
      <div class="home profile-style main">
         <div class="card hovercard">
            <div class="cardheader">
               <img src="<?php echo $wo['user']['cover']?>" id="cover-image" alt="<?php echo $wo['user']['name']?> Cover Image">
            </div>
            <div class="text-shadow"></div>
            <div class="avatar <?php echo Wo_RightToLeft('pull-left');?>">
               <img id="updateImage-<?php echo $wo['user']['user_id']?>" alt="<?php echo $wo['user']['name']?> Profile Picture" src="<?php echo $wo['user']['avatar']?>">
            </div>
            <div class="info">
               <div class="title">
                  <a id="user-full-name" href="<?php echo Wo_SeoLink('index.php?tab1=timeline&u=' . $wo['user']['username'] . '');?>"><?php echo $wo['user']['name']?></a>
                  <?php if($wo['user']['verified'] == 1):?>
                  <i class="fa fa-check-circle verified-color" data-toggle="tooltip" title="<?php echo $wo['lang']['verified_user'];?>"></i>
                  <?php endif;?>
               </div>
            </div>
         </div>
      </div>
      <?php 
      $users = Wo_UserSug(5);
      if (count($users) != 0) {
      ?>
      <ul class="list-group" id="sidebar-user-list-container">
         <li class="list-group-item text-muted" contenteditable="false">
            <i class="fa fa-users fa-fw"></i> <?php echo $wo['lang']['people_you_may_know'];?> <span onclick="Wo_ReloadSideBarUsers();" class="<?php echo Wo_RightToLeft('pull-right');?>  refresh">
            <i class="fa fa-repeat progress-icon" data-icon="repeat"></i>
            </span>
         </li>
         <div class="sidebar-users-may-know-container">
            <?php 
            foreach ($users as $wo['UsersList']) {
                $wo['UsersList']['user_name'] = substr($wo['UsersList']['name'],0,10);
                echo Wo_LoadPage('sidebar/sidebar-user-list');
            } 
            ?>
         </div>
         <div class="clear"></div>
      </ul>
      <?php
      }
      $pages = Wo_PageSug(1);
      if (count($pages) != 0) {
      ?>
      <ul class="list-group" id="sidebar-page-list-container">
         <li class="list-group-item text-muted" contenteditable="false">
            <i class="fa fa-flag fa-fw"></i> <?php echo $wo['lang']['pages_you_may_like']; ?>
            <span onclick="Wo_ReloadSideBarPages();" class="<?php echo Wo_RightToLeft('pull-right');?> refresh">
            <i class="fa fa-chevron-circle-right progress-icon" data-icon="chevron-circle-right"></i>
            </span>
         </li>
         <div class="sidebar-pages-may-know-container">
            <?php 
            foreach ($pages as $wo['PageList']) {
                $wo['PageList']['user_name'] = $wo['PageList']['name'];
                echo Wo_LoadPage('sidebar/sidebar-home-page-list');
            } 
            ?>
         </div>
         <div class="clear"></div>
      </ul>
      <?php } ?>
      <ul class="list-group trending" >
         <li class="list-group-item" contenteditable="false"><i class="fa fa-bolt fa-fw"></i> <?php echo $wo['lang']['trending']; ?></li>
         <?php 
          $hashtags = Wa_GetTrendingHashs('popular');
          if (count($hashtags) > 0) {
             foreach ($hashtags as $wo['hashtag']) { 
          ?>
               <li class="list-group-item" dir="auto">
                  <a href="<?php echo $wo['hashtag']['url'];?>">#<?php echo $wo['hashtag']['tag'];?></a>
               </li>
         <?php
              } 
          }
          ?>
         <div class="clear"></div>
      </ul>
      <?php 
      $sidebar_ad = Wo_GetAd('sidebar', false);
      if (!empty($sidebar_ad)) {?>
      <ul class="list-group sidebar-ad">
         <?php echo $sidebar_ad; ?>
      </ul>
      <?php } ?>
      <div id="sidebar-sticky">
         <?php $activities = Wo_GetActivities();?>
         <ul class="list-group activity-container">
            <li class="list-group-item text-muted" contenteditable="false"><i class="fa fa-bars fa-fw"></i> <?php echo $wo['lang']['latest_activities']; ?>
               <?php if (count($activities) > 0) { ?> <span onclick="Wo_GetMoreActivities();" data-toggle="tooltip" title= "<?php echo $wo['lang']['load_more_activities'];?>" class="<?php echo Wo_RightToLeft('pull-right');?>  refresh" >
               <i class="fa fa-chevron-circle-down progress-icon" data-icon="chevron-circle-down"></i></a>
               </span><?php } ?>
            </li>
            <li class="activities-wrapper">
               <?php
               if (count($activities) == 0) {
                   echo '<h2><div class="no-activities text-center">' . $wo['lang']['no_activities'] . '</div><h2>';
               } else {
                   foreach ($activities as $wo['activity']) {
                       echo Wo_LoadPage('sidebar/activities-list');
                   }
               }
               ?>
            </li>
            <li>
               <div class="no-activities center-text"></div>
            </li>
         </ul>
      </div>
   </div>
</div>
<script>
$(function () {
  setInterval(function () { Wo_GetNewActivities(); }, 40000);
});

function Wo_GetNewActivities() {
  var before_activity_id = $('.activities-wrapper > .activity').attr('data-activity-id');
  if (typeof before_activity_id === 'undefined') {
       return false;
  }
  $.post(Wo_Ajax_Requests_File() + '?f=activities&s=get_new_activities', {
    before_activity_id: before_activity_id
  }, function (data) {
    if(data.status == 200) {
      $('.activities-wrapper').prepend(data.html);
    }
  });
}

function Wo_GetMoreActivities() {
  var activity_container = $('.activity-container');
  var after_activity_id = $('.activities-wrapper .activity:last').attr('data-activity-id');
  Wo_progressIconLoader(activity_container);
  $.post(Wo_Ajax_Requests_File() + '?f=activities&s=get_more_activities', {
    after_activity_id: after_activity_id
  }, function (data) {
    if(data.status == 200) {
      if(data.html.length == 0) {
        $('.no-activities').html(data.message);
      } else {
        $('.activities-wrapper').append(data.html);
      }
      $(".activities-wrapper").animate({
        scrollTop: $('.activities-wrapper')[0].scrollHeight
      }, 100);
      Wo_progressIconLoader(activity_container);
    }
  });
}
</script>