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
2
votes
1answer
26 views

Craft's control panel search function returning inconsistent results

When I search for titles of entries in the Craft control panel, I get odd results: I have an entry called Fake Story about the Economy. If I search for that exact title, I get no results. If I ...
2
votes
1answer
22 views

Pass params to transform function of Transformer class in split Transformer class

I have transformer like down below in the element API. 'transformer' => 'MyTransformerClassName', Or 'transformer' => new MyTransformerClassName(), I am going to pass a param like $user ...
2
votes
1answer
37 views

Craft 2 FormBuilder 2 equivalent plugin in Craft 3

Is there any plugin equivalent to Craft 2 FormBuilder 2 plugin in Craft 3? My Craft 2 website forms are built with FormBuilder 2. I upgraded the website to Craft 3, but FormBuilder 2 is not working. I ...
2
votes
1answer
36 views

Finding the correct actions url

struggling to decipher how to link a plugins controller to an action route. The docs say to use "https://pluginfactory.io/" to scaffold one, but what it generates is a different structure to what the ...
2
votes
1answer
43 views

How to return a hierarchical list of a site's page structure using the ElementAPI

I'm experimenting with using Craft in a headless way and am successfully using the Element API to return all the data required to show individual pages. However, to be able to show sub navigation and ...
2
votes
1answer
32 views

How to get users with birthday today in plugin/module?

How does one retrieve users from Craft3 DB whose birthday is today? Birthdate field type is Date/Time. Have a working PHP/MySQL example, but unsure how to port this to Craft3 syntax. $sql = '...
2
votes
1answer
47 views

Checking the link type from a LinkIt field returns the whole path

I'm doing a project in Craft 3, there are many types of links so I installed the LinkIt plugin. I'm facing problem with this because I didn't find a method to check link type. If I use {{ entry....
2
votes
2answers
315 views

Depreceated warning after Craft 3 CMS updated to 3.1.31

Message: The defineComponents event on CraftVariable has been deprecated. Use the init event to register custom components instead. Origin: /vendor/craftcms/cms/src/web/twig/Extension.php:1026 ...
2
votes
1answer
32 views

Is there a way to see a fields variant relation in templates?

To clarify; if I have a disabled variant, and I'm looping through categories (colors) on each product like {% for variantColor in variantColors %}...{% endfor %} which makes it still show up in the ...
2
votes
2answers
134 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
1answer
63 views

Craft 3 Image quality is terrible after asset upload from admin panel

After I upload an asset (png), the image loses quality. I changed the defaultImageQuality from its default value of 82 to 100 but didn't make a difference. I can't add these assets via FTP as I need ...
2
votes
1answer
40 views

How to run function after plugin installed?

How can I run a function when my plugin is installed? I tried SafeUp in migrations but it doesn't work.
2
votes
1answer
90 views

Cannot access email section of settings

I somehow can't access the email section of settings; /admin/settings/email Argument 1 passed to craft\helpers\MailerHelper::createTransportAdapter() must be of the type string, null given, called in ...
2
votes
1answer
16 views

Paginate entries ordered by a custom date field

I'm trying to paginate a bunch of events based on their start date. The order part is working correctly, but each consecutive page just loads the exact same entries. My code: {% set events = craft....
2
votes
1answer
92 views

Multi-site - Setup remote asset volume to store assets on a per site/folder basis

We've got a Craft 3 (3.1.25) multi-site setup with three sites: Corporate (default) Brand A (brandA) Brand B (brandB) For this install there's 3 users setup with the following access to the sites. ...
2
votes
2answers
88 views

my vendor/craftcms/cms folder delete automatically after every update or install

I was on version 3.1.22. As usual, I wanted to install the update on Craft CMS 3.1.23. So I clicked Install and got this error: Status: Error But that was not all ... My complete vendor/craftcms/...
2
votes
1answer
301 views

Craft 3 best way/steps to create a login client area in frontend

I have to make a website that needs an user area with login. In that area users should be able to upload to admin area or download files from admin area. Each user has its own account that is ...
2
votes
1answer
67 views

