Solo Dolo
Solo Dolo

Greetings,

I'm transitioning into developing themes and plugins for OctoberCMS (after developing for WordStress).

I typically always develop on my local machine since I live in an area with literal 56k dial up connection speeds.

With this being said - How can I remove the // calls to gravatar?

It stops the backend pages from loading fully which is pretty much the most annoying thing in the world. When hopping onto the only connection I have available, everything loads in an instant except for gravatar, which loads indefinitely.

I understand this isn't an issue for everyone, however, I'm against using Gravatar all together in ANY development project I work on.

How can I remove all calls to Gravatar?

To me - this is like being forced to have an Amazon Alexa in your house, monitoring all audio, when you'd just rather not have one at all and never plan on using the technology . . . but there it is. HAHAHA

Any help would be appreciated. Even if it's just a quick fix so I can develop in peace.

I'm looking forward to contributing themes and plugins over the coming year!

Much love.

P.S: There is a dead thread mentioning this in 'Front-end Development' and reference to the issue on Github from 2019, however, I can't find an actual solution to the issue. Just constant talk AROUND the issue. I can think of a few things to try, however, I'm afraid of breaking things, hence looking for a fix from these official forums.

mjauvin
mjauvin

You'll want to create a custom backend skin for this since there is currently no option to remove this.

Check this: https://octobertricks.com/tricks/creating-custom-backend-skins

You can override only the modules/backend/layouts/_mainmenu.htm partial and remove the call to getAvatarThumb()

mjauvin
mjauvin

Alternatively, in your plugin's boot method, you can add this code snippet:

        \Backend\Models\User::extend(function ($model) {
            $model->bindEvent('model.afterFetch', function () use ($model) {
                $file = new \System\Models\File;
                $model->avatar = $file->fromFile('/path/to/local/file');
            });
        });

this will override the gravatar URL returned here:

modules/backend/models/User::getAvatarThumb()

mjauvin
mjauvin

This should work for any October Install:

        \Backend\Models\User::extend(function ($model) {
            $model->bindEvent('model.afterFetch', function () use ($model) {
                $file = new \System\Models\File;
                $path = base_path('modules/backend/assets/images/favicon.png');
                $model->avatar = $file->fromFile($path);
            });
        });
alxy
alxy

Can't you upload a regular avatar in the backend (from file)? I think, the gravatar image is only the default fallback.

mjauvin
mjauvin

@alxy maybe he could, but I think he has trouble loading the backend in the first place because of gravatar... so the code snippet I provided will prevent the call to gravatar.

1-6 of 6