Index: trunk/extensions/SocialProfile/UserProfile/SpecialUpdateProfile.php |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | * Save social preferences into the database. |
185 | 185 | */ |
186 | 186 | function saveSettings_pref() { |
187 | | - global $wgUser, $wgOut, $wgRequest, $wgSitename; |
| 187 | + global $wgUser, $wgRequest; |
188 | 188 | |
189 | 189 | $notify_friend = $wgRequest->getVal( 'notify_friend' ); |
190 | 190 | $notify_gift = $wgRequest->getVal( 'notify_gift' ); |
— | — | @@ -211,36 +211,9 @@ |
212 | 212 | $wgUser->setOption( 'notifyhonorifics', $notify_honorifics ); |
213 | 213 | $wgUser->setOption( 'notifymessage', $notify_message ); |
214 | 214 | $wgUser->saveSettings(); |
215 | | - // This code is mostly related to ArmchairGM, however can be fixed to be used for others. |
216 | | - if ( $wgSitename == 'ArmchairGM' ) { |
217 | | - $dbw = wfGetDB( DB_MASTER ); |
218 | | - // If the user wants a weekly email, we'll put some info about that to the user_mailing_list table |
219 | | - if ( $wgRequest->getVal( 'weeklyemail' ) == 1 ) { |
220 | | - $s = $dbw->selectRow( |
221 | | - 'user_mailing_list', |
222 | | - array( 'um_user_id' ), |
223 | | - array( 'um_user_id' => $wgUser->getID() ), |
224 | | - __METHOD__ |
225 | | - ); |
226 | | - if ( $s === false ) { |
227 | | - $dbw->insert( |
228 | | - 'user_mailing_list', |
229 | | - array( |
230 | | - 'um_user_id' => $wgUser->getID(), |
231 | | - 'um_user_name' => $wgUser->getName(), |
232 | | - ), |
233 | | - __METHOD__ |
234 | | - ); |
235 | | - } |
236 | | - } else { |
237 | | - // Otherwise, just delete the entry. |
238 | | - $dbw->delete( |
239 | | - 'user_mailing_list', |
240 | | - array( 'um_user_id' => $wgUser->getID() ), |
241 | | - __METHOD__ |
242 | | - ); |
243 | | - } |
244 | | - } |
| 215 | + |
| 216 | + // Allow extensions like UserMailingList do their magic here |
| 217 | + wfRunHooks( 'SpecialUpdateProfile::saveSettings_pref', array( $this, $wgRequest ) ); |
245 | 218 | } |
246 | 219 | |
247 | 220 | function formatBirthdayDB( $birthday ) { |
— | — | @@ -712,6 +685,9 @@ |
713 | 686 | ' <input type="checkbox" size="25" name="notify_honorifics" id="notify_honorifics" value="1"' . ( ( $wgUser->getIntOption( 'notifyhonorifics', 1 ) == 1 ) ? 'checked' : '' ) . '/> |
714 | 687 | </p>'; |
715 | 688 | |
| 689 | + // Allow extensions (like UserMailingList) to add new checkboxes |
| 690 | + wfRunHooks( 'SpecialUpdateProfile::displayPreferencesForm', array( $this, &$form ) ); |
| 691 | + |
716 | 692 | $form .= '</div> |
717 | 693 | <div class="cleared"></div>'; |
718 | 694 | $form .= '<input type="button" class="site-button" value="' . wfMsg( 'user-profile-update-button' ) . '" size="20" onclick="document.profile.submit()" /> |