Is there a way I can reverse use the User Model to return an authorId
based on the first/last name (John Doe)?
Basically, I'm converting the first/last to a readable URI segment (using email addresses as username and I want something more readable than an ID in the URL):
{{ entry.author.firstName|lower ~ '-' ~ entry.author.lastName|lower }}
Returns: john-doe
Then on the listing page, grabbing the URI segment, setting that back to a readable name and spliting to array.
{% set authorName = craft.request.segment(3)|replace({'-':' '})|title|split(' ') %}
Which gives me (the equivalent of):
Array
(
[0] => John
[1] => Doe
)
I'd like to get the author id to return all the entries from said author. I thought something along the lines of below would work:
{% set author = craft.users.firstName(authorName.0).lastName(authorName.1) %}
With the above, I get the error:
Object of class Craft\ElementCriteriaModel could not be converted to string
However, if I return {{ authorName.0 }}
it returns a string.