Silence Posted November 11, 2016 Share Posted November 11, 2016 Тем за сутки ..... кде мая ошибка ?? {number="$stats['_topics']"} ({$stats['_topics_day']} %) ram108 1 Quote Link to comment Share on other sites More sharing options...
Silence Posted November 12, 2016 Author Share Posted November 12, 2016 Up ... ram108 1 Quote Link to comment Share on other sites More sharing options...
ram108 Posted November 13, 2016 Share Posted November 13, 2016 В 11.11.2016 в 19:34, Silence сказал: Тем за сутки ..... кде мая ошибка ?? {number="$stats['_topics']"} ({$stats['_topics_day']} %) Попробуй так: number="{$stats['_topics']}" ({$stats['_topics_day']} %) Quote Link to comment Share on other sites More sharing options...
Silence Posted November 13, 2016 Author Share Posted November 13, 2016 Не получается .... : с мой код: С ваш код: ram108 1 Quote Link to comment Share on other sites More sharing options...
ram108 Posted November 13, 2016 Share Posted November 13, 2016 Правильный код {$stats['_topics']} ({$stats['_topics_day']} %) Но для того, чтобы эти данные выводились, они должны быть предварительно получены в скрипте. Сейчас, насколько я вижу по скрину, эти данные отсутствуют. Silence 1 Quote Link to comment Share on other sites More sharing options...
Silence Posted November 13, 2016 Author Share Posted November 13, 2016 Спасибо .... да я тоже увидел ето .... : Хук для IPB 3+ <?xml version="1.0" encoding="utf-8"?> <hookexport> <hookdata> <config> <hook_name>Average Posts Per Day</hook_name> <hook_desc/> <hook_author>Test</hook_author> <hook_email>test.com</hook_email> <hook_website>http://invisionlegacy.com</hook_website> <hook_update_check>http://test.com/hookCheck.php?hook=ppD</hook_update_check> <hook_requirements><![CDATA[a:3:{s:21:"required_applications";a:0:{}s:20:"hook_php_version_min";s:0:"";s:20:"hook_php_version_max";s:0:"";}]]></hook_requirements> <hook_version_human>1.0.0</hook_version_human> <hook_version_long>10000</hook_version_long> <hook_extra_data><![CDATA[a:4:{s:7:"display";a:3:{s:8:"settings";s:44:"Setting groups: -RAW33- Average Post Per Day";s:8:"language";s:60:"From members_public_profile: ppd_avg, ppd_per_day, ppd_posts";s:9:"templates";s:37:"From skin_profile: hook_avgpostperDay";}s:13:"settingGroups";a:1:{s:0:"";s:3:"ppD";}s:8:"language";a:1:{s:22:"members_public_profile";a:3:{s:0:"";s:7:"ppd_avg";i:1;s:11:"ppd_per_day";i:2;s:9:"ppd_posts";}}s:9:"templates";a:1:{s:12:"skin_profile";a:1:{i:0;s:18:"hook_avgpostperDay";}}}]]></hook_extra_data> <hook_key>ppD</hook_key> <hook_global_caches/> </config> </hookdata> <hookfiles> <file> <hook_file_real>hook_avgpostperDay.php</hook_file_real> <hook_type>templateHooks</hook_type> <hook_classname>hook_avgpostperDay</hook_classname> <hook_data><![CDATA[a:8:{s:12:"dataLocation";s:0:"";s:14:"libApplication";s:0:"";s:15:"classToOverload";s:0:"";s:9:"skinGroup";s:12:"skin_profile";s:12:"skinFunction";s:13:"profileModern";s:4:"type";s:2:"if";s:2:"id";s:15:"member_birthday";s:8:"position";s:10:"post.endif";}]]></hook_data> <hooks_source><![CDATA[<?php class hook_avgpostperDay { public $registry; public $settings; public $DB; public $memberData; public function __construct() { $this->registry = ipsRegistry::instance(); $this->DB = $this->registry->DB(); $this->settings = $this->registry->settings(); $this->request = $this->registry->request(); $this->lang = $this->registry->getClass('class_localization'); $this->member = $this->registry->member(); $this->memberData =& $this->registry->member()->fetchMemberData(); $this->cache = $this->registry->cache(); $this->caches =& $this->registry->cache()->fetchCaches(); } public function getOutput() { /* Not Enable? */ if(!$this->settings['ppD_enable']) { return false; } /* No Groups Selected */ if(!in_array( $this->memberData['member_group_id'], explode(',', $this->settings['ppD_g']) ) ) { return false; } $id = intval($this->request['id']); if(!$id) { $this->registry->output->showError( 'error_no_user' ); } $member = IPSMember::load( $id, 'extendedProfile,groups' ); $board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies']; $member['_posts_day'] = 0; $member['_total_pct'] = 0; //----------------------------------------- // Total posts //----------------------------------------- if ( $member['posts'] and $board_posts ) { $member['_posts_day'] = round( $member['posts'] / (((time() - $member['joined']) / 86400)), 2); # Fix the issue when there is less than one day $member['_posts_day'] = ( $member['_posts_day'] > $member['posts'] ) ? $member['posts'] : $member['_posts_day']; $member['_total_pct'] = sprintf( '%.2f', ( $member['posts'] / $board_posts * 100 ) ); } return $this->registry->output->getTemplate('profile')->hook_avgpostperDay($member); } }]]></hooks_source> </file> </hookfiles> <hookextras_settings> <setting> <conf_is_title>1</conf_is_title> <conf_title_title>-RAW33- Average Posts Per Day</conf_title_title> <conf_title_desc>Settings for this hook.</conf_title_desc> <conf_title_noshow>0</conf_title_noshow> <conf_title_keyword>ppD</conf_title_keyword> <conf_title_app>core</conf_title_app> <conf_title_tab>Hooks</conf_title_tab> </setting> <setting> <conf_id>314</conf_id> <conf_title>On/Off</conf_title> <conf_description>Is this hook enable ?</conf_description> <conf_group>37</conf_group> <conf_type>yes_no</conf_type> <conf_key>ppD_enable</conf_key> <conf_value/> <conf_default>0</conf_default> <conf_extra/> <conf_evalphp/> <conf_protected>1</conf_protected> <conf_position>1</conf_position> <conf_start_group/> <conf_add_cache>1</conf_add_cache> <conf_keywords/> <conf_title_keyword>ppD</conf_title_keyword> <conf_is_title>0</conf_is_title> </setting> <setting> <conf_id>315</conf_id> <conf_title>Group Permissions</conf_title> <conf_description>Select groups that can view average posts per day on profiles.</conf_description> <conf_group>37</conf_group> <conf_type>multi</conf_type> <conf_key>ppD_g</conf_key> <conf_value/> <conf_default/> <conf_extra>#show_groups#</conf_extra> <conf_evalphp><![CDATA[$key = 'ppD_g'; if ( $save == 1) { if ( is_array($_POST[ $key ]) ) { $_POST[ $key ] = implode(",",$_POST[ $key ]); } else { $_POST[ $key ] = ""; } } if ( $show == 1 ) { $key .= '[]'; }]]></conf_evalphp> <conf_protected>1</conf_protected> <conf_position>2</conf_position> <conf_start_group/> <conf_add_cache>1</conf_add_cache> <conf_keywords/> <conf_title_keyword>ppD</conf_title_keyword> <conf_is_title>0</conf_is_title> </setting> </hookextras_settings> <hookextras_language> <language> <word_app>members</word_app> <word_pack>public_profile</word_pack> <word_key>ppd_posts</word_key> <word_default>posts</word_default> </language> <language> <word_app>members</word_app> <word_pack>public_profile</word_pack> <word_key>ppd_per_day</word_key> <word_default>per day</word_default> </language> <language> <word_app>members</word_app> <word_pack>public_profile</word_pack> <word_key>ppd_avg</word_key> <word_default>Average Posts</word_default> </language> </hookextras_language> <hookextras_modules/> <hookextras_help/> <hookextras_templates> <templates> <template_group>skin_profile</template_group> <template_content><![CDATA[<li class='clear clearfix'> <span class='row_title'>{$this->lang->words['ppd_avg']}</span> {parse format_number="$member['posts']"} {$this->lang->words['ppd_posts']} ({$member['_posts_day']} {$this->lang->words['ppd_per_day']}) </li>]]></template_content> <template_name>hook_avgpostperDay</template_name> <template_data>$member=array()</template_data> <template_updated>1339788308</template_updated> <template_removable>1</template_removable> <template_added_to>1</template_added_to> <template_user_added>1</template_user_added> <template_user_edited>1</template_user_edited> <template_master_key>root</template_master_key> </templates> </hookextras_templates> <hookextras_css/> <hookextras_replacements/> <hookextras_tasks/> <hookextras_database_create/> <hookextras_database_alter/> <hookextras_database_update/> <hookextras_database_insert/> </hookexport> ram108 and benix 2 Quote Link to comment Share on other sites More sharing options...
ram108 Posted November 13, 2016 Share Posted November 13, 2016 В четвертой версии совсем другая логика расширений, поэтому код от третьей версии не поможет. Посмотри, как работают расширения от четвертой версии, может быть натолкнут на правильные мысли. Можно глянуть (SOS40)_General_Statistics_1.0.1 Silence 1 Quote Link to comment Share on other sites More sharing options...
Silence Posted November 13, 2016 Author Share Posted November 13, 2016 Да я използваю (SOS40)_General_Statistics_1.0.1 но там нет такой елемент ram108 and Axeland 2 Quote Link to comment Share on other sites More sharing options...
rustav Posted December 13, 2016 Share Posted December 13, 2016 Silence, смог реализовать? Silence and ram108 2 Quote Link to comment Share on other sites More sharing options...
Silence Posted December 13, 2016 Author Share Posted December 13, 2016 16 минут назад, rustav сказал: Silence, смог реализовать? Я буду стараться сделать что-то Axeland and ram108 2 Quote Link to comment Share on other sites More sharing options...
ram108 Posted December 13, 2016 Share Posted December 13, 2016 Silence, спасибо тебе за упорство в поиске решений и за помощь на форуме. Axeland and Silence 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.