Index: branches/5.3.x/units/topics/topics_event_handler.php =================================================================== diff -u -N -r15924 -r16397 --- branches/5.3.x/units/topics/topics_event_handler.php (.../topics_event_handler.php) (revision 15924) +++ branches/5.3.x/units/topics/topics_event_handler.php (.../topics_event_handler.php) (revision 16397) @@ -1,6 +1,6 @@ Application->LoggedIn() ) { + return; + } + $config = $event->getUnitConfig(); $fields = $config->getFields(); @@ -303,4 +307,37 @@ $manager->subscribe(); } } - } \ No newline at end of file + + /** + * Adds fields for forum preferences. + * + * @param kEvent $event Event. + * + * @return void + */ + protected function OnModifyUserProfileConfig(kEvent $event) + { + $checkbox_field = array( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', 'options' => array(1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, + 'default' => 0, + ); + $text_field = array('type' => 'string', 'default' => ''); + + $new_virtual_fields = array( + 'show_sig' => $checkbox_field, + 'Perpage_Topics' => $text_field, + 'Perpage_Postings' => $text_field, + 'owner_notify' => $checkbox_field, + 'bb_pm_notify' => $checkbox_field, + 'bbcode' => $checkbox_field, + 'smileys' => $checkbox_field, + 'bb_signatures' => $checkbox_field, + 'my_signature' => $text_field, + ); + + $config = $event->MasterEvent->getUnitConfig(); + $config->setVirtualFields(array_merge($config->getVirtualFields(array()), $new_virtual_fields)); + } + + } Index: branches/5.3.x/units/posts/post_eh.php =================================================================== diff -u -N -r15935 -r16397 --- branches/5.3.x/units/posts/post_eh.php (.../post_eh.php) (revision 15935) +++ branches/5.3.x/units/posts/post_eh.php (.../post_eh.php) (revision 16397) @@ -1,6 +1,6 @@ Application->recallObject($parent_prefix); /* @var $main_object kCatDBItem */ - // update user posts counter - $user_posts = $this->Application->RecallPersistentVar('bb_posts'); - $this->Application->StorePersistentVar('bb_posts', $user_posts + 1); + if ( $this->Application->LoggedIn() ) { + // Update user posts counter. + $user_posts = $this->Application->RecallPersistentVar('bb_posts'); + $this->Application->StorePersistentVar('bb_posts', $user_posts + 1); + } $post_helper = $this->Application->recallObject('PostHelper'); /* @var $post_helper PostHelper */ @@ -399,6 +401,10 @@ { parent::OnAfterConfigRead($event); + if ( !$this->Application->LoggedIn() ) { + return; + } + $config = $event->getUnitConfig(); $virtual_fields = $config->getVirtualFields(); @@ -451,4 +457,4 @@ $object->SetDBField('PostingText', '[quote id=' . $reply_to . ']' . $source_post->GetDBField('PostingText') . '[/quote]'); } } - } \ No newline at end of file + } Index: branches/5.3.x/units/posts/post_tp.php =================================================================== diff -u -N -r15694 -r16397 --- branches/5.3.x/units/posts/post_tp.php (.../post_tp.php) (revision 15694) +++ branches/5.3.x/units/posts/post_tp.php (.../post_tp.php) (revision 16397) @@ -1,6 +1,6 @@ Application->LoggedIn() ) { + $show_signatures = $this->Application->RecallPersistentVar('bb_signatures'); + } + else { + $show_signatures = false; + } + } + + if ( !$show_signatures ) { + return false; + } + + /** @var kDBItem $object */ $object = $this->getObject($params); - $post_options = $object->GetDBField('Options'); + /** @var PostHelper $post_helper */ $post_helper = $this->Application->recallObject('PostHelper'); - /* @var $post_helper PostHelper */ - // show poster signature in this post - if ($post_helper->GetPostOption('show_sig', $post_options)) { - // logged-in user wishes to view signatures in posts - $show_other_signatures = $this->Application->RecallPersistentVar('bb_signatures'); - if ($show_other_signatures) { - // don't show signature when it is empty - $signature = $this->getUserSignature($object->GetDBField('CreatedById')); - return strlen(trim($signature)) ? true : false; - } + // Show poster signature in this post. + if ( $post_helper->GetPostOption('show_sig', $object->GetDBField('Options')) ) { + // Don't show signature when it is empty. + $signature = $this->getUserSignature($object->GetDBField('CreatedById')); + + return strlen(trim($signature)) ? true : false; } return false; @@ -310,4 +323,4 @@ } return parent::PageLink($params); } - } \ No newline at end of file + } Index: branches/5.3.x/units/posts/posts_config.php =================================================================== diff -u -N -r15674 -r16397 --- branches/5.3.x/units/posts/posts_config.php (.../posts_config.php) (revision 15674) +++ branches/5.3.x/units/posts/posts_config.php (.../posts_config.php) (revision 16397) @@ -1,6 +1,6 @@ Array ( 'DisableBBCodes' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'default' => 0), 'DisableSmileys' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'default' => 0), - 'ShowSignatures' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 1), + 'ShowSignatures' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes'), 'use_phrases' => 1, 'default' => 0), 'UserName' => Array ('type' => 'string', 'default' => ''), // for avatar image 'AltName' => Array ('type' => 'string', 'default' => ''), @@ -108,4 +108,4 @@ 'ConfigMapping' => Array ( 'PerPage' => 'Perpage_Postings', ), -); \ No newline at end of file +); Index: branches/5.3.x/units/topics/topics_config.php =================================================================== diff -u -N -r16173 -r16397 --- branches/5.3.x/units/topics/topics_config.php (.../topics_config.php) (revision 16173) +++ branches/5.3.x/units/topics/topics_config.php (.../topics_config.php) (revision 16397) @@ -1,6 +1,6 @@ '*', 'DoEvent' => 'OnCloneSubItem', ), + + array( + 'Mode' => hBEFORE, + 'Conditional' => false, + 'HookToPrefix' => 'user-profile', + 'HookToSpecial' => '*', + 'HookToEvent' => array('OnAfterConfigRead'), + 'DoPrefix' => '', + 'DoSpecial' => '*', + 'DoEvent' => 'OnModifyUserProfileConfig', + ), ), 'CatalogItem' => true, @@ -500,7 +511,7 @@ 'type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (0 => 'la_No', 1 => 'la_Yes',), 'use_phrases' => 1, - 'default' => 1, + 'default' => 0, ), // for primary image Index: branches/5.3.x/units/private_messages/private_message_eh.php =================================================================== diff -u -N -r16105 -r16397 --- branches/5.3.x/units/private_messages/private_message_eh.php (.../private_message_eh.php) (revision 16105) +++ branches/5.3.x/units/private_messages/private_message_eh.php (.../private_message_eh.php) (revision 16397) @@ -1,6 +1,6 @@ Application->LoggedIn() ) { + return; + } + $config = $event->getUnitConfig(); $virtual_fields = $config->getVirtualFields();