Hi,
I am trying to show the user name on the user interface of the ownCloud user who is currently logged in. For this I am trying following line of code in upload.php file. The following line of code is actually calling a function from User class. Then after calling I am just echo to the recieved name.
echo OCP\User::getUser();
But
Actually I want that when I upload any file then before uploading I want to show the name of the logged in user on top of page. But I m unable to see.
How to fix this?
Can you post more information about your PHP script ?
Are you writing an ownCloud app that does this or a theme ? Or did you edit the ownCloud PHP code directly ?
What is it exactly that doesn't work ? What happens exactly when you call OCP\User::getUser()
? Is it throwing an exception ? Is it returning an empty value ?
Sir I am just writing my command in upload.php file, which is already present inside owncloud directory. Actually uplaod.php file uploads any type of file in the database. So In that file I am writing this line of code.
echo OCP\User::getUser();
Actually I just want to show name on the top of the display. But when I add this line of code in upload.php file and then I try to upload the document then It neither throw exception nor It return a value. Rather It goes sleep, Then how can I imagin error? Is there any way to display the name of the user who is currently logged in to the ownCloud?
Thanks
Okay, I see.
The upload.php is called using Ajax, so its output isn't displayed anywhere. You can't simply echo
stuff from such PHP scripts.
The name of the currently logged in user is usually already displayed on the top-right of the page:
so I don't understand why and when you want to display it again.