بنیان گذار IPSFarsi وحید نامنی 12154 ارسال شده در 19 اسفند، ۱۳۹۳ بنیان گذار IPSFarsi اشتراک گذاری ارسال شده در 19 اسفند، ۱۳۹۳ در این آموزش شما یاد می گیرید چگونه کاربران فعال در انجمن را که در صفحه اول انجمن ها در پایین نمایش داده می شود در کنار انجمن ها نیز نمایش دهید. برای انجام این آموزش شما نیاز دارید مد Custom Sidebar Blocks را دریافت نمایید. علاوه بر این نیاز به نصب هوک Custom Sidebar Block Active Users Templates نیز دارید که در هنگام دانلود مد Custom Sidebar Blocks می توانید آن را نیز دریافت نمایید. نتیجه نهایی : ابتدا یک بلوک جدید در این برنامه ایجاد نمایید و مطابق توضیحات زیر آن را تنظیم نمایید : Enabled : YesHide From Main Custom Block: Depends on where you want itFull Image Name: user.png (or whatever you wish as long as it is in the proper directory and your reference it)Enable RAW HTML/JS mode: NoEnable PHP Mode: YesUse Table/Border/Title/Image?: Yes سپس کد های PHP زیر را در آن قرار دهید : $active = array( 'TOTAL' => 0 , 'NAMES' => array(), 'GUESTS' => 0 , 'MEMBERS' => 0 , 'ANON' => 0 , ); if ( $this->settings['show_active'] ) { if( !$this->settings['au_cutoff'] ) { $this->settings['au_cutoff'] = 15; } //----------------------------------------- // Get the users from the DB //----------------------------------------- $cut_off = $this->settings['au_cutoff'] * 60; $time = time() - $cut_off; $rows = array(); $ar_time = time(); if ( $this->memberData['member_id'] ) { $rows = array( $ar_time.'.'.md5( microtime() ) => array( 'id' => 0, 'login_type' => substr( $this->memberData['login_anonymous'], 0, 1), 'running_time' => $ar_time, 'seo_name' => $this->memberData['members_seo_name'], 'member_id' => $this->memberData['member_id'], 'member_name' => $this->memberData['members_display_name'], 'member_group' => $this->memberData['member_group_id'], 'cns_prefix' => (ipsRegistry::$settings['cns_on']) ? $this->memberData['cns_prefix'] : "", 'cns_suffix' => (ipsRegistry::$settings['cns_on']) ? $this->memberData['cns_suffix'] : "" ) ); } if (ipsRegistry::$settings['cns_on']) { $customNameStyleJoin = array( 0 => array( 'select' => 'pp.cns_prefix, pp.cns_suffix', 'from' => array( 'profile_portal' => 'pp' ), 'where' => "s.member_id = pp.pp_member_id", 'type' => 'left', ) ); } $this->DB->build( array( 'select' => 's.id, s.member_id, s.member_name, s.seo_name, s.login_type, s.running_time, s.member_group, s.uagent_type', 'from' => array( 'sessions' => 's' ), 'where' => "running_time > {$time}", 'add_join' => $customNameStyleJoin ) ); $this->DB->execute(); //----------------------------------------- // FETCH... //----------------------------------------- while ( $r = $this->DB->fetch() ) { $rows[ $r['running_time'].'.'.$r['id'] ] = $r; } krsort( $rows ); //----------------------------------------- // cache all printed members so we // don't double print them //----------------------------------------- $cached = array(); foreach ( $rows as $result ) { $last_date = $this->registry->getClass('class_localization')->getDate( $result['running_time'], 'TINY' ); //----------------------------------------- // Bot? //----------------------------------------- if ( isset( $result['uagent_type'] ) && $result['uagent_type'] == 'search' ) { /* Skipping bot? */ if ( ! $this->settings['spider_active'] ) { continue; } //----------------------------------------- // Seen bot of this type yet? //----------------------------------------- if ( ! $cached[ $result['member_name'] ] ) { $active['NAMES'][] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'], $result['cns_prefix'], $result['cns_suffix'] ); $cached[ $result['member_name'] ] = 1; } else { //----------------------------------------- // Yup, count others as guest //----------------------------------------- $active['GUESTS']++; } } //----------------------------------------- // Guest? //----------------------------------------- else if ( ! $result['member_id'] OR ! $result['member_name'] ) { $active['GUESTS']++; } //----------------------------------------- // Member? //----------------------------------------- else { if ( empty( $cached[ $result['member_id'] ] ) ) { $cached[ $result['member_id'] ] = 1; $result['member_name'] = IPSMember::makeNameFormatted( $result['member_name'], $result['member_group'], $result['cns_prefix'], $result['cns_suffix'] ); if ( $result['login_type'] ) { if ( $this->memberData['g_access_cp'] ) { $active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) . "' title='$last_date'>{$result['member_name']}</a>*"; $active['ANON']++; } else { $active['ANON']++; } } else { $active['MEMBERS']++; $active['NAMES'][] = "<a href='" . $this->registry->getClass('output')->buildSEOUrl( "showuser={$result['member_id']}", 'public', $result['seo_name'], 'showuser' ) ."' title='$last_date'>{$result['member_name']}</a>"; } } } } $active['TOTAL'] = $active['MEMBERS'] + $active['GUESTS'] + $active['ANON']; $this->users_online = $active['TOTAL']; } $this->lang->words['active_users'] = sprintf( $this->lang->words['active_users'], $this->settings['au_cutoff'] ); return $this->registry->output->getTemplate('boards')->customSidebarBlockActiveUsers($active); لینک ارسال به اشتراک گذاری در سایت های دیگر تنظیمات بیشتر اشتراک گذاری ...
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.