Jump to content

JayGee

Members
  • Posts

    278
  • Joined

  • Last visited

Everything posted by JayGee

  1. Ah perfect thanks - all makes perfect sense now you've spelled it out to me - reloading the user object solves the issue ? And yes - addressing the security issues above is in my todo list - this was just a prototype based on examples on this forum and it was bugging the hell out of me why the image wouldn't load first time!
  2. This was my original guess. Query string is a good idea but doesn't seem to make any difference. ? I've tried as follows: action="./?<?=substr(base64_encode(mt_rand()), 0, 15);?>"
  3. I'm trying to implement a front-end image upload form for user profile pictures, to a field called 'profile_picture'. The code is based on the various examples found around these forums but isn't yet 100% right. The form successfully submits the image to the server and updates the field in the dashboard. When you submit the firm, the page reloads and uploads the image but the template still loads the old image path (now broken path as the old image has been removed). I can only get the new image to show if I hit enter in the address bar forcing the page to reload. Any ideas? Is it a caching issue, or something to do with the order of the script? It makes no difference if I call the image after the upload form. <?php //Display current user image $userImg = $user->profile_picture->first(); echo '<img src="'.$userImg->url.'">'; $upload_path = $config->paths->assets . "files/avatar_uploads/"; $f = new WireUpload('userimage'); $f->setMaxFiles(1); $f->setMaxFileSize(1*1024*1024); $f->setOverwrite(true); $f->setDestinationPath($upload_path); $f->setValidExtensions(array('jpg', 'jpeg', 'png', 'gif')); if($input->post->form_submit) { if(!is_dir($upload_path)) { if(!wireMkdir($upload_path)) throw new WireException("No upload path!"); } $files = $f->execute(); if ($f->getErrors()) { foreach($files as $filename) @unlink($upload_path . $filename); foreach($f->getErrors() as $e) echo $e; } else { $user->of(false); $user->profile_picture->removeAll(); // wirearray (line added by @horst: explanation is three posts beneath) $user->profile_picture = $upload_path . $files[0]; $user->save(); $user->of(true); @unlink($upload_path . $files[0]); } } ?> <form class="forum-form" accept-charset="utf-8" action="./" method="post" enctype="multipart/form-data" > <input type="file" id="attach" name="userimage" accept="image/jpg,image/jpeg,image/gif,image/png" /> <input type="submit" name="form_submit" value="Submit"/> </form>
  4. I'm going to use their email for login, but planning to use their username for display around the site so thought it would be nicer for them to choose their own. If solving this becomes too much of a PITA I'll probably just settle for displaying first name and first letter of their last name instead. E.g. Joe Bloggs becomes JoeB.
  5. I already tried changing that setting - but it doesn't seem to make any difference to whether or not the name field shows?
  6. Hi, I'm just setting up @ryan's LoginRegister module for a project. Just wondering is there a way to make the PW user 'Name' field included in the registration/profile output? It's available to me in the drop-down and I've made the field user editable too.
  7. Ok cool thanks - had read that thread and was secretly hoping for 'hidden option c' that I hadn't yet come across that would allow me to keep the file in templates without relating it to a page!
  8. I'm trying to make an AJAX call from within a template to a php script within my templates folder, but I'm getting a 404 from all URLs. Is there a proper way to directly address scripts within PW templates? I've read it will work in the site root, but I'd rather keep all the code together if possible.
  9. Ok - I think I've got this half-way solved. I found a similar discussion on this site: https://forum.bubble.is/t/solved-fb-login-domain-problem/3267/36 March 2018 Facebook have changed their app policy to use Strictmode for redirect URI's. So you need to enter https://YOURDOMAIN.COM/login-facebook/ into the 'Valid OAuth Redirect URIs' field. I think you probably also now need be using https to make it work. So I get the correct FB authorisation screen when you visit the /login-facebook page. The remaining problem now is that the redirect after FB authorisation isn't working. I get a 500 error - FB seems to be trying to send me back to https://YOURDOMAIN.COM/login-facebook/ rather than the page I've chosen in the module settings. Any ideas? Edit: The above works fine - I was trying to map the FB profile image field direct to a ProcessWire image field which you can do and this was causing the error.
  10. I'm having this problem too - have you figured it out yet? I'm wondering if Facebook have changed something their end as the instructions for setup don't quite tally with what I'm seeing on the App configuration screen.
×
×
  • Create New...