jerect Posted November 11, 2016 Share Posted November 11, 2016 hi!, im new and i want to add a gravatar image to the assigned admin in the client area projejct view i have this <img class="gravatar" src="http://www.gravatar.com/avatar.php?gravatar_id={$email|md5}&size=100" alt="Avatar" title="Avatar for {$name}" width="100" height="100" /> it works if i edit the "$email" and add manually a email adress, but i do not how to obtain the email of the admin assigned to the project, so please can you help me? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted November 11, 2016 Share Posted November 11, 2016 add {debug} command in that file you are editing, then open/reload it again in browser, separate browser with list of all available variables can be found there, if admin email isn't in this list you may use ActionHook:ClientAreaPage to query "tbladmins" DB table and get the information you need, then return it to Smarty 0 Quote Link to comment Share on other sites More sharing options...
jerect Posted November 12, 2016 Author Share Posted November 12, 2016 hi, thank you so much, the variable is not available so i have found in the the documentation and i don't know if i am doing right. the hook contain this: <?php use Illuminate\Database\Capsule\Manager as Capsule; # get admin data add_hook('ClientAreaPage', 1, function(){ $getAdmin = Capsule::table('tbladmins')->where('id', '=', $project.adminid)->get(); }); and the tpl includes this: <img class="gravatar" src="http://www.gravatar.com/avatar.php?gravatar_id={$getAdmin->email|md5}&size=100" alt="Avatar" title="Avatar for {$name}" width="100" height="100" /> but is not working. am i right? 0 Quote Link to comment Share on other sites More sharing options...
jerect Posted November 12, 2016 Author Share Posted November 12, 2016 add {debug} command in that file you are editing, then open/reload it again in browser, separate browser with list of all available variables can be found there, if admin email isn't in this list you may use ActionHook:ClientAreaPage to query "tbladmins" DB table and get the information you need, then return it to Smarty I have tried almost all the forms I have found in this forum, but none has worked, can you help me please? 0 Quote Link to comment Share on other sites More sharing options...
jerect Posted November 13, 2016 Author Share Posted November 13, 2016 OMG I MADE IT! this is the php: <?php use Illuminate\Database\Capsule\Manager as Capsule; add_hook('ClientAreaPage', 1, function($vars){ global $smarty; $product = $smarty->get_template_vars('project'); $getemail = Capsule::table('tbladmins')->where('id', '=',$product['adminid'])->select('email')->get(); return array("adminemail" => $getemail[0]->email); }); and the tpl <img class="gravatar" src="http://www.gravatar.com/avatar.php?gravatar_id={"{$adminemail}"|md5}&size=150" alt="Avatar" title="Avatar for {$name}" width="150" height="150" /> 1 Quote Link to comment Share on other sites More sharing options...
zomex Posted November 13, 2016 Share Posted November 13, 2016 OMG I MADE IT! this is the php: and the tpl Nice work it looks good, if gravatar support it I'd recommend loading the image via https:// to avoid breaking the SSL. 0 Quote Link to comment Share on other sites More sharing options...
jerect Posted November 14, 2016 Author Share Posted November 14, 2016 Nice work it looks good, if gravatar support it I'd recommend loading the image via https:// to avoid breaking the SSL. I will thanks 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.