Skip to main content

Questions tagged [craft4]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5 votes
1 answer
2k views

Uncaught TypeError Dotenv Create on updating to Craft CMS 4

Just updated to Craft 4, migrated my /web folder over as well as my /assets folder and trying to load the index page gives me the following error. Any help would be great as I can no longer access my /...
JMKelley's user avatar
  • 1,416
4 votes
3 answers
525 views

Craft 4 upgrade. Entry throwing 'craft\models\EntryDraft doesn’t exist' error in admin

After upgrading to Craft 4 a few entries are throwing this error in the admin (Locally): craft\models\EntryDraft doesn’t exist or doesn’t extend/implement craft\base\ElementInterface Not all do this ...
Martin's user avatar
  • 43
4 votes
2 answers
953 views

Craft 4: using the new laravel collections and related methods (in a performant way)

I am working on a website for a radio that publishes its programs as podcasts with episodes. Each of the 30 or so programs potentially has a lot of episodes. Each entry in the episodes channel has a ...
Jérôme Coupé's user avatar
3 votes
1 answer
326 views

Contact Form is not working anymore since upgrading from Craft 3 to 4

After upgrading to Craft 4 non of my Craft Forms are working... getting the error "Symfony\Component\Mime\Address::__construct(): Argument #2 ($name) must be of type string, null given, called in ...
Marcel Boer's user avatar
3 votes
2 answers
342 views

Delete Entry on Front End Form (Craft CMS 4.x)

Hello — been reading up on how to do this and there are some posts for Craft 2, 3 — but I'm not sure what's out there works for Craft CMS 4. I am using the following JS to delete an entry. However I ...
Adrian's user avatar
  • 437
3 votes
1 answer
1k views

Upgrade to Craft 4

Anyone succeeded in upgrading from Craft 3 to Craft 4 ? Before staging the changes on our dev server, I tried it locally without success. Although it seems pretty strait forward, I updated all plugins ...
Sylvain Tremblay's user avatar
2 votes
2 answers
2k views

Questions about Craft 4 release and licenses

Being busy rethinking an existing website to rebuild in Craft I just found out Craft 4 was announced september last year. Some of the new features, like nestable Matrix fields in particular, are very ...
Friksel's user avatar
  • 180
2 votes
2 answers
33 views

How do I authorize/register visitors on the site?

I use Craft CMS 4. Please tell me, is it possible to authorize users in Craft CMS? In general, the goal is this: I want to show some elements on the site only to authorized users. For example, ...
Dimi's user avatar
  • 303
2 votes
1 answer
456 views

Craft 4: How to programmatically attach fields to entry type tab

I'm in the process of upgrading a plugin from Craft 3 to Craft 4. When the plugin is installed it creates some fields and attaches them to an entry type. The way it was done in Craft 3 is: Get the ...
Matanya's user avatar
  • 472
2 votes
1 answer
297 views

Parent based Selectable Entries Condition

In the Craft CMS admin, I have an entries field on a page, and I want to limit the selectable entries available to only the child pages of the current entry. To achieve this, I set the Selectable ...
Mike Niland's user avatar
2 votes
2 answers
177 views

Nitro: how risky is it to dev using MariaDB and then go live with MySQL?

Nitro does not support MySQL for Apple Silicon, but you can use MariaDB interchangeably. I'm using an Apple Silicon computer, and my server run with MySQL only. However, as read in the Craft Database ...
Romain P.'s user avatar
  • 1,852
2 votes
1 answer
60 views

Get list of user logins

I would like to get a list of every login of a user. I know I can get a certain user with craft.users() but as far as I have seen, I get data for lastLoginDate only. Is there a way to get a complete ...
obs's user avatar
  • 551
2 votes
1 answer
52 views

_layouts/cp.twig cannot be found

I have a module that's meant to add a section to the CP. class Reports extends Module { // Public Methods // ========================================================================= /** ...
cherrykoda's user avatar
  • 1,114
2 votes
1 answer
50 views

Calling a Function From Private Plugin

Writing my first plugin. Scaffolded with Generator and is active (appearing in admin). This is where most tutorials leave you on your own so hoping to get some help calling a simple function in my ...
Jason McKinney's user avatar
2 votes
1 answer
132 views

New Laptop - Developing Existing Project Locally

I've got a craft cms 4 website that I've been developing locally on my old PC and I've also got hosted with Servd Host. I've just got a new mac and I'm trying to get my project running locally on it ...
George Bleasdale's user avatar
2 votes
1 answer
47 views

200 new lines in elements_sites per entry

I noticed that the ID number of my entries has increased to almost 50.000, but I have around 1.000 entries and 2.000 files. I understand that other things like categories also affect that number, but ...
H.W. Sanden's user avatar
2 votes
1 answer
50 views

Multisite - Save the draft only to the site it was created in

I'm working on the multisite in Craft4 - 2 identical sites, but the text is in different language. I have a section with the Propagation Method set to Save entries to all sites enabled for this ...
Michal Bulla's user avatar
2 votes
1 answer
161 views

