Username field bug in permalinks

Found a bug? Tell us!!
Post Reply
oeli
Regular
Posts: 19
Joined: Sun Apr 17, 2005 10:27 am
Location: Vlissingen, The Netherlands
Contact:

Username field bug in permalinks

Post by oeli »

Hi,

in the serendipity config, I can choose to change the permalink for authors to something that includes the fields %username%, %realname% etc.

The default is %id%-%realname%.

When I set this to %realname%, everything works fine.

However, when I set this to %username%, something is wrong. I can go to the correct url, i.e. /authors/ivo shows my blog entries. However, in the blog, the author link that links to this page, is /authors/Ivo%20Jansch instead of /authors/ivo, leading to a page that displays no entries.

Is there a fix for this? I'm using s9y 1.0.2
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Username field bug in permalinks

Post by garvinhicking »

Hi!

Thanks a lot for this report! Since the 1.0 version line is soon getting replaced by 1.1, I have only patched the bug for the 1.1 SVN branch.

If you know how to apply a patch, here are the modifications:

Code: Select all

Index: include/functions_entries.inc.php
===================================================================
--- include/functions_entries.inc.php	(revision 1453)
+++ include/functions_entries.inc.php	(working copy)
@@ -350,6 +350,7 @@
                     e.last_modified,
 
                     a.realname AS author,
+                    a.username AS loginname,
                     a.email";
     }
 
@@ -962,7 +963,7 @@
 
             $authorData = array(
                             'authorid' => $entry['authorid'],
-                            'username' => $entry['author'],
+                            'username' => $entry['loginname'],
                             'email'    => $entry['email'],
                             'realname' => $entry['author']
             );
Index: docs/NEWS
===================================================================
--- docs/NEWS	(revision 1452)
+++ docs/NEWS	(working copy)
@@ -3,6 +3,9 @@
 Version 1.1 ()
 ------------------------------------------------------------------------
 
+    * Fix bug with using %username% in author permalinks, thanks to oeli
+      from the forums! (garvinhicking)
+
     * Fix possible integer wraparound in comment count leading to
       a gazillion counter state. Also now show links to the entries
       within the administration comment panel. Thanks to Julian Finn!
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
oeli
Regular
Posts: 19
Joined: Sun Apr 17, 2005 10:27 am
Location: Vlissingen, The Netherlands
Contact:

Post by oeli »

The fix works fine, thanks for the quick reply :-)

I'm now facing another issue, let's hope that is resolved as quickly too. :)
Post Reply