User Profile Settings / Profile Picture Change

scraghty

Sep 1st, 2024 07:42 PM

Pluggin away and am currently trying to fix functionality in the User Drop Down.

When I click "settings" Error Call to undefined function profile_field() "{!! profile_field('text_area', 'about') !!}"

I see wave.php has 'profile_fields' => [ 'about' ],

what connections are not being made correctly? deleting {!! profile_field('text_area', 'about') !!} from profile.blade allows settigns page to be viewed but obv about is not fucntional.

globals has issue with autoloader C:\Projects\D486WEBSITE> composer dump-autoload Generating optimized autoload files Class Wave\Helpers\WaveKeyValueConvertible located in ./wave/src/Helpers/globals.php does not comply with psr-4 autoloading standard (rule: Wave\ => ./wave/src). Skipping. Class Wave\Helpers\WaveKeyValueHelper located in ./wave/src/Helpers/globals.php does not comply with psr-4 autoloading standard (rule: Wave\ => ./wave/src). Skipping. Class Wave\Helpers\WaveKeyValueTypeHelper located in ./wave/src/Helpers/globals.php does not comply with psr-4 autoloading standard (rule: Wave\ => ./wave/src). Skipping.

GPT is telling me: Your User model extends from Wave\User, which indicates that it inherits functionality from the Wave package's User model. However, the profile() method, which the profile_field() function relies on, is not defined in this User model.

bobbyiliev

Sep 2nd, 2024 01:40 AM

Hi 👋

Which version of wave are you using? And what is the PHP version that you are using?

That function is defined here and already exists:

wave/src/Helpers/globals.php#L86

Did you make any changes to that view which could have caused the problem?

- Bobby

scraghty

Sep 2nd, 2024 02:49 AM

PHP 8.2.2 and looks like Wave 2.1.2...

looks like only difference of globals is my build has namespace Wave\Helpers; at the top the git reference does not.

The settings page opens fine if I delete that reference to profile_feilds "about"

Report
1
bobbyiliev

Sep 2nd, 2024 12:31 PM

Hi there,

And what is your composer version as well? I've not been able to reproduce this locally so maybe it is somehow related to your Windows environment.

What you could try is to just match the psr-4 standard as shown in the error that you are getting, eg move the there wave related globals in separate files as follows:

  • Wave\Helpers\WaveKeyValueConvertible should be in wave/src/Helpers/WaveKeyValueConvertible.php.
  • Wave\Helpers\WaveKeyValueHelper should be in wave/src/Helpers/WaveKeyValueHelper.php.
  • Wave\Helpers\WaveKeyValueTypeHelper should be in wave/src/Helpers/WaveKeyValueTypeHelper.php.

After that run composer dump-autoload and then give it another try.

Let me know how it goes.

scraghty

Sep 2nd, 2024 07:15 PM

The problem was, I must have added "namespace Wave\Helpers;" at the top of the globals.php. The online repo version did not have this. I don't remember how it got there, but after replacing the globals.php with the online repo version. The settings page loads correctly now.

However I'm still getting autoload warnings. Should I split them into the individual files as suggested or leave as is? I imagine the globals should work as is since that's how you wrote it. So am I missing something for it to work?

Composer VS = 2.7.7

PS C:\Projects\D486WEBSITE> composer dump-autoload Generating optimized autoload files Class WaveKeyValueConvertible located in ./wave/src/Helpers/globals.php does not comply with psr-4 autoloading standard (rule: Wave\ => ./wave/src). Skipping. Class WaveKeyValueHelper located in ./wave/src/Helpers/globals.php does not comply with psr-4 autoloading standard (rule: Wave\ => ./wave/src). Skipping. Class WaveKeyValueTypeHelper located in ./wave/src/Helpers/globals.php does not comply with psr-4 autoloading standard (rule: Wave\ => ./wave/src). Skipping.

bobbyiliev

Sep 3rd, 2024 04:04 AM

Hi,

Ah yes it makes sense that adding the namespace would cause the problem!

For the warnings, the answer that I shared above should be enough to fix them. Did you try it out?