Blogging application bug: logged in user's avatar does not update in real time - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Blogging application bug: logged in user's avatar does not update in real time (/showthread.php?tid=76024) |
Blogging application bug: logged in user's avatar does not update in real time - Ajax30 - 04-07-2020 I am working on a basic blog application with Codeigniter 3.1.8 and Bootstrap 4. The application has user (author) accounts. There is a problem with displaying the photo (avatar) of the logged-in before the session is destroyed, due to the fact that I display the avatar from the session (header.php view): Code: <?php if ($this->session->userdata('user_avatar')): ?> That seemed like a good idea at the time, an easy and logical implementation of the avatar display, until the update problem revealed. Of course, I have to logout and login again to see my avatar in the website's header, as I had to admit. In the model I have: Code: public function update_user($avatar, $id) { What would be an easy to implement bugfix? RE: Blogging application bug: logged in user's avatar does not update in real time - php_rocs - 04-07-2020 @Ajax30, When do you activate session variables? When do you turn off the session variables? RE: Blogging application bug: logged in user's avatar does not update in real time - jreklund - 04-08-2020 If you store it that way, no other user can see your avatar. You need to always look for it (and cache the page of course!). |