User placeholder user picture if not set? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: User placeholder user picture if not set? (/showthread.php?tid=77976) |
User placeholder user picture if not set? - jnar - 11-13-2020 Hello. I extended myth auth to have user picture, so I can acces that property like this: PHP Code: <?= user()->profile_pic ?> What would the best approach display a stock image if picture is not set? Should i validate right in the view like this? PHP Code: <?php Or it would be a better practice to do this in the controller and just recieve in the view the pic like a variable already validated? RE: User placeholder user picture if not set? - jnar - 11-13-2020 Ok nevermind I just created a helper function to handle this |