Oct 23, 2024 00:49
1
Q: Redirecting to another page after a successful user log in

mzgSubject: Assistance with User Authentication for Page Access Hi, I’m having trouble implementing a solution to restrict access to a page so that only authenticated users can view it. In my previous content management system, I used a .htaccess file to redirect users to a login page. Depending on ...

Sep 21, 2024 00:19
1
Q: Best template strategies as alternatives to `return`ing variables with Twig Perversion?

Jonathan SchofieldThis may not be the best place for this, and quite probably I need to provide more context by way of example – so I will understand if it gets judged to be ‘not a proper question’ – but here goes… Background When I learned some years ago of Marion’s Twig Perversion plugin I found it to be a game ...

Sep 12, 2024 20:50
2
Q: How Can We Use the Native Matrix Block Copy Feature in Craft CMS 5?

Romain P.It seems that Craft CMS 5 introduced a new feature allowing users to copy, clone, and paste Matrix blocks natively, eliminating the need for third-party plugins like Smith. This was hinted at in various announcements, including from the developers of the Smith plugin, who mentioned that: Due to ...

Sep 5, 2024 00:59
1
Q: How do I toggle at content level Craft 5 Multisite

AzazelI am in the process of developing a Craft 5 MultiSite website where each site has its own domain, but they all use the same template. I have set all my fields to be translatable for each site. How can I switch in the CMS panel to edit the content of an entry for each individual site, considering ...

Jun 26, 2024 16:58
1
Q: Can you locate all the pages that a channel item has been added to?

AmyI'm looking to see if there is a way to locate all the instances/pages a channel item exists on in the CMS. In this situation we have a channel for call to action panels that can be added to any page created in the CMS. Is there a way to work out what all the pages are that the item is added to s...

May 3, 2024 03:36
1
Q: Recreate {% cache %} content without clearing first

Matthias Redl-MannWe have a setup where we use Craft's {% cache %} tag to improve performance of certain computing-cost-intensive pages. The expected way to do this is by using the {% cache %} tage and probably improve its usage with certain attributes like globally, using key, for and so on. The only problem: I h...

Apr 25, 2024 21:46
1
Q: Get all revisions of an entry on front end / with twig

obsI'm basically trying to get what has been answered for this questions. This code doesn't seem to work any longer since it has been solved about 8 years ago. Is there a way to get a list of all the revisions of an entry using twig? Further I would like to access the data of the revisions to show p...

Apr 12, 2024 21:17
1
Q: Local Storage with Sprig

