Jack Phoenix has uploaded a new change for review.
https://gerrit.wikimedia.org/r/227169
Change subject: Fix toggle button text issue on new users' profiles
......................................................................
Fix toggle button text issue on new users' profiles
When the owner of a profile would view their own profile, they'd see "Use
social userpage" as the text of the orange button, despite social profiles
being the default, when the correct text would be "Use wiki userpage",
since clicking on the button in that case makes wikitext page your default
user page.
For whatever reason, $profile_data is pretty funky for new users.
$profile_data['user_id'] is 0 (wtf) and all the fields are empty (whereas
user_page_type could technically have a default value of some kind, since
it cannot be "empty" -- a user has *always* either social profile or
wikitext user page as the default destination for User:<their username>).
For future reference:
* user_page_type = 0 means "wikitext user page as the default, social profile
at User_profile:<username>"
* user_page_type = 1 means "social profile page as the default, wikitext page
at UserWiki:<username>"
Change-Id: I3895c2080defabd81cbfcee14740f9d25af5bad1
---
M UserProfile/UserProfilePage.php
1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SocialProfile
refs/changes/69/227169/1
diff --git a/UserProfile/UserProfilePage.php b/UserProfile/UserProfilePage.php
index eaa91ef..ee4795f 100644
--- a/UserProfile/UserProfilePage.php
+++ b/UserProfile/UserProfilePage.php
@@ -850,7 +850,11 @@
if ( $this->isOwner() ) {
$toggle_title = SpecialPage::getTitleFor(
'ToggleUserPage' );
// Cast it to an int because PHP is stupid.
- if ( (int) $profile_data['user_page_type'] == 1 ) {
+ if (
+ (int) $profile_data['user_page_type'] == 1 ||
+ $profile_data['user_page_type'] === ''
+ )
+ {
$toggleMessage = wfMessage(
'user-type-toggle-old' )->escaped();
} else {
$toggleMessage = wfMessage(
'user-type-toggle-new' )->escaped();
--
To view, visit https://gerrit.wikimedia.org/r/227169
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3895c2080defabd81cbfcee14740f9d25af5bad1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SocialProfile
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits