https://bugzilla.wikimedia.org/show_bug.cgi?id=27032

--- Comment #2 from Jack Phoenix <[email protected]> 2011-03-26 
11:21:26 UTC ---
(In reply to comment #1)
> Created attachment 8328 [details]
> Patch to add Special:EditProfile
> It looks like I forgot this bug in the dust. Oh well then. I have an initial
> version ready.
> It's VERY hacky, and while it works I need more opinions on it.

Firstly, thanks for writing this feature! It looks very cool and definitely
something I'd like to see in core SocialProfile after a bit of cleanup. :-)

The most obvious thing I see here is the amount of code duplication. Could we
reduce the amount of code duplication by moving some methods into the
UserProfile class (/extensions/SocialProfile/UserProfile/UserProfileClass.php)
or maybe by creating a new class? I think that'd be a lot better solution that
the current one.

> + * @author David Pean <[email protected]>
> + * @copyright Copyright © 2007, Wikia Inc.
You're not Dave, are you? :)

> +             // Are we even allowed to do this?
> +             if ( !$wgUser->isAllowed( 'editothersprofiles' ) ) {
> +                     $wgOut->showPermissionsErrorPage( array ("You do not 
> have access to this function.") );
This is icky and contains hardcoded English (while you and I might be okay with
that, some other folks will not be). I'd suggest using
$wgOut->permissionRequired( 'editothersprofiles' ); or something like that
instead.

> +             if ( !$_GET['user'] ) {
> +                     $wgOut->addHTML( '<form action="" method="get"><input 
> type="hidden" name="title" value="Special:EditProfile" />Username: <input 
> name="wpUser"><input type=submit value="Edit user profile"/></form>' );
> +                     return;
> +             }
> +
> +                $target = User::newFromName( $_GET['wpUser'] );
Use WebRequest ($wgRequest), don't use the $_GET superglobal directly. Also the
form construction should probably be in its own function (makeForm() or
something) and it needs to use MediaWiki's i18n functions (wfMsg() and friends)
properly.

> +                        $wgOut->addHTML( 'No such user' );
Use i18n functions properly.

> +                     $log->addEntry(
> +                             wfMsgForContent( 'user-profile-update-profile' 
> ),
> +                             $wgUser->getUserPage(),
> +                             "edited " . $target->getName() . "'s profile 
> section '{$section}'"
> +                     );
Same here.

> -     'user-profile-update-saved' => 'Your profile has been saved',
> +     'user-profile-update-saved' => 'Profile has been saved',
I think we should use the 'user-profile-update-saved' message when /you/ have
saved /your/ profile and use a new message EditProfile; maybe
'user-profile-edit-profile-changes-saved' with "Changes to $1's profile were
saved" or something as the text.

> +     'right-editothersprofiles' => "Update anyone's profile",
I don't exactly like the user right name; I'd prefer 'edituserprofiles' or
something with "Update other users' social profiles" or something as the text.

Again, thanks for writing this feature! Please let me know if you need any help
with the code cleanup process.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to