JMKelleyI have a changing sort dropdown using Sprig, works great. Though, I'd like to save this sort order to local storage and pass it as the default to my sprig component. What's the best way to do this? Is there a way to directly pass a JS variable to sprig components? This is my parent: {{ sprig('_co...

Apr 4, 2024 06:20
1
Q: Craft 5, CKEditor accessing parent entry from partial

JasonCraft 5, CKEditor accessing parent entry from partial Is it possible to access the parent entry from a partial template being rendered from an embedded entry in a CKEditor field? For example, consider a "Page" entry type that has a "Copy" CKeditor field. The "Copy" field allows embedding a "Video"...

Mar 22, 2024 05:36
3
Q: Unable to find custom template when using a console controller inside a module

Arno RamonI'm creating my first module. Inside this module, I check a few entries for some conditions, and if all conditions are met, I want to send out a personal email. Everything worked, but I wanted to clean up my code and put the email body inside a template file so it's more organized. This is where ...

Mar 12, 2024 18:38
1
Q: Redactor RTE -> what about Craft 5?

Marc https://plugins.craftcms.com/redactor Redactor is still not available for Craft 5? If so, that's a major problem for my upgrade path to Craft 5. I know the CKEditor plugin, but that's not an option for me: See my other post: CKEditor 5: Paste plain text Has anyone further information?

Feb 17, 2024 22:44
1
Q: Deployment strategy that removes tables from uninstalled plugins

antdevI 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 up The problem here is if I have uninstalled a plugin that has tables they are not removed with the

Jan 28, 2024 00:12
1
Q: Replace the value of a table cell (inside a Matrix field)

supazuI have a Matrix field, and blocks have a Table field inside of them, with two columns: event and category. I want to now set anything with category 'A' to category 'B' via a module (listening to Entry::EVENT_BEFORE_SAVE). I've got it updating the value correctly, but it adds it as a new row, rath...

Jan 23, 2024 00:39
1
Q: Neo plugin -> Craft CMS Core ... is this idea still alive?

Marc With a look on https://craftcms.com/roadmap: I remember, there was a ticket to build a Neo alternative into the core of Craft CMS v5 (and a migration tool for existing projects with Neo). Unfortunately I can't remember the ticket ID or naming ... but it seems to have disappeared? I'm asking this ...

Jan 3, 2024 00:54
1
Q: evaluateDynamicContent() is disallowed

user3086053Bug while installing debug toolbar in Craft 4 latest version: An Error occurred while handling another error: yii\base\NotSupportedException: evaluateDynamicContent() is disallowed. in /craft/vendor/craftcms/cms/src/web/View.php:1884 in /craft/vendor/craftcms/cms/src/web/View.php error is thrown...

Dec 28, 2023 15:50
1
Q: _layouts/cp.twig cannot be found

cherrykodaI have a module that's meant to add a section to the CP. class Reports extends Module { // Public Methods // ========================================================================= /** * @inheritdoc */ public function init() { parent::init(); Even...

Dec 6, 2023 04:28
1
Q: My site has been hacked. I have managed to clean it up. But now, most of my links are looping back to the home page

Alex BrionesMy site was hacked by a Russian hacker. I know because the characters were Russian on one of the files he left. I have cleaned up the site, but many of the links are looping back to the home page. What can I do to fix this? Thanks I have Craft 2.3, php 7.1, mysql, and here is the site: camp.gsnor...

Nov 23, 2023 22:55
1
Q: Stop customers from increasing line item

JaytrixI 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 type, which is fine for when navigating between pages. If a customer opens a product on several ta...

Nov 13, 2023 21:40
1
Q: Craft + FeedMe update

Michal BullaI'm trying to update Craft to 4.5.10 which requires PHP 8.0.2+ but I have Feed Me plugin installed, which is using Cakephp 3.10.5, which requires PHP >=5.6.0,<8.0.0. Is it possible to update Craft to 4.5.10 without removing FeedMe plugin? Thanks

Sep 27, 2023 02:20
1
Q: Custom Element Type Documentation not working or confusing

user14370Following the docs on the offical CraftCMS website i'm not able to get "Native Layout Elements" saved. My field body is always empty. Any idea what i'm missing here? Relevant Part of Plugin base class <?php namespace tkf\craftfirebasemessaging; use Craft; use craft\base\Model; use craft\base\Pl...

Sep 20, 2023 13:51
2
Q: RCE in CVE-2023-418925: Can it be exploited without being logged into Craft?

MagnusDoes anyone know if the RCE vulnerability in CVE-2023-418925 (Github link) can be exploited without being logged into Craft? I have a couple of smaller sites that I'd rather not update right now.

Aug 24, 2023 19:36
1
Q: Run craft up command in deployment pipeline without prompts

MatthiasI 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/css builds are kept as artefacts to be deployed to the server. So far so good. However when I am do...

Aug 2, 2023 00:15
1
Q: control panel: bidirectional related entries // concatenate entries

Marc Is ist possible to "concatenate" entries? For example: You have five articles (A, B, C, D, E) ... might be a blog Editing the article A: A is related to C and D The relation should work bidirectional: Articels C and D know their relation to A automatically ... some kind of "this article got a re...

Jul 31, 2023 23:22
1
Q: How to manually import entries into Craft CMS?

brikasI have some entries saved in a JSON file with the standard format that is created with export functionality (expanded). How can I import the entries from this JSON file back to my CMS? Feed Me seems to be a complex streamline solution, but all I need is a single-time import. Craftimport only allo...

Jul 27, 2023 04:53
2
Q: Save Control Panel search filters? Craft 4

4midoriI love the new control panel search filters. However, I see no facility to save them, and nothing in the documentation. Is there way to do this?

Jun 26, 2023 21:34
1
Q: Generate an Image from Title

Michal BullaI would like to generate image automatically on entry save, using the entry Title and a specified image as a background. I was thinking to use the Preparse Field plugin, but it seems like it's not possible to use the Image Magick commands inside the Preparse fields. Imager X plugin is also not ab...

Jun 26, 2023 19:04
1
Q: Programatically enable an entry

supazuI'm creating to updating the title of some entries via a content migration, but this apparently doesn't work on disabled entries. So I'm trying to enable the entries to start, but that is also having no effect. Does anyone know why $entry->enabled = true; wouldn't work? Full code below. public fu...

Jun 22, 2023 22:07
1
Q: Get default field values on pre-existing elements

Eric Andersonrelated to How can I populate a dropdown via table field type using the default values? I created a table to be used for ordering a display via the order of the table, with a bunch of default values in place. When I apply the table to already existing categories, none of the default values displa...

Jun 15, 2023 14:44
1
Q: Get User ID before the user is created

supazuI'm creating users programmatically, and in some cases, they won't have an email address. In these cases, I would like to just set the email address to [email protected] where 1234 is the User ID. It's completely illogical, but is it possible to get the User ID at this point? Is there anything with...

Jun 12, 2023 19:55
1
Q: Product URL missing category slug on production site

nitechI upgraded a Craft CMS 3 site to version 4. The Product URI Format for my products look like this: When I run the site locally on ddev with PHP 8.0 the URL displays correctly: When I deploy it to production (Hyperlane), it is missing the category URL: Any idea why this is happening? Hyperlane ...

Jun 8, 2023 00:14
1
Q: Sprig: how to redirect to a URL after submitting to a custom controller?

Romain PoirierI have a multi-pages form which is submitting using Sprig plugin. The action is targeting a controller in a custom module. Each step of the form is loading using the current step stored in session. The end of this controller is returning the URL to redirect: return $this->redirect($entry->url); H...

Jun 6, 2023 23:39
1
Q: PHP version problem when upgrading to Craft CMS 4

nitechI 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 composer update Loading composer repositories with package information Updating dependencies Your requ...

May 18, 2023 04:05
1
Q: Search Entries for HTML Code

Document ServicesI'm trying to use the Admin interface to search entries with specific types of HTML code entered incorrectly by a client. What is the best way to do this? Searching for the html itself "<span" doesn't not yield correct results. The field with this text in is it search indexed. Thank you so much!

May 16, 2023 23:27
2
Q: How to use ajax call to retrieve data from craft cms entries to use in php application

AlyxI'm building a static webpage with php and Javascript. I have setup all my data in craft cms entries. I want to use ajax to retrieve the data from craft and just display it on my webpage. How do I do this?

May 16, 2023 00:54
2
Q: Yii2 not maintained?

emilie zawadzkiCraft is based on the PHP framework Yii2. I heard that this framework is less and less maintained. And yes, it seems to be the case if you go on contributor page : https://github.com/yiisoft/yii2/graphs/contributors Question to @pixeltonic : how do you think you will you manage it ? Thanks

May 12, 2023 01:34
2
Q: 200 new lines in elements_sites per entry

H.W. SandenI 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 it still seems high. I looked at the database and found that whenever I add an entry, around 200 ...

May 9, 2023 17:44
1
Q: Calculating loyalty from consecutive entries on a user

supazuI'm trying to calculate a 'loyalty' score on Users. I have an Entries field history, with Entries like 2023, 2022, 2021 etc. I want to calculate the number of consecutive years, going backward from the current year. So for example, a user with 2023, 2022, 2021 would have a loyalty score of 3. A u...

Apr 13, 2023 22:49
1
Q: Error when Project.yaml Migration from Local

JMKelleyI'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 Table 'gifdb.stc_18_button' doesn't exist The SQL being executed was: ALTER TABLE `stc_18_button` ...

Apr 11, 2023 18:59
2
Q: Generate a unique ID for each instance of a block from matrix field

Sean GI have a question regarding Matrix fields. I have a matrix field where one block will be used multiple times (around 4 or so) on each page. When that block scrolls into view I am firing a javascript event that triggers a CSS animation. Because I want this to fire each time one of these blocks scr...

Apr 11, 2023 03:42
1
Q: Adding purchaseables to cart with custom matrix field

Peter AdamsWhen I follow the documented process of populating custom fields with an update cart call, I'm able to get values for lightswitches and text fields to populate just fine. I cannot, however, get the submitted fields to carry over to the order/cart when I try to populate them into a Matrix field. I...

Mar 21, 2023 21:41
1
Q: After upgrade from Craft 3 to 4: frontend error: Array to string conversion

BrokenCodeAfter 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: Such as: in /app/vendor/craftcms/cms/src/helpers/Db.phpat line 604 595596597598599600601602603604605...

Mar 20, 2023 22:53
1
Q: Tertiary Nav Items breaking Navigation when lightswitch set to zero

CreateSeanI have a navbar built out based on a pages section (structure) that has a field hideFromNav that when set to on hides the item from the nav bar - this is on line 8 of the code below. This works fine for first and secondary levels, but once there is a tertiary entry,with hideFromNav turned on, the...

Mar 14, 2023 23:44
1
Q: How to get second asset in Craft CMS 4?

Nikolay BronskiyIn craft cms 3 we could use this: {{ entry.images[1].url }} But how can I get second asset in Craft CMS 4?

Mar 9, 2023 23:37
1
Q: Delete All Products (and their variants)

cherrykodaI'm looking for the correct way to delete all of the products and related variants from my Commerce site. This is just for my local development environment as I'm debugging an import job. The delete() function is the wrong code in the following console controller: public function actionNuke() { ...

Mar 9, 2023 17:10
3
Q: What does the triple operator ??? do in this case?

BrokenCodeI know what the null coalescing operator (??) does. I have an example here with 3 operators and I am unsure what it does? Here is an example that I came across in a script I am trying to debug: {% set eventsButtonLabel = event.eventsButtonLabel ??? 'Book Ticket'|t ??? null %} What is the functio...

Mar 3, 2023 00:05
1
Q: How to control string translation through camel to kebab filters and back again (this is a tip not a question)

Jonathan SchofieldPutting this here in case anyone finds it useful. Strings like 'ABC thing' when pushed through camel and kebab filters can cause unexpected issues. For example… {% set str = 'ABC thing' %} {% set key = str|camel %} {% set id = key|kebab %} {% set keyFromId = id|camel %} {# key = 'aBCTh...

Mar 2, 2023 06:29
1
Q: Parent based Selectable Entries Condition

Mike NilandIn 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 Entries Condition in the field's settings to only allow entries to be selected if they match the foll...

Feb 1, 2023 23:37
1
Q: Redactor creating <p> tags outside it's parent

mencantalamelvaI am using redactor for creating a rich text field. The thing is that I'm using the exact same field on two separate sections. On one it is working fine, but on the other one, it is creating <p> tags outside the parent's div. On the upper screenshots redactor is working how I want it to work. O...

Jan 10, 2023 02:37
1
Q: Queued Job Failing

Sean GirardI have a rather large Craft CMS queued job that copies multiple entries which is repeatedly failing. Is there anything I can do to ensure that it runs?

Jan 8, 2023 09:28
1
Q: How to make comments on craft CMS?

DimiНow to create comments on this CMS? So far, I see only such a way - to create a separate section and write a module for adding entries to it. But something tells me that I will face a lot of problems while I am implementing my method. Maybe there is some ready-made and very convenient plugin for ...