OPcache extension Warning

I updated my Craft installation to 4.5.3, right? And then I noticed this warning pops up in the system report, saying, "The OPcache extension is recommended in production environments." ...
JBrew30's user avatar
  • 102
2 votes
1 answer
244 views

Mutagen in DDEV Making Craft CMS Slow to Propagate

This is related to a previous question. When I have mutagen enabled in DDEV, it takes around 20 seconds for any changes to propagate. Even things as simple as updating a few lines of text in a twig ...
darkbasic's user avatar
2 votes
1 answer
135 views

Resaving Matrix Blocks skips because of "not loading its content"

We recently updated one of our biggest projects to Craft 4. And today I tried to resave all the matrix block with resave/matrix-blocks but was greeted with the following behaviour: Does anybody have ...
Leonardo's user avatar
  • 471
2 votes
1 answer
267 views

Installing plugins in fresh Craft4 install causes error of identifying as older plugin version

I tried upgrading to Craft 4 (4.2.5.1), and Feed Me and Super Table would not upgrade properly, causing Craft to crash. When installing the compatible versions, old version numbers populate in the db, ...
jstevens79's user avatar
2 votes
1 answer
227 views

Migrating a Craft 4 instance from MySQL to PostgreSQL

I've managed to convert a fairly basic Craft 4 MySQL db to PostgreSQL using the pgloader tool, which came with it's own auth related issues when running PSQL v14+ instance - see https://github.com/...
Rich D.'s user avatar
  • 45
1 vote
2 answers
1k views

Craft 4 Custom Variables - From Env > General.php > template

Been trying for a wee while, but no joy so far. This worked in Craft 3, but not in Craft 4. It's a CSS cache buster, I basically want a variable to set in env, then taken into general.php[caveat] and ...
John Macpherson's user avatar
1 vote
2 answers
113 views

Unable to install plugins in Craft 4 production

I am upgrading from Craft 2 to Craft 4 and this is the first time I'm deploying a Craft 4 website. It was entirely unclear how to do this, as just uploading the files to an FTP server does not work ...
Branko's user avatar
  • 13
1 vote
3 answers
199 views

Debug Toolbar Not Displaying on frontend

I just updated a site to Craft 4 and the debug toolbar no longer shows on the frontend, but does show in the CP. Have not had this issue with other sites that were updated. Any ideas?
Roi Agneta's user avatar
  • 1,463
1 vote
1 answer
260 views

PHP version problem when upgrading to Craft CMS 4

I am upgrading a site from Craft CMS 3 to 4. I develop the site on ddev with docker desktop on Windows. When running composer update on PHP 7.4 and docker 2 on ddev the following happens: $ ddev ...
nitech's user avatar
  • 679
1 vote
1 answer
207 views

Feedme Only running Cron jobs when logging in

I've created a cron job that runs my Feedme feeds on an hourly basis. The issue is, when logging in I see all the jobs queued up, but they only start running when I actually login to the dashboard, is ...
JMKelley's user avatar
  • 1,416
1 vote
1 answer
482 views

Updating to Craft 4 breaks plugin settings: must not be accessed before initialization

I maintain a plugin. Inside this plugin's composer.json, extra>handle is set to pizza (not the real name). In one of the controllers, the following code is executed: $apiKey = Plugin::$plugin->...
Paul Hübner's user avatar
1 vote
4 answers
295 views

Craft 4 doesn't support other languages yet?

After installing a fresh version of Craft 4, the setup didn't allow me to specify the site language fr-FR as it did with the previous version. I had to accept the default en-US. I thought that I would ...
fdelaneau's user avatar
  • 123
1 vote
2 answers
38 views

Can I search multiple element types in one query?

Yup, this is a repeat of a question from 7 years ago. The github discussion seems to have died out 2 years ago. I can't do weird array merging due to pagination which accepts an element query. So it ...
Amanda Lutz's user avatar
1 vote
1 answer
40 views

"entry.isEditable()" not working on Craft CMS 4

Do the "isEditable" property of Entry still exists? Whats the best way to achieve the same functionallity in Craft 4? {% if entry.isEditable() %} After I upgraded from Craft 3 to 4, all my &...
Atimoda's user avatar
  • 31
1 vote
1 answer
121 views

Craft CMS 4: Update without proc_open

I've recently managed to upgrade my Craft installation from 3.9.1 to 4.5.0. During the upgrade process I had a number of times where the update process from within the admin GUI 'failed' or at least ...
Marty's user avatar
  • 11
1 vote
1 answer
202 views

Run craft up command in deployment pipeline without prompts

I am deploying a Craft website with Bitbucket Pipelines. Basically what it does is spinning up a container that runs composer install and builds my CSS and JS with webpack. The vendor folder and js/...
Matthias's user avatar
  • 301
1 vote
2 answers
560 views

Craft 4, CKEditor 5, image resizeOptions not showing in image toolbar

I'm experimenting with all the CKEditor 5 config options and I like how the docs have the image resize (https://ckeditor.com/docs/ckeditor5/latest/features/images/images-overview.html#image-contextual-...
Amanda Lutz's user avatar
1 vote
1 answer
60 views

Error when Project.yaml Migration from Local

I'm getting the following error when migrating the project folder over to my live environment. Never had this before and unsure what to do. error: SQLSTATE[42S02]: Base table or view not found: 1146 ...
JMKelley's user avatar
  • 1,416
1 vote
1 answer
234 views

After upgrade from Craft 3 to 4: frontend error: Array to string conversion

After upgrading from Craft 3 to Craft 4, the backend is accessible but the frontend displays the error: PHP Warning – yii\base\ErrorException Array to string conversion And points to many files: ...
BrokenCode's user avatar
1 vote
1 answer
98 views

Craft installation fails with SQL error (PostgreSQL)

I am trying to install the Craft CMS (Version 4.4.1) on a VM in the Azure Cloud with PostgreSQL 13.9 as managed Azure Service. The error i'm running into is the following: *** failed to install Craft: ...
Boris's user avatar
  • 41
1 vote
1 answer
140 views

Craft 4 Building a Plugin not saving all properties

After following the "How to build a plugin" from the official CraftCMS docs, I've started extending the Control Panel Template from 1 to multiple fields, all are of the same type string and ...
funkysoul's user avatar
  • 113
1 vote
1 answer
641 views

How to send email from Craft 4 custom plugin/module?

I want to send an email using crafts mailer in Craft 4. I've seen this post: How to send email from Craft 3 custom plugin? But now I need this adapted for craft 4. Unfortunately I did not succeed so ...
Merc's user avatar
  • 211
1 vote
1 answer
60 views

How to check read-only mode in plugin?

I have written a plugin and it listens to different events to run some tasks. Now if the app is in "read-only mode", I do not want some of these events to run: class MyPlugin extends Plugin {...
7ochem's user avatar
  • 165
1 vote
2 answers
299 views

Defining a domain for each site for both production and local - craft 4 multisite

I have a craft 4 multi site, each site has its own domain. In the cp settings for each site I have entered each domain. This works fine for the production environment but is obviously useless when ...
George Bleasdale's user avatar
1 vote
2 answers
101 views

Postgres DB Schema not referenced when accessing web url but craft cmd works fine?

I'm having a strange issue when accessing a craft instance via the web yet the craft cmd works fine. When resolving the URL it's throwing a 503 and the logs are showing an issue with fetching data ...
Rich D.'s user avatar
  • 45
1 vote
2 answers
658 views

Craft 4: How do I get field by handle?

In Craft 2, I used to be able to do this: https://craftcms.com/docs/2.x/templating/craft.fields.html#getfieldbyhandle-handle {% set body = craft.fields.getFieldByHandle('body') %} {{ body.instructions ...
Tchick's user avatar
  • 105
1 vote
2 answers
184 views

How to programmatically enable Pro trial in Craft 4?

In Craft 3, I setup a base build for my team which had a bash script. At one point in the script I was able to enable a Craft Pro trial license like so: echo 'Craft::$app->setEdition(Craft::Pro)' | ...
Plum Duffer's user avatar
1 vote
1 answer
1k views

Craft4 stream_copy_to_stream(): Argument #2 ($to) must be of type resource, bool given

As mentioned in the title, I'm not able to upload any files in Craft4. I created a filesystem and a volume which is connected to the filesystem. In the assets-field settings I added the volume. I have ...
mcoze's user avatar
  • 41
1 vote
1 answer
23 views

Section: dynamic Entry URI Format

My solution works, but I seem to have some caching issues ... so I'm unsure weather my solution is useful or not? Entry URI Format of Section (Channel): {{craft.entries.id(530).one().uri}}/{slug} ...
Marc 's user avatar
  • 194
1 vote
2 answers
30 views

Craft 4.8.0 : Hide some entries to a group of user

I have somes entries : POI-1 POI-2 POI-3 I have two groups of users : Group-1 Group-2 Needs : The Group-1 can edit only POI-1 The Group-2 can edit only POI-2 and POI-3 I see that I can set this ...
emilie zawadzki's user avatar
1 vote
2 answers
31 views

ImageTransform Focal Point Cache Busting

I have a Question about image transform focal point behavior. Twig templating or with php. Getting the url of an asset with a transform $asset->getUrl('transformer') If i am understanding the ...
Leonardo's user avatar
  • 471
1 vote
1 answer
99 views

Upgrade from 4 to 5 error

When running the php craft up command as one of the last steps for the upgrade I get the following error. *** applying m230511_215903_content_refactor Exception: A field layout element has a duplicate ...
Matthias's user avatar
  • 301
1 vote
2 answers
31 views

Webhook only firing when I log in

I've set up a Webhook in Craft 4 that triggers a Zap. The Sender class is craft\commerce\elements\Subscription and the event name is afterSave. When the trigger action happens (a user subscription), ...
Graham Bennett's user avatar