I’ve noticed something unexpected in the Channel Entries tag, and haven’t found any mention of it in the docs or on the web in general. I expected the author_id and username parameters to be essentially interchangeable, but they seem to behave differently when there are no matches.
For example, let’s assume a member with the username “bob”, whose member id is 2.
This tag:
{exp:channel:entries channel="gallery" author_id="2"}and this:
{exp:channel:entries channel="gallery" username="bob"}
should produce the same results, right?
If Bob doesn’t have any entries in this channel, the first tag (using the author_id parameter) ouputs nothing, as expected. But the second tag (with the username) outputs the most recent entry in the channel, regardless of author.
Since I’m using usernames like category urls for this site, it would be great to be able to rely on the channel entries tag to limit the entries by username even if there is no match—I don’t want to show a different member’s gallery on Bob’s page. Of course I can use a SQL query to get the member id from the username and feed that to channel:entries, but that’s kind of a kludge. I feel like I must be missing something obvious, but I’ve done a lot of searching and turned up nothing.