简体   繁体   中英

How to add Gravartar To Open Cart Admin Area

Hi I am trying to add a gravatar image to my header of my open cart admin area I can only get the default image of gravatar image to show up.

I am after trying to get it so when admin user logged on it will show up with there gravatar image if user has uploaded there image to gravatar profile

As i said can only seem to get the default image of the gravatar.

the files I am working with are open cart admin controller/ header.php and view/header.tpl

In view file admin / view / template / common header.tpl

<li>
<a href="" class="text-center">
<img src="http://www.gravatar.com/avatar/<?php echo md5(strtolower(trim($user_info['email']))); ?>" /> 
</a>
</li>

Not sure why not picking up admin users email and gravatar image.

There are 2 possibilities:

  1. Email don't have a gravatar image.
  2. Empty email id - generates: http://www.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e - default gravatar image.

From your comments I understood that you're passing an empty value for email.

Update system/library/user.php as below:

After: $this->username = $user_query->row['username'];

Add: $this->email = $user_query->row['email'];


Before: public function getUserName() {

Add:

  public function getUserEmail() {
    return $this->useremail;
  }

Change : $user_info['email'] in your code

To : $this->user->getUserEmail();

Have a niceday :) !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM