Skip to main content

Questions tagged [craft3]

For use with questions relating to the Craft 3 version of Craft CMS, including the Beta and RC releases.

Filter by
Sorted by
Tagged with
3 votes
6 answers
2k views

How to check an elements elementType

In Craft 3, I've got a service function that I'm passing either an 'entry' or 'category' element into. I'd like to know how to differentiate between the possible element types; This kinda of works: ...
1 vote
1 answer
165 views

Updating private repo plugins from admin?

Is it possible to update private repo plugins from the admin at all? Would love that functionality, especially for smaller projects that are installed where there's no CLI access.
0 votes
0 answers
29 views

Reduce Unnecessary Database Entries in Craft CMS After Changing Propagation Settings

In one of our Craft CMS projects, we have accumulated around 100 subsites over the years. This has resulted in a large number of unnecessary database entries due to incorrect propagation settings. Our ...
3 votes
1 answer
507 views

Displaying errors on frontend user forms

I'm trying to get some feedback for the user on registration when the username already exists but I don't know in which object the errors are. I use the form they provide in the docs: https://docs....
2 votes
1 answer
32 views

Craft 3 site – users suddenly cannot login to back-end

I built a site with Craft 3 in 2018. I have barely touched it since (or worked with Craft, to be honest). The front-end is fine and the end-users have been using it without problem until last week ...
0 votes
0 answers
19 views

No plugins will install on cloned site - Craft 3

I am in the process of cloning a Craft 3 site to a new server (from GoDaddy to SiteGround). I have set up the new craft space and imported the database, assets, templates, etc., which all went ...
1 vote
1 answer
351 views

Craft Setup 3.6.5.1 with MYSQL with SSL version 5.7.29

I'm trying to install Craft version 3.6.5.1 with MYSQL version 5.7.29 from Azure. While setup it fails with the following error Testing database credentials ... failed: SQLSTATE[HY000] [9002] SSL ...
1 vote
1 answer
36 views

How can I display a message to the user that the field is filled in incorrectly?

I have a form: <form method="POST" enctype="multipart/form-data"> {{ csrfInput() }} {{ actionInput('families/families/start') }} <input type="text" name="...
1 vote
1 answer
118 views

How to extend or override CP template?

I need to add some custom condition to the top siteMenu selector. Template file with top menu: vendor/craftcms/cms/src/templates/_elements/sitemenu.twig Block with this menu: vendor/craftcms/cms/...
0 votes
0 answers
11 views

Dynamic recipient in Freeform plugin Pro

I'm trying to set up a process with Freeform and I haven't managed to do it. I'd like your input on feasibility. To prevent spamming, I don't want content editors to add email addresses in plain text ...
1 vote
1 answer
56 views

How can I check the size of the file uploaded via the form?

I have a simple form on the website: <form method="POST" enctype="multipart/form-data"> {{ csrfInput() }} {{ actionInput('families/families/start') }} <input type="...
1 vote
2 answers
56 views

How can I add an element with an image to a section from the site?

