If you are login with Javascript you can access the current user using the following command:
Parse.User.current()
I don't thing that you can access the same user from PHP because you didn't login via the PHP SDK.
You have 2 options:
- Login the user via the PHP SDK using the following code (from parse php docs). This is the recommended approach since you are doing it on the server.
try {
$user = ParseUser::logIn("myname", "mypass");
// Do stuff after successful login.
} catch (ParseException $error) {
// The login failed. Check error to see why.
}
and then you will be able to access the current user like this:
$currentUser = ParseUser::getCurrentUser();
- Login with JavaScript SDK and access to user with Parse.User.current()
My POV
if your is already work with PHP what i think you should do is to use Parse PHP SDK on the PHP side and trigger the PHP functions from Javascript using ajax requests.
There are some workaround solution that will allow you to have the current user on both sides (PHP and JavaScript) but then you will need to deal the current user session token and this can make your app a bit complicated.
So if you want to get the current user from PHP to JavaScript you can execute a ajax call to PHP and from PHP you can return the current user object or you can just do everything on the PHP side which is also fine.
</div>