I haven’t worked with the stats function much as is with LeagueManager because I could never get it to work quite right. To be honest, my thought was that it needed to be looked at for a long-term plan for making it usable for long-term stats and not just season-by-season.
I’ll have a look at it to see if I can come up with any issues that can be quickly fixed, but I don’t think it makes any sense to spend a lot of time on it as is, I think it’s going to end up being re-written and it’s one of the top priorities that I have.
With that said, let me ask two questions:
1). Are you using the latest version of LeagueManager (3.8.8 or 3.8.8.1)?
2). Do you have ProjectManager installed?
I’ve got the 3.8.8.1 one. I do have ProjectManager installed but I’m pretty sure that the I had the error even before.
I’m fairly proficient with other languages but I haven’t touched PHP in a long time and wouldn’t want to mess things up. What I can gather from a superficial look is that it’s trying to slice or lookup $field which isn’t an array in that particular case and choking up on that.
I’ll have a look tonight, see if I can duplicate the problem and get back to you…
Thanks for the help.
I don’t want to waste your time though and I think that I found where the problems lies.
It might be a bug depending on how you look at it but it’s most likely a very niche case. Anyway, the problem was on how the constants are defined in the defineConstants() function and how xampp translates them, or more correctly Windows. More precisely, what happens is that this bit:
pluginPath: "<?php echo LEAGUEMANAGER_PATH; ?>"
translates to something like this:
C:\xampp\htdocs\wordpress/wp-content/plugins/leaguemanager
and the parser obviously chokes as the the backslashes aren’t escaped.
I have modified the function to output the proper string and it seems to work just fine.
It’s something of a platform problem really. 🙂
Nice work…
When you mentioned XAMPP, I had a feeling there was going to be a setting of sorts that would come up.
I think we have a few others having the same problem, can you explain what you had to do to get the paths right?
Thanks
Sorry for the delay. What I did was what I explained above, altough I’m not entirely sure that those other users are having this exact problem.
I checked what the error was from the browser console, saw that there was a parsing error on that line:
C:\xampp\htdocs\wordpress/wp-content/plugins/leaguemanager
And proceded simply to replace the echo that generates it, I mentioned the exact line before, with a:
C:/xampp/htdocs/wordpress/wp-content/plugins/leaguemanager
Since I don’t have a general exposure to the codebase I’m still not entirely sure why the software would expose such absolute paths to the page, even with an OS filesystem reference, but it was as simple as modifying backslashes to avoid the automatic string escapes.
A long-term solution, which I guess should be preferrable, would be assuring that, when on Windows, the first part of the path gets properly escaped or that at least the slashes are replaced when necessary.
I hope I made myself sufficiently clear or I can explain it again.
Yes, very clear…
I use XAMPP on my Mac, but will install it on my PC and do a few tests to see how to fix things.
Thanks