How do I pass a user's first name and last name from a user profile page to the title in _layout? I am trying to pass a member's firstName and lastName to the title on a member profile page. I am using segment 2 to capture the username. This works well in the for loop in the block:

{% set thePartner = craft.users.username( craft.request.getSegment(2) ) %}
{% for partner in thePartner %}
First Name and Last Name: {{ partner.firstName}} {{ partner.lastName }}
{% endfor %)


Outside the block, where I set the &lt;title&gt;, it doesn't work. Essentially, I would like to set the full name and use it in the title, like: 

{% set fullname = partner.firstName ~ ' ' ~ partner.lastName %}


with something like the following in _layout: 

&lt;title&gt;{{ fullname }} | {{ siteUrl }} &lt;/title&gt;


How can I pass the full name through?
Since you're just expecting one, you should only look for one. Then you don't have to use a for loop. Plus, fullName is already an attribute of user models. So you can do this for the title:

{% set thePartner = craft.users.username( craft.request.getSegment(2) ).first() %}
&lt;title&gt;{{ thePartner.fullName }} | {{ siteUrl }} &lt;/title&gt;


If you're still having trouble, it may be with what segments you are pulling from the URL.