Open VIRUXE opened 8 years ago
Is there any temporary fix for this? I would like to have notification email settings enabled by default.
Is there also a way to update all existing users to have these settings?
@pixeldrift64 Apart from some manual SQL queries, I am afraid there isn't at the moment.
Are you interested in sending a pull request? We can guide you in the right direction if you need help...
It'd be awesome to be able to change this. My community hasn't been getting emails when I reply to their posts without explicitly following.
Discussion here: https://community.jaredwolff.com/d/430-possible-to-get-a-discord-going
Edit: looks like this extension will fix the issue: https://extiverse.com/extension/fof/default-user-preferences It works great for new users but doesn't apply to already existing users though..
@jaredwolff .. I think a command might solve this. Oh look at this, I made an example for you 🪄
https://github.com/luceos/flarum-extender-examples, see specifically the readme in that repository and:
Call with php flarum user-preference --help
eg:
php flarum user-preference --all
The command needs a preference key and a new value. Sorry I need to go off, let me know if this works.
@luceos you're the man. I'll give it a shot
I feel like I'm very close:
# php flarum user-preference
PHP Fatal error: Uncaught ReflectionException: Class "App\Command\DefaultUserPreferenceCommand" does not exist in /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php:877
Stack trace:
#0 /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php(877): ReflectionClass->__construct()
#1 /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build()
#2 /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php(694): Illuminate\Container\Container->resolve()
#3 /var/www/community.jaredwolff.com/vendor/flarum/core/src/Foundation/InstalledApp.php(112): Illuminate\Container\Container->make()
#4 [internal function]: Flarum\Foundation\InstalledApp->Flarum\Foundation\{closure}()
#5 /var/www/community.jaredwolff.com/vendor/flarum/core/src/Foundation/InstalledApp.php(119): array_map()
#6 /var/www/community.jaredwolff.com/vendor/flarum/core/src/Console/Server.php(36): Flarum\Foundation\InstalledApp->getConsoleCommands()
#7 /var/www/community.jaredwolff.com/flarum(24): Flarum\Console\Server->listen()
#8 {main}
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [App\Command\DefaultUserPreferenceCommand] does not exist. in /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php:879
Stack trace:
#0 /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php(758): Illuminate\Container\Container->build()
#1 /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php(694): Illuminate\Container\Container->resolve()
#2 /var/www/community.jaredwolff.com/vendor/flarum/core/src/Foundation/InstalledApp.php(112): Illuminate\Container\Container->make()
#3 [internal function]: Flarum\Foundation\InstalledApp->Flarum\Foundation\{closure}()
#4 /var/www/community.jaredwolff.com/vendor/flarum/core/src/Foundation/InstalledApp.php(119): array_map()
#5 /var/www/community.jaredwolff.com/vendor/flarum/core/src/Console/Server.php(36): Flarum\Foundation\InstalledApp->getConsoleCommands()
#6 /var/www/community.jaredwolff.com/flarum(24): Flarum\Console\Server->listen()
#7 {main}
thrown in /var/www/community.jaredwolff.com/vendor/illuminate/container/Container.php on line 879
Running php 8.0 and Flarum 1.6.3
Make sure to read the readme, this means in your composer.json
add the autoload
information and run composer dumpautoload
afterwards so that composer can resolve the Command you created in app/Command
.
Ahh! composer dumpautoload
was the missing piece. May be worth a mention in the Readme. :)
Ran these guys below.
php flarum user-preference --all postMentioned true
php flarum user-preference --all userMentioned true
php flarum user-preference --all followAfterReply true
Looked like followAfterReply
worked. The email related ones didn't. Looking here to see if I can glean anything from how it was done there.
Found the correct format here: https://github.com/flarum/framework/blob/fc4d5e3d434c12b848e6780831c1a137c1b70ad1/framework/core/src/User/User.php#L848
Ran
php flarum user-preference --all notify_postMentioned_email true
php flarum user-preference --all notify_userMentioned_email true
And that did the trick!
Thanks @luceos :smile:
Just noticed this was still open.
@tobyzerner marked https://github.com/flarum/framework/issues/1152 as completed, with no reference commit/PR. But @jaredwolff apparently was experiencing the same "issue" a year ago.
I haven't touched Flarum in years. What would be the consensus for this now?
Pretty long title but I think it pretty much sums my request.
I ask this because I would like for my users to be notified by default whenever they are @mentioned.
Flarum is awesome. Thank you for your efforts. :)