How can additional custom fields be added to the Sites settings?

In Craft 3 Sites, there are some default fields like language, handle, etc. I would like to add additional fields. Is this possible. Specifically, I want to add an Image field so we can add a flag ...
2
votes
1answer
172 views

Unable to Access “Settings” in Backend

So I've created a boilerplate for my web development company using Craft. However, I'm encountering so much inconsistency across different machines. I recently set up a new website at my public ...
2
votes
1answer
75 views

Craft Commerce 2 - extend Order details page

Let's say we're on the order details page with the 3 tabs - Order Details, Transactions, Status History How do I add an extra tab with content? Craft V3 / Commerce V2 Thanks
2
votes
1answer
44 views

relatedTo() only on one field?

I have a Product entry type that contains a field for Components (which are also products) and a field for Related Products (again, also Products). I want to be able to find a parent product from a ...
2
votes
2answers
71 views

How do I prevent a controller from creating unwanted routes?

I have a custom module that is adding sections to the CP, like this: // Register CP routes Event::on( UrlManager::class, UrlManager::EVENT_REGISTER_CP_URL_RULES, function(craft\events\...
2
votes
1answer
46 views

How to set index page as parent of a structure

I don't know if it's possible, but what I would like is to have a structure with 3 levels linked to a single entry that would act as the index. The problem is the examples I've seen are only with 1 ...
2
votes
1answer
433 views

Moved Craft 3 site to new server and getting “No primary site exists” error

I moved a Craft 3 site to a new server. The previous server was a plain vanilla Ubuntu 16 LTS LAMP stack. The new web server is a Bitnami Ubuntu 16 LTS with a LAP stack (no local MySQL). In the new ...
2
votes
1answer
100 views

Auto login user after password reset via a plugin in Craft3

Unlike in Craft2, there doesn't seem to be a way in Craft3 for a plugin to automatically login a user after a password reset. In Craft2, a plugin could listen for users.onSetPassword to determine ...
2
votes
1answer
82 views

How to set view path for rendering email templates?

