miltann / Echelon-2

Echelon 2 is the updated and redesigned version of Echelon 1, originally made by xl8or and improved by Eire.32
6 stars 9 forks source link

Fix issue with client linking when having multiple games #20

Closed sepgh closed 4 years ago

sepgh commented 4 years ago

We faced an issue where 2 clients from 2 different games had same client id, lets say @3 and when we clicked on one of them, we were redirected to the other one.

For example, we had @3 player1, @3 player2, and when we clicked on player2 to see client details, it opened player1 profile.

I have noticed clientLink() function in functions.php creates those links and if you pass a third argument, $game_id to that method, this issue will be fixed. But none of the callers passed the third argument. Therefore I altered that method to use global $game(which will be read from cookie or query string, based on the data in setup.php) to fill $game_id only if $game_id is empty.

This completely fixes issue for normal cases and we are using it at Repz now. One common issue is that if you open different echelon tabs with different clients, each tab might mess with the data from other tab. It rarely happens and I believe its avoidable.


Also, a few typos were fixed :)