Index: trunk/extensions/SocialProfile/UserProfile/SpecialUpdateProfile.php |
— | — | @@ -284,28 +284,34 @@ |
285 | 285 | |
286 | 286 | $this->initProfile( $user ); |
287 | 287 | $dbw = wfGetDB( DB_MASTER ); |
| 288 | + $basicProfileData = array( |
| 289 | + 'up_location_city' => $wgRequest->getVal( 'location_city' ), |
| 290 | + 'up_location_state' => $wgRequest->getVal( 'location_state' ), |
| 291 | + 'up_location_country' => $wgRequest->getVal( 'location_country' ), |
| 292 | + |
| 293 | + 'up_hometown_city' => $wgRequest->getVal( 'hometown_city' ), |
| 294 | + 'up_hometown_state' => $wgRequest->getVal( 'hometown_state' ), |
| 295 | + 'up_hometown_country' => $wgRequest->getVal( 'hometown_country' ), |
| 296 | + |
| 297 | + 'up_birthday' => $this->formatBirthdayDB( $wgRequest->getVal( 'birthday' ) ), |
| 298 | + 'up_about' => $wgRequest->getVal( 'about' ), |
| 299 | + 'up_occupation' => $wgRequest->getVal( 'occupation' ), |
| 300 | + 'up_schools' => $wgRequest->getVal( 'schools' ), |
| 301 | + 'up_places_lived' => $wgRequest->getVal( 'places' ), |
| 302 | + 'up_websites' => $wgRequest->getVal( 'websites' ), |
| 303 | + 'up_relationship' => $wgRequest->getVal( 'relationship' ) |
| 304 | + ); |
288 | 305 | $dbw->update( |
289 | 306 | 'user_profile', |
290 | | - /* SET */array( |
291 | | - 'up_location_city' => $wgRequest->getVal( 'location_city' ), |
292 | | - 'up_location_state' => $wgRequest->getVal( 'location_state' ), |
293 | | - 'up_location_country' => $wgRequest->getVal( 'location_country' ), |
294 | | - |
295 | | - 'up_hometown_city' => $wgRequest->getVal( 'hometown_city' ), |
296 | | - 'up_hometown_state' => $wgRequest->getVal( 'hometown_state' ), |
297 | | - 'up_hometown_country' => $wgRequest->getVal( 'hometown_country' ), |
298 | | - |
299 | | - 'up_birthday' => $this->formatBirthdayDB( $wgRequest->getVal( 'birthday' ) ), |
300 | | - 'up_about' => $wgRequest->getVal( 'about' ), |
301 | | - 'up_occupation' => $wgRequest->getVal( 'occupation' ), |
302 | | - 'up_schools' => $wgRequest->getVal( 'schools' ), |
303 | | - 'up_places_lived' => $wgRequest->getVal( 'places' ), |
304 | | - 'up_websites' => $wgRequest->getVal( 'websites' ), |
305 | | - 'up_relationship' => $wgRequest->getVal( 'relationship' ) |
306 | | - ), |
| 307 | + /* SET */$basicProfileData, |
307 | 308 | /* WHERE */array( 'up_user_id' => $user->getID() ), |
308 | 309 | __METHOD__ |
309 | 310 | ); |
| 311 | + // BasicProfileChanged hook |
| 312 | + $basicProfileData['up_name'] = $wgRequest->getVal( 'real_name' ); |
| 313 | + $basicProfileData['up_email'] = $wgRequest->getVal( 'email' ); |
| 314 | + wfRunHooks( 'BasicProfileChanged', array( $user, $basicProfileData ) ); |
| 315 | + // end of the hook |
310 | 316 | $wgMemc->delete( wfMemcKey( 'user', 'profile', 'info', $user->getID() ) ); |
311 | 317 | } |
312 | 318 | |
— | — | @@ -355,22 +361,26 @@ |
356 | 362 | |
357 | 363 | $this->initProfile( $user ); |
358 | 364 | $dbw = wfGetDB( DB_MASTER ); |
| 365 | + $interestsData = array( |
| 366 | + 'up_companies' => $wgRequest->getVal( 'companies' ), |
| 367 | + 'up_movies' => $wgRequest->getVal( 'movies' ), |
| 368 | + 'up_music' => $wgRequest->getVal( 'music' ), |
| 369 | + 'up_tv' => $wgRequest->getVal( 'tv' ), |
| 370 | + 'up_books' => $wgRequest->getVal( 'books' ), |
| 371 | + 'up_magazines' => $wgRequest->getVal( 'magazines' ), |
| 372 | + 'up_video_games' => $wgRequest->getVal( 'videogames' ), |
| 373 | + 'up_snacks' => $wgRequest->getVal( 'snacks' ), |
| 374 | + 'up_drinks' => $wgRequest->getVal( 'drinks' ) |
| 375 | + ); |
359 | 376 | $dbw->update( |
360 | 377 | 'user_profile', |
361 | | - /* SET */array( |
362 | | - 'up_companies' => $wgRequest->getVal( 'companies' ), |
363 | | - 'up_movies' => $wgRequest->getVal( 'movies' ), |
364 | | - 'up_music' => $wgRequest->getVal( 'music' ), |
365 | | - 'up_tv' => $wgRequest->getVal( 'tv' ), |
366 | | - 'up_books' => $wgRequest->getVal( 'books' ), |
367 | | - 'up_magazines' => $wgRequest->getVal( 'magazines' ), |
368 | | - 'up_video_games' => $wgRequest->getVal( 'videogames' ), |
369 | | - 'up_snacks' => $wgRequest->getVal( 'snacks' ), |
370 | | - 'up_drinks' => $wgRequest->getVal( 'drinks' ) |
371 | | - ), |
| 378 | + /* SET */$interestsData, |
372 | 379 | /* WHERE */array( 'up_user_id' => $user->getID() ), |
373 | 380 | __METHOD__ |
374 | 381 | ); |
| 382 | + // PersonalInterestsChanged hook |
| 383 | + wfRunHooks( 'PersonalInterestsChanged', array( $user, $interestsData ) ); |
| 384 | + // end of the hook |
375 | 385 | $wgMemc->delete( wfMemcKey( 'user', 'profile', 'info', $user->getID() ) ); |
376 | 386 | } |
377 | 387 | |
Index: trunk/extensions/SocialProfile/UserProfile/SpecialUploadAvatar.php |
— | — | @@ -55,6 +55,8 @@ |
56 | 56 | $wgOut->redirect( '' ); |
57 | 57 | |
58 | 58 | $this->showSuccess( $this->mUpload->mExtension ); |
| 59 | + // Run a hook on avatar change |
| 60 | + wfRunHooks( 'NewAvatarUploaded', array( $wgUser ) ); |
59 | 61 | } |
60 | 62 | } |
61 | 63 | |
— | — | @@ -229,6 +231,7 @@ |
230 | 232 | return "<img src=\"{$wgUploadPath}/avatars/" . basename( $files[0] ) . '" alt="" border="0" />'; |
231 | 233 | } |
232 | 234 | } |
| 235 | + |
233 | 236 | } |
234 | 237 | |
235 | 238 | class UploadAvatar extends UploadFromFile { |
Index: trunk/extensions/SocialProfile/UserRelationship/UserRelationshipClass.php |
— | — | @@ -266,6 +266,13 @@ |
267 | 267 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$this->user_id}-{$ur_type}" ) ); |
268 | 268 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$ur_user_id_from}-{$ur_type}" ) ); |
269 | 269 | |
| 270 | + // Hooks (for Semantic SocialProfile mostly) |
| 271 | + if ( $ur_type == 1 ) { |
| 272 | + wfRunHooks( 'NewFriendAccepted', array( $ur_user_name_from, $this->user_name ) ); |
| 273 | + } else { |
| 274 | + wfRunHooks( 'NewFoeAccepted', array( $ur_user_name_from, $this->user_name ) ); |
| 275 | + } |
| 276 | + |
270 | 277 | return true; |
271 | 278 | } else { |
272 | 279 | return false; |
— | — | @@ -304,6 +311,10 @@ |
305 | 312 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$user1}-2" ) ); |
306 | 313 | $wgMemc->delete( wfMemcKey( 'relationship', 'profile', "{$user2}-2" ) ); |
307 | 314 | |
| 315 | + // RelationshipRemovedByUserID hook |
| 316 | + wfRunHooks( 'RelationshipRemovedByUserID', array( $user1, $user2 ) ); |
| 317 | + |
| 318 | + // Update social statistics for both users |
308 | 319 | $stats = new UserStatsTrack( $user1, '' ); |
309 | 320 | $stats->updateRelationshipCount( 1 ); |
310 | 321 | $stats->updateRelationshipCount( 2 ); |