Trying to send an email Craft::$app->setViewPath('/Users/stian/dev/site.com/templates/'); Craft::$app->mailer->compose('confirmation.twig', ['orderId' => $orderId, 'customerId' => $...
2
votes
1answer
191 views

How to deploy website from dev to staging from localhost to remote server using composer

I want to upload all my Craft files along with the database to an Ubuntu server using composer. This server is an EC2 instance of AWS. Thanks for the help!
2
votes
1answer
293 views

Is it possible to filter entries based on entry table field values?

I have an entry called "reviews" and within reviews I have a table field with several values. I would like to use the field values to display entry listings in a particular way. First: I would like ...
2
votes
1answer
62 views

Order products by lowest product variant

Currently using Craft Commerce 2. I was wondering if it's possible to order products by the lowest priced variant. I have tried something along the lines of this, but it doesn't do anything ...
2
votes
1answer
74 views

Craft 3 Plugin not returning custom field value

I am trying to get the value of a custom field in entries, but I can't seem to get it to grab that value. I'm assuming I'm pulling it too early or too late, otherwise I have no idea. I can pull the ...
2
votes
1answer
89 views

Updating matrix field from font-end with $entry->setFieldValue() pulls in Cp bundle on save

I have an entry with a matrix field which I'm updating from front-end. The update works fine, but when the (font-end) page reloads after submitting the form, the CP bundle assets get included (...
2
votes
1answer
816 views

Call function from plugin in template

In craft 2 I had a simple plugin that I used to run some php code. I could call the function like this. {{ craft.pluginname.functionname }} However I have been unable to do the same thing in craft 3....
2
votes
1answer
56 views

Craft CMS 3 data structure advice for vehicle make, model, trim, year tagging

Hi i really would like some advise on best practices on setting up some data for my Craft APP. Most of my documents will be linked to vehicle make/model/trim/year. EG Audi A5 Sport 2009-2016 and/Or ...
2
votes
1answer
221 views

Impossible to invoke a method (“limit”) on an array

I recently upgraded a site from Craft 2 to Craft 3, so I'm trying to figure out what was deprecated and caused this error. At the top of the page I have this {% set solutions = craft.entries....
2
votes
1answer
57 views

How can I only allow authors to edit their own entires via front-end?

I have a front-end form that registered users can log into and edit entries. I am checking for the correct user group, then also checking for the permission: {% if currentUser.isInGroup('myGroup') %}...
2
votes
1answer
279 views

How can I set new user accounts to pending status in a Craft 3 module?

I have the following code in my site module: Event::on( User::class, User::EVENT_BEFORE_SAVE, function (ModelEvent $event) { /** @var User $user */ $user = $event->...
2
votes
1answer
124 views

Craft 3 - Cache tag increasing number of database queries

I have a question about the {% cache %} tag with Craft 3. I am reading this article (https://nystudio107.com/blog/the-craft-cache-tag-in-depth), and trying out implementing the tags; however, when I ...
2
votes
1answer
313 views

Working locally after cloning Craft 3 from Hyperlane

I'm trying out the recommended Hyperlane hosting with Craft CMS. After installing on Hyperlane, I then clone the repo on to my local machine and run 'composer install'. That runs fine, and I create a ....
2
votes
1answer
206 views

Craft 3 query children of sub categories

Just wondering how to only query the children on subcategories. For example... Food ├── Fruit │ ├── Apples │ ├── Bananas │ └── Oranges └── Vegetables ├── Brussels sprouts ├── Carrots ...
2
votes
1answer
109 views

Separate User Groups / forms

I have two forms on my site, one that you can use to sign up as a registered user that allows you to view content through out the site and participate in steps (tests) etc. The second form is a form ...
2
votes
1answer
517 views

Ajax Load more Posts

On my blog i need a load more button on the bottom of each section that simply loads more posts when clicked. Everything i look at people are using other javascript libraries. I just want to use ajax ...
2
votes
1answer
98 views

Sprout Forms - Can't save front end entry edits

This this might be a bug but want to ask here first in case I'm missing something minor. Description Trying to front edit a Sprout Form entry that was created in the front end. I'm using the same ...
2
votes
1answer
48 views

Limit not working

I'm trying to show the next post that's not in the array of articles "completed". I have the next articles showing that haven't been completed, however i can't set a limit to just show one article. ...
2
votes
1answer
316 views

Is there a way to check if entry is selected in relationship?

This project has a lot of user stuff. I need to display display different sections based on if the current user is in a field. Is there a better/faster way than looping through and checking if every ...
2
votes
1answer
58 views

Display Backend User Entries on Front end

I have the user submitting to a function that adds entries to a field called completed. It basically adds entries to each user showing the admin who has completed what. I'm trying to figure out how ...
2
votes
1answer
93 views

Adding to default classes in a macro

I'm fairly new to using macros and haven't found anything online regarding this — sorry if this is a possible duplicate post. I've created a macro with 7 possible parameters but on different ...
2
votes
1answer
59 views

Craft 3 Field Plugin not firing $view->registerJs in entry versions

I am creating a Craft 3 plugin. It seems to work fine when editing regular entries but when I open a revision the JS I'm injecting using the below doesn't appear on the page. $view->registerJs($js,...
2
votes
1answer
110 views

How to get the unverifiedEmail value of a user after a change email request?

The currentUser.unverifiedEmail variable, which is public, is always empty on front end even after email change. I thought it was a bug. I contacted Craft support about this, and here is Brad's ...
2
votes
1answer
96 views

Adding or overriding locales in Craft 3

I am looking for a way to add new locale files or override existing ones. Basically a Craft 3 version of this: https://craftcms.com/support/adding-additional-locales I've tried the way described ...
2
votes
1answer
318 views

CSS will not load Craft 3 + MAMP

I'm a UX designer with some front end skills (though a complete novice with server config and Craft). I'm hoping someone can help me with something that seems rather basic. Setup: Mac Book Pro ...