We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Comparing {title} to logged in username

How Do I?

amyvarsho's avatar
amyvarsho
4 posts
3 years ago
amyvarsho's avatar amyvarsho

I’m trying to find a solution to comparing the title of a channel entry to the logged in username. My site has old entries that were placed there using google docs import. Now the site has been updated to have a register page, log-in the whole nine yards, which is awesome. The only problem is some users that will be using the new register log in site already exist. So when the person registers and they have an existing entry they can claim their profile and that profile will be tied to that users account. I have been trying many different ways. The title of the entry is the person’s name. When they log into the site the username is the person’s name. I’m trying to figure out a way to compare the two. I have tried {if {title} == {logged_in_username}}do something{/if} I was looking at using the parameter search, but you can not use the title field, it is only works with custom fields in an entry.

If anyone has any ideas on how to compare the logged_in_username to the title entries of a channel and if they match to send the user to a certain template. Thanks

       
Rob Allen's avatar
Rob Allen
3,105 posts
3 years ago
Rob Allen's avatar Rob Allen

You could try comparing the logged in member ID with the entry author ID, inside the channel entries tag, something like this:

{exp:channel:entries ...}

{if logged_in_member_id == author_id}
  you are the author
{/if}

{if author_id == logged_in_member_id}
  you are the author
{/if}


{/exp:channel:entries}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.