So my site has the ability to follow other users, but for some reason I can follow myself when logged in to my profile and when logged out. What do I need to do to prevent this.
I also have a leaderboard system for the most followers that works. The screenshot is of what happens when I hit follow when logged out
Make sure to exclude yourself (the current User) from the datasource of Users you’re displaying - so either add a constraint on the search for users to not return the current user (unique id <> current user's unique id
), or use :minus item
to remove the current user from the returned results.
If you wand to do the same thing when users are not logged in, you’ll probably need to use cookies for that. You can set a cookie to store the user’s User Entry on their computer (store their Unique ID for example), then exclude that from the search or list of Users you display.
Or, do you mean that you don’t want to allow non-logged in users to follow anyone (which would make more sense)? - in which case you need to set up some conditionals on the display elements and workflows relating to following other users, to disable them when a user is not logged in.