Hot answers tagged

2 votes

How to get user info in a custom plugin task?

If you know the user ID at the point the task is created, you can pass it in as a property of the task class. Here's an example queue task class: class myQueueJob extends BaseJob { // Public ...
user avatar
  • 1,151
2 votes

How to get user info in a custom plugin task?

Are you running this task as part of a web request or a console request? The craft\console\User indicates that it's a console request. For console requests, there's no current user, as the console ...
user avatar
  • 6,030
2 votes
Accepted

Increment automatically the number field

You can create a controller command that does that and call it in set intervals from a cronjob. The controller command will find the element that's storing your number, increment the number by the set ...
user avatar
  • 6,030
1 vote

Craft CMS admin pages return ERR_EMPTY_RESPONSE locally

You're likely receiving this error due to a problem with your Apache configuration. A likely scenario is you're missing the .htaccess file or it could have an error. You should check your Apache logs ...
user avatar
1 vote
Accepted

Outputting Opening Hours in SEOmatic

Ended up just repurposing code from the plugin templates. This is working fine for me: {% if seomatic.site.identity.localBusinessOpeningHours|length %} {% macro day(value, day) %} <tr> ...
user avatar
  • 854
1 vote

How can I change variant price in Craft Commerce 2 form

Something like this should do the trick. use craft\commerce\events\LineItemEvent; use craft\commerce\services\LineItems; use craft\commerce\models\LineItem; use yii\base\Event; Event::on( LineItems::...
user avatar
1 vote

Craft 3 Feed-Me Auto run all feed

It's worth mentioning now that for more recent versions of FeedMe, the console command natively supports an all flag. https://docs.craftcms.com/feed-me/v4/feature-tour/trigger-import-via-cron.html#...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible