I have a contributor list in different pages on my website, when printing contributor list if logged in user is same with a contributor in list I should print “YOU”. For every user check this does not make sense. What is best practice for this situation.
Note that : There are a lot of items in website. When you go to details of an item you see contributor list.
Perhaps you could distribute the load and put that logic in your page itself using jQuery. Let’s say I’m logged in and my user ID is stored in a variable on the page called user_id. If you include the user ID in each element of the contributor list, you could do something like this…
That would find every list element containing the user id and append the string (YOU) to it. It’s still done on every page, but now the workload is distributed to each user’s browser rather than on the server. Unless you have thousands of contributors, performance shouldn’t be an issue.