How to distinguish whether it's the same one

14 Oct '17, 11:47 PM
1,736 Views
No Forum Badges

I have different users in database, they have different usernames and passwords that can login to a page. The page will have posts inside it.

I want to discriminate whether the login user matches the author of the posts or not. How can I make it?

 
x 0
Follow
Answer Answer at this question and get points!
Forum Expert - Level 8

Hi,

can you explain better your requirements?
In fact the model is different depending on the goal you want to achieve.
For example, let's suppose you want to exclude from the posts list those having the logged in user as author. In this case you have to model a relationship role condition on the posts list on the "is author" relationship, and then pass to this condition the id of the logged in user. You can retrieve the logged in user through a get component on the User context parameter.

Let's suppose that you want to highlight in the list the posts belonging to the current user.
In this case you have to work on the layout level, creating a custom template for the list; in this template you compare the author of the post with the user User context parameter value in order to decide whether to highlight the post or not.

As you may understand, it's important to have in mind a clear requirement to decide which is the best way to proceed.

 
x 0
Answer at this question and get points!