If you're using Am_Lite to control access to your own PHP scripts is there any way to show the users avatar in a: PHP: <img src='".Am_Lite::getInstance()->avatar."' height='40px' width='40px'/> sort of way?
Yes, it is possible to do: PHP: <?php if ($u = Am_Lite::getInstanse()->getUser()) : ?><img src="<?= Am_Lite::getInstanse()->getRootUrl() ?>/avatar/<?= $u['avatar'] ?>" /><?php endif; ?>
Thanks. However $u['avatar'] seems to be returning the upload_id from am_upload. How can I get from there to the actual filename and the correct path within /data/ please?
Yes, it is upload_id but if you try to open url http://example.com/amember/misc/avatar/upload_id You will see avatar image. I see I made mistake (miss 'misc' part in url) in my previous post. The code should be: PHP: <?php if ($u = Am_Lite::getInstanse()->getUser()) : ?><img src="<?= Am_Lite::getInstanse()->getRootUrl() ?>/misc/avatar/<?= $u['avatar'] ?>" /><?php endif; ?>
Hi that worked great thanks, although just in case anyone else needs it getInstanse should be getInstance. I can now replicate the user block on my protected php pages.