get User Image and Name

Closed
Vanguard - Advanced PHP Login and User Management Vanguard - Advanced PHP Login and User Management October 29, 2018
Login to reply
Milos Stojanovic Support Agent
6 years ago

Hey Torsten,

Ok, great! I'm glad that you found the solution and that you got it working now. :)

Kind regards,
Milos

Torsten Högel
6 years ago

I got it working by using a .htaccess with 

RewriteRule ^users/(.+)?/?$ https://app.go-on.io/upload/users/$1 [NC,L]

Best Regards

Torsten Högel
6 years ago

So, Maybe you could help me understand this ... my settings of CORS should allow me a picture from https://app.myurl.com/picture.png from https://myurl.com/picture.png right?

Or did i got this one wrong?

I'm really confused about all this ...

Milos Stojanovic Support Agent
6 years ago

Hey Torsten,

Unfortunately, I cannot help you with the server configuration since it is outside the scope for the support I provide.

Just make sure that your server has properly set CORS headers and there should not be any issues while displaying images across different domains.

Regards,
Milos

Torsten Högel
6 years ago

I did that but i don't know what the error is ... My Plesk server is running apache

Milos Stojanovic Support Agent
6 years ago

Hey,

Yes, something like that. It depends on your web server of course.

I'm not sure if you can do it for "/upload/user" only, but I don't see any issue if you do it for the whole domain as in the example you sent.

Regards,
Milos

Torsten Högel
6 years ago

You mean like this: Header set Access-Control-Allow-Origin "example.com"

Do you know if it's possible to do "example.com/upload/user" instead of the whole domain?

Best Regards

Milos Stojanovic Support Agent
6 years ago

Hey Torsten,

You can easily solve this by setting up CORS inside your web server settings to allow serving images from different domains and subdomains.

- Milos

Torsten Högel
6 years ago

Though the IMG is working if it's from extern (e.g. Gravatar) but if it is uploaded it shows me the picture here: app.go-on.io but the domain go-on.io gives me an error because the picture is uploaded to https://app.go-on.io/upload/users/qNl4C1kGgsGO0wP8.png and not to https://go-on.io/upload/users/qNl4C1kGgsGO0wP8.png ... is there an easy fix for that?


Best Regards

Milos Stojanovic Support Agent
6 years ago

When you have that code included at the top of the page, you can echo out anything you want about the currently authenticated user. The same as you would do it inside the Vanguard's source code.

For example:

echo Auth::user()->present()->name;

or

echo Auth::user()->present()->avatar;

Regards,
Milos

Torsten Högel
6 years ago

Hey there is it possible to get under a page with

<?php require_once '/var/www/vhosts/go-on.io/app.go-on.io/extra/auth.php'; ?>

at the top, with some php echo or so the image and name of a user if logged in?