please tell me how to add an entry that contains an image to the desired section. I use Craft CMS 4.9.6. At the moment, I have a form on my website: <form method="POST"> {{ ...
0 votes
1 answer
43 views

Redirect control panel access via .htaccess

I have a website that is hosted on a subdomain, let's say: https://subdomain.maindomain.nl. My craft content is in the maindomain/public_html/subdomain/git-module To make it work on the subdomain I ...
0 votes
0 answers
23 views

500 Status error with Devmode Off

My site loads perfectly fine when I have devMode set to true, but when I keep everything the same except turning devMode to false, it returns a 500 error (probably a server issue). I am really at a ...
1 vote
1 answer
34 views

How to disable X-Rewrite-URL Header in Craft CMS 3?

I'm trying to disable the X-Rewrite-URL header from my Craft CMS site. I have already tried disabling it via the secureHeaders setting in the general settings, but it still doesn't work. Remove 'X-...
1 vote
1 answer
422 views

Headless Craft CSRF

I have a site that is using Craft CMS headless and React. There are a few forms that need to post to controllers but I'm not sure how to set up the CSRF tokens and keep it secure. Can anyone advise ...
2 votes
1 answer
71 views

Disable Two-Step Publish Workflow?

I recently updated to Craft v3.6, which appears to have changed the publishing workflow to require first publishing the draft, then saving the file in order to get back to the entries list. Is there ...
0 votes
1 answer
251 views

An unknown error has occurred in asset reindex

I am getting the error: An unknown error occurred for each file in a folder when I try Update Asset Indexes. The folder is a local folder that is outside of webroot. The files just contain json data....
1 vote
2 answers
2k views

How can I list Entry Types of a single Section?

The following outputs all sections and their entry types, but I'm struggling to work out how I output only the entry types from the "blog" section. {% for section in craft.app.sections.allSections() %...
1 vote
1 answer
879 views

ERR_EMPTY_RESPONSE when accessing order data (MAMP)

I've got a local installation of Craft 3.0.37 and Craft Commerce 2.0.0-beta.15 running on MAMP. When completing an order, an empty response is given by the browser. The same thing happens when trying ...
1 vote
2 answers
23 views

Error when calling renderPdfForOrder() in Module

The error I'm receiving is: Call to a member function getRenderLanguage() on null My Code (Edit - simplified): $mergeService = new Merger(); $batchFileName = 'VAT-' . $country . ( $date ? '-' . $...
1 vote
1 answer
27 views

How to batch delete obsolete PDF files from site assets

I inherited a CraftCMS project and there are currently close to 1200 obseletes pdf documents, still present in the site assets. The documents are stored in an S3 Bucket. What is the best way to do ...
1 vote
1 answer
282 views

Update Cart’s address ID from plugin

I want to try and stop Commerce 3 creating a new customer address if it’s a duplicate of an existing one. As an example, a store selling digital products has a checkout form that simply asks for the ...
2 votes
1 answer
1k views

how to get request url?

I'm trying to get url from request, {{ craft.app.request.url }} but the uri is chinese, like "localhost/測試", it print out "http://localhost/����" did i miss some setting in craft ...
1 vote
1 answer
447 views

How to disable the Javascript "actions/queue/run" on frontend?

After upgraded our Craft from 3.3 to 3.4.14 we have noticed that there is a new Javascript on the footer of the homepage (frontend) that runs "index.php?p=actions/queue/run". We run the tasks via ...
1 vote
1 answer
1k views

Craft 3: admin is showing "500 Internal Server Error" (apache) after fresh install

Just successfully installed a fresh copy of Craft CMS via web browser method under: http://kultursprung.org Frontend is visible but the admin is showing raw Apache error 500 after fresh install: http:...
1 vote
1 answer
51 views

Eager-loading content and merging queries

sorry if the following question is too basic, but I've spent quite some time digging now so I decided to reach out for help. Is 250 DB queries too many? I have a Neo field "modules" that can ...
1 vote
1 answer
33 views

Can't use matrix.one() and matrix.all() at the same page

i try to get blockMatrix value with different way(.one() & .all()) in the same page (this page consists of several templates) but the result is weird. Here how i do it: i have a blockMatrix("...
16 votes
2 answers
5k views

How to save Matrix data programmatically in Craft 3

How can you programmatically save an entry that has a Matrix field in Craft 3? (Something like this gist for Craft 2)
1 vote
1 answer
57 views

Event on new user created

please can someone help me with this snippet of code I have written. I basically would like to check if a user is new. However, the below only triggers when an existing user is saved, not when a new ...
2 votes
1 answer
97 views

Deployment strategy that removes tables from uninstalled plugins

I have read the following article best practices for deployments. https://craftcms.com/knowledge-base/deployment-best-practices here the following is recommended: git pull composer install php craft ...
1 vote
1 answer
33 views

How to get field values by specific field type from all Entries?

I am trying to get all values of a specific field type from all entries. (ex.: craft\fields\PlainText) Is there an easy way to get these values ?
0 votes
0 answers
20 views

Set entries section to orderby date entered

I have a page on a site that is showing entries with this code: {% extends '_layouts/default.twig' %} {% macro productItem(product) %} {% set filterClasses = [] %} {% for material in product....
1 vote
1 answer
32 views

Craft 3 / 4 CP: Restrict users to specific user groups in Users view

I need to restrict access to users (not entries) of say AdminGroupA to be able to access and manage users of UserGroupA in the Control Panel. Right now, the user AdminGroupA can browse all of the ...
2 votes
2 answers
1k views

How can I get cookies that were set in javascript from a twig template? [NEW]

This question was already asked a few years ago, and the way of doing it was through a plugin. I was wondering if there is a way of doing it just using Craft and Twig. I set up a cookie using ...
2 votes
1 answer
967 views

Craft 3: How to get Volume by handle?

How can I get the details of an asset volume in Craft 3, if I only know the handle? I found the Volumes and the Assets service, but I believe none of them provides a method for that purpose. The only ...
1 vote
2 answers
263 views

Sending E-Mails via SMTP with email address that contains special characters

I got a problem with some smtp settings in my craft 3.5.14. The domain of my client uses special characters like (ö, ä, ü) and therefore for their email addresses. In this case my client only use the ...
1 vote
1 answer
39 views

Why does my redis keep shutting my site down

I uploaded a new site (migrated) to a new server. 3 times now I've had my redis maxout memory. This causes my site to show an error 500. When I flush the redris the site goes back up immediately. I ...
1 vote
1 answer
165 views

Can't Update CraftCMS

I'm currently using Craft CMS 3.7.9. When I go into Utilities -> Updates (which shows a 5 so there must be updates), a red message appears at the top that says "A server error has occurred&...
2 votes
1 answer
53 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 // ========================================================================= /** ...
0 votes
0 answers
99 views

Amazon S3 Setup for Craft 3

I'm attempting to setup a craft site with AWS S3/ Cloudfront. I found this tutorial (from some time ago): https://nystudio107.com/blog/using-aws-s3-buckets-cloudfront-distribution-with-craft-cms I'm ...
4 votes
1 answer
275 views

Prevent Redactor from stripping tags like <span>

Is there any possible way to prevent <span> tags from being stripped from a Redactor field? I've tried all I can using custom Redactor and HTMLPurifier configs to no avail. Basically what I'm ...
0 votes
0 answers
36 views

Getting an internal server error on an inherited Craft 3 site

I was asked to host a Craft site, my client knows I've never done it before and is letting me explore a bit. The file that were sent over were customized, so I'm mucking through it. I uploaded the ...
1 vote
1 answer
242 views

How to find next sibling from entry order of parent entries field

I have an index of projects that uses a standard entries field to select multiple entries to display and also provides a custom order (different to their Structure order). This is my "Projects&...
1 vote
2 answers
147 views

Stop customers from increasing line item

I have a site where the owners want to stop customers from ordering more than 1 type of item. The Twig logic is already in place to stop any forms showing that would allow customers adding more than ...
1 vote
2 answers
541 views

How-to display a dropdown field with optgroups?

The display of a dropdown without optgroups is defined: {% set field = craft.app.fields.getFieldByHandle('<FieldHandle>') %} <select name="fields[<FieldHandle>]"> {% for option ...
1 vote
2 answers
768 views

WARNING: heuristic fragment matching going on! when querying matrix fields or any query with multiple fragment types with Graph QL using Nuxt Apollo

I am relatively new to using Craft Headlessly and am trying to query matrix fields with Nuxt JS and it's Apollo module. I have discovered, that although the graphQL queries work in the GraphiQl ...
1 vote
1 answer
221 views

CraftCMS Image Transform returning NULL on asset.url when stored on AWS S3 Bucket

So i'm using Craft as a headless CMS with a React frontend. When querying assets on a S3 bucket and applying a transform to them in my GraphQL query the URL response is NULL. This isn't the case when ...
0 votes
0 answers
74 views

Multiple errors attempting to migrate MariaDB Craft CMS 3 database to PostgreSQL via pgloader. Alternatives?

I've been at this for a couple days now and it's not looking good. I'm trying to migrate a Craft CMS 3.9.5 (latest) database running on MariaDB to Postgres using pgloader 3.6.10. I've attempted this ...
1 vote
1 answer
153 views

Session token error/missing after server switch

I am duplicating a Craft 3 site from a production environment to a dev environment (local with MAMP Pro). On the "new" dev site I can't log into the control panel. The credentials are valid ...

1
2 3 4 5
39