Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1046543
D211.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jun 28, 7:49 PM
Size
2 KB
Mime Type
text/x-diff
Expires
Sun, Jun 29, 7:49 PM (7 h, 13 m)
Engine
blob
Format
Raw Data
Handle
676565
Attached To
D211: MINB-25 - Declare forum user preferences in the "user-profile" unit
D211.id.diff
View Options
Index: branches/5.2.x/units/topics/topics_config.php
===================================================================
--- branches/5.2.x/units/topics/topics_config.php
+++ branches/5.2.x/units/topics/topics_config.php
@@ -100,6 +100,17 @@
'DoSpecial' => '*',
'DoEvent' => 'OnCloneSubItem',
),
+
+ array(
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'user-profile',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => array('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnModifyUserProfileConfig',
+ ),
),
'CatalogItem' => true,
Index: branches/5.2.x/units/topics/topics_event_handler.php
===================================================================
--- branches/5.2.x/units/topics/topics_event_handler.php
+++ branches/5.2.x/units/topics/topics_event_handler.php
@@ -304,4 +304,45 @@
$manager->subscribe();
}
}
+
+ /**
+ * 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,
+ );
+
+ $virtual_fields = $this->Application->getUnitOption(
+ $event->MasterEvent->Prefix,
+ 'VirtualFields',
+ array()
+ );
+ $this->Application->setUnitOption(
+ $event->MasterEvent->Prefix,
+ 'VirtualFields',
+ array_merge($virtual_fields, $new_virtual_fields)
+ );
+ }
+
}
Event Timeline
Log In to Comment