Last modified: 2011-03-29 23:19:44 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T29032, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27032 - Feature request: Allow editing of other user's profiles
Feature request: Allow editing of other user's profiles
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SocialProfile (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Jack Phoenix
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-29 19:57 UTC by Frozen Wind
Modified: 2011-03-29 23:19 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Patch to add Special:EditProfile (31.04 KB, patch)
2011-03-26 01:38 UTC, Frozen Wind
Details
new version (32.15 KB, patch)
2011-03-26 13:34 UTC, Frozen Wind
Details

Description Frozen Wind 2011-01-29 19:57:01 UTC
Ideally, Special:UpdateProfile should let privileged users to let them edit profiles.

Initial patch coming soon.
Comment 1 Frozen Wind 2011-03-26 01:38:00 UTC
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.
Comment 2 Jack Phoenix 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 <david.pean@gmail.com>
> + * @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.
Comment 3 Frozen Wind 2011-03-26 12:42:32 UTC
That's why I warned you. Anyway, will implement.
Comment 4 Frozen Wind 2011-03-26 13:34:01 UTC
Created attachment 8329 [details]
new version

This patch is more i18n friendly now, along with your other suggestions.
Comment 5 Frozen Wind 2011-03-28 20:03:19 UTC
Allo?
Comment 6 Jack Phoenix 2011-03-29 23:19:44 UTC
I've committed your patch with some modifications in r84989. It took me a while to figure out how to reduce the amount of code duplication, but I eventually figured it out.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links