Apologies for re-posting essentially the same post but this is just a final attempt to get some input on what seems to be a very specific issue.
We have a custom skin that includes the personal URLs and a link to the User:¹ page in the format:
www.domain.com/wiki/index.php?title=User:XXX
with the hyperlink appearing as the username, XXX¹ in this example.
We would like to retain the link but point it instead to:
www.domain.com/user/YY
Where YY is not the username but instead the uid. The hyperlink should remain as-is (i.e. XXX) but point to the new destination.
I am not a PHP expert but have found this in our custom skin php file.
I am thinking that the line marked with ** is the line to change but don¹t know what to insert in its place.
Can anyone help out? Is this is something better posted in a PHP forum?
Many thanks, Paul
<?php foreach($this->data['personal_urls'] as $key => $item) { ?> <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php global $wgTitle, $wgUser; $item['active'] = $item['active'] || $item['href']==$wgTitle->getLocalURL() || ** $item['href']==$wgTitle->getLocalURL().'/'.$wgUser->getName(); if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php if(!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
Paul Coghlan a écrit :
I am thinking that the line marked with ** is the line to change but don¹t know what to insert in its place.
No, it's not that line
<?php foreach($this->data['personal_urls'] as $key => $item) { ?>
<li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php global $wgTitle, $wgUser; $item['active'] = $item['active'] || $item['href']==$wgTitle->getLocalURL() ||
** $item['href']==$wgTitle->getLocalURL().'/'.$wgUser->getName(); if ($item['active']) { ?> class="active"<?php } ?>><a href="<?php echo htmlspecialchars($item['href']) ?>"<?php if(!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
change
href="<?php echo htmlspecialchars($item['href']) ?>"
to
href="/user/<?php global $wgUser; echo $wgUser->getID ?>"
should do the trick (NB: non-logged in user have ID 0)
Alexis
This is really useful, your input is appreciated.
Unfortunately it changes each of the personal urls to that URL not just the User: link.
There are two personal urls, one is the user: link the other is a Log Out link. With this change both become /user/YY ?
Many thanks, Paul
On 9/7/07 9:56 AM, "Alexis Moinet" alexis.moinet@fpms.ac.be wrote:
Alexis Moinet a écrit :
href="/user/<?php global $wgUser; echo $wgUser->getID ?>"
my bad, it ought to be :
href="/user/<?php global $wgUser; echo $wgUser->getID();?>"
sorry
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
What about using a redirect from the wiki user page?
Courtney
Thanks but surely the redirect would be needing both the user name and the user id?
i.e. I try to hit domain/com/wiki/User:Paul it would need to know that Paul=3 and redirect to domain.com/user/3
Not sure is I am making myself clear.
I think the solution from Alexis is fine but I need to differentiate between the User: and Log Out links, changing only the former.
Thanks again, Paul
On 9/7/07 10:32 AM, "Christensen, Courtney" ChristensenC@BATTELLE.ORG wrote:
What about using a redirect from the wiki user page?
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
STOP sending me emails you have the wrong address
-----Original Message----- From: Paul Coghlan pcoghlan@usa.net To: MediaWiki announcements and site admin list mediawiki-l@lists.wikimedia.org Sent: Fri, 7 Sep 2007 7:36 am Subject: Re: [Mediawiki-l] Changing User: URL link
Courtney
Thanks but surely the redirect would be needing both the user name and the user id?
i.e. I try to hit domain/com/wiki/User:Paul it would need to know that Paul=3 and redirect to domain.com/user/3
Not sure is I am making myself clear.
I think the solution from Alexis is fine but I need to differentiate between the User: and Log Out links, changing only the former.
Thanks again, Paul
On 9/7/07 10:32 AM, "Christensen, Courtney" ChristensenC@BATTELLE.ORG wrote:
What about using a redirect from the wiki user page?
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com
STOP sending me emails
-----Original Message----- From: Christensen, Courtney ChristensenC@BATTELLE.ORG To: MediaWiki announcements and site admin list mediawiki-l@lists.wikimedia.org Sent: Fri, 7 Sep 2007 7:32 am Subject: Re: [Mediawiki-l] Changing User: URL link
What about using a redirect from the wiki user page?
_______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com
Paul Coghlan wrote :
Unfortunately it changes each of the personal urls to that URL not just the User: link.
There are two personal urls, one is the user: link the other is a Log Out link. With this change both become /user/YY ?
right, I should have read (and tested) more carefully
another (tested and working on 1.10, afaik) solution is this one :
In LocalSettings.php, at the end of the file, add this :
$wgHooks['PersonalUrls'][] = 'fnPersonalUrlsHook';
function fnPersonalUrlsHook(&$personal_urls, &$wgTitle) { global $wgUser;
if ($wgUser->isLoggedIn()) { /*in case the user is logged in*/ $personal_urls['userpage']['href'] = "/user/" . $wgUser->getID(); /*talk page url*/ $personal_urls['mytalk']['href'] = "/user/" . $wgUser->getID() . "/talk"; } else { /*IP-identified user have ID 0*/ $personal_urls['anonuserpage']['href'] = "/user/0"; /*talk page url*/ $personal_urls['anontalk']['href'] = "/user/talk"; }
return $personal_urls; }
Alexis, this is just what I needed!
Many thanks, Paul
On 9/10/07 10:28 AM, "Alexis Moinet" alexis.moinet@fpms.ac.be wrote:
Paul Coghlan wrote :
Unfortunately it changes each of the personal urls to that URL not just the User: link.
There are two personal urls, one is the user: link the other is a Log Out link. With this change both become /user/YY ?
right, I should have read (and tested) more carefully
another (tested and working on 1.10, afaik) solution is this one :
In LocalSettings.php, at the end of the file, add this :
$wgHooks['PersonalUrls'][] = 'fnPersonalUrlsHook';
function fnPersonalUrlsHook(&$personal_urls, &$wgTitle) { global $wgUser;
if ($wgUser->isLoggedIn()) { /*in case the user is logged in*/ $personal_urls['userpage']['href'] = "/user/" . $wgUser->getID(); /*talk page url*/ $personal_urls['mytalk']['href'] = "/user/" . $wgUser->getID() . "/talk"; } else { /*IP-identified user have ID 0*/ $personal_urls['anonuserpage']['href'] = "/user/0"; /*talk page url*/ $personal_urls['anontalk']['href'] = "/user/talk"; }
return $personal_urls; }
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
STOP SENDING EMAILS YOU HAVE THE WRONG ADDRESS
-----Original Message----- From: Alexis Moinet alexis.moinet@fpms.ac.be To: MediaWiki announcements and site admin list mediawiki-l@lists.wikimedia.org Sent: Fri, 7 Sep 2007 6:56 am Subject: Re: [Mediawiki-l] Changing User: URL link
Alexis Moinet a écrit : href="/user/<?php global $wgUser; echo $wgUser->getID ?>" my bad, it ought to be : href="/user/<?php global $wgUser; echo $wgUser->getID();?>" sorry
______________________________________________ ediaWiki-l mailing list ediaWiki-l@lists.wikimedia.org ttp://lists.wikimedia.org/mailman/listinfo/mediawiki-l
________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com
STOP SENDING EMAILS YOU HAVE THE WRONGADDRESS
-----Original Message----- From: Paul Coghlan pcoghlan@usa.net To: MediaWiki announcements and site admin list mediawiki-l@lists.wikimedia.org Sent: Fri, 7 Sep 2007 5:34 am Subject: [Mediawiki-l] Changing User: URL link
Apologies for re-posting essentially the same post but this is just a final ttempt to get some input on what seems to be a very specific issue. We have a custom skin that includes the personal URLs and a link to the User:¹ page in the format: www.domain.com/wiki/index.php?title=User:XXX with the hyperlink appearing as the username, ŒXXX¹ in this example. We would like to retain the link but point it instead to: www.domain.com/user/YY Where YY is not the username but instead the uid. The hyperlink should emain as-is (i.e. XXX) but point to the new destination. I am not a PHP expert but have found this in our custom skin php file. I am thinking that the line marked with ** is the line to change but don¹t now what to insert in its place. Can anyone help out? Is this is something better posted in a PHP forum? Many thanks, aul <?php foreach($this->data['personal_urls'] as $key => $item) {
<li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php global $wgTitle, $wgUser; $item['active'] = $item['active'] || $item['href']==$wgTitle->getLocalURL() || * $item['href']==$wgTitle->getLocalURL().'/'.$wgUser->getName(); if ($item['active']) { ?> class="active"<?php } ?>><a ref="<?php echo htmlspecialchars($item['href']) ?>"<?php if(!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
______________________________________________ ediaWiki-l mailing list ediaWiki-l@lists.wikimedia.org ttp://lists.wikimedia.org/mailman/listinfo/mediawiki-l
________________________________________________________________________ Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com
On 08/09/2007, larson191@aol.com larson191@aol.com wrote:
STOP SENDING EMAILS YOU HAVE THE WRONGADDRESS
-----Original Message----- From: Paul Coghlan pcoghlan@usa.net To: MediaWiki announcements and site admin list < mediawiki-l@lists.wikimedia.org> Sent: Fri, 7 Sep 2007 5:34 am Subject: [Mediawiki-l] Changing User: URL link
Apologies for re-posting essentially the same post but this is just a final ttempt to get some input on what seems to be a very specific issue. We have a custom skin that includes the personal URLs and a link to the User:¹ page in the format: www.domain.com/wiki/index.php?title=User:XXX with the hyperlink appearing as the username, ŒXXX¹ in this example. We would like to retain the link but point it instead to: www.domain.com/user/YY Where YY is not the username but instead the uid. The hyperlink should emain as-is (i.e. XXX) but point to the new destination. I am not a PHP expert but have found this in our custom skin php file. I am thinking that the line marked with ** is the line to change but don¹t now what to insert in its place. Can anyone help out? Is this is something better posted in a PHP forum? Many thanks, aul
<?php foreach($this->data['personal_urls'] as $key => $item) { > <li id="pt-<?php echo Sanitizer::escapeId($key) ?>"<?php
global $wgTitle, $wgUser; $item['active'] = $item['active'] || $item['href']==$wgTitle->getLocalURL() ||
$item['href']==$wgTitle->getLocalURL().'/'.$wgUser->getName(); if ($item['active']) { ?> class="active"<?php } ?>><a
ref="<?php echo htmlspecialchars($item['href']) ?>"<?php if(!empty($item['class'])) { ?> class="<?php echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php echo htmlspecialchars($item['text']) ?></a></li>
ediaWiki-l mailing list ediaWiki-l@lists.wikimedia.org ttp://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Email and AIM finally together. You've gotta check out free AOL Mail! - http://mail.aol.com _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Can a moderator remove this person's address from the subscriber's list please. Thanks.
mediawiki-l@lists.wikimedia.org