Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [craft2]

Questions specific to the Craft 2 version of Craft CMS; avoid using for questions applicable to all or multiple versions.

1
vote
1answer
10 views

ElementCriteriaModel combine with 'and' and 'or' filters

Saying I want to convert the following SQL query into ElementCriteriaModel: SELECT * FROM users WHERE fieldA = 1 AND (fieldB = 1 or fieldC = 1) I can't find a way in ElementCriteriaModel to do so. {...
1
vote
1answer
9 views

Custom plugin log not logging

I'm having this weird issue that both of my custom plugin logs are not working but all other third party ones including craft.log work fine. By 'not working' I mean the log file is generated, but ...
1
vote
0answers
27 views

Order entries by custom date field

I want to modify this query so that the dated entries are sorted in descending order on a custom field called 'startDate'. Have tried adding .order('startDate') to the end of the craft.entries(query)....
2
votes
1answer
57 views

Is it possible to pass a variable to an event in a plugin?

I need to find out if any changes have been made to the entry on successful save. Using events entries.onBeforeSaveEntry and entries.onSaveEntry seems to be a way to do it. Maybe. Can I pass some ...
2
votes
1answer
25 views

Set a route for all requests within a plugin

I’m trying to use a plugin to set up a site route that will direct every page request to a special template. This is what I’ve set up in my plugin file. public function registerSiteRoutes() { ...
1
vote
0answers
39 views

Avoiding includeJsFile, includeJS from caching

In my template, I have an includeJSFile that loads properly on the first load, but disappears on subsequent loads. The includeJSFile is outside the caching tags, so I'm not sure why this is still ...
1
vote
1answer
26 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....
1
vote
1answer
14 views

Accessing global set's field gives object that couldn't be converted to string

I've been using globals many times but this is my first time encounter with such problem. Let's go from the bottom. I have two global sets with handles tax and company. The Tax set have only one plain ...
1
vote
1answer
20 views

Failed Stale Template Cache Delete Error…Analyzed…But No Answer

For some of the extremely static content on my site, I use caching to prevent multiple db queries during every single load. I also have multiple locale on my site with custom cache key names. The ...
2
votes
1answer
15 views

How to directly get value of text field in a given section of type structure?

I am trying to get a value of a text field that is in a Section which is a structure and has multiple entry types. I don't want to use a loop. I tried this and some other variations but does not give ...
1
vote
1answer
16 views

Craft localisation caching error

long time listener, first time caller. I'm having some issues getting localisation setup on my homestead/vagrant craft 2 site. I'm running into issues, I believe, with the craft cache when I try to ...
1
vote
1answer
50 views

where command sql query not working

My problem is that I can't update the specific $userId. have the values I've selected. I also get an error: Call to a member function where() on integer I just started to learn Craft. It can be ...
1
vote
1answer
20 views

Tasks runs only after admin is logged in

I have a plugin which runs a task on order complete. The tasks runs successfully without any errors. But the problem is the task is only completed when admin is logged in. So if someone has completed ...
1
vote
1answer
51 views

Matrix field validation on guest entry submission

First I illustrate the way I set up guest entry form. Let's say I have channels blog product and comment cart. Guest entry submits to the comment cart channel. Form lives in template which I use to ...
1
vote
1answer
11 views

Forward users to the right template according to the current active site's language

I am using Craft 2 and trying to forward users to the right template according to the current active site's language when they reset their password. The problem is that the reset URL that Craft ...
1
vote
2answers
28 views

Sending Error Message to Template With No Logged In User - Craft 2

I'm working at getting error messages sent from my plugin to my template (on the front end), when there is no session (no logged in user). The plugin is for LDAP authentication. Edit: For ...
0
votes
1answer
22 views

Set Password on Test User Account in Localhost

I'm trying to set the password for a 'test' user account on my localhost test site. I don't have an email server to send the reset emails, so I've been using the copy URL method. When I do go to the ...
1
vote
1answer
44 views

Programmatically Login From Plugin

I'm writing an LDAP authentication plugin, which, if the authentication matches, will log the user into a 'general' username/password, in order to view a protected page. The 'general' username/...
1
vote
1answer
27 views

Trying to style Printmaker Plugin PDF by linking css in head of PDF template

Similar to this issue Render styled output using Printmaker plugin I am having the same issue and can't seem to figure out how to style the PDF. Here is my code to generate the PDF: {% set html ...
1
vote
1answer
20 views

Trigger download after form submission

I am working with a contact form plugin, written by an external developer several years ago. I want to trigger a file download upon successful completion of the form. As it stands, I have an onPost ...
1
vote
2answers
23 views

Counting section handle in TWIG with weighted search plugin

I am using the weighted search plugin to inplement a search functionality in my site. It works as it should but I am looking for a way to tell how much results were found of each type. Where type for ...
1
vote
1answer
8 views

Admin getElements 500 “unknown error”

I've duplicated a site into a new development environment, and everything works as it should other than the Entries section. It throws the AJAX-based "unknown error", originating from a 500 error on ...
2
votes
1answer
28 views

Craft 2 CMS - How to change Limits in Dashboard

I'm very new to Craft CMS. The company I work for, has their website build with Craft. The website was build by a 3rd party company, Now they gave me the responsibility to give the site a facelift. ...
1
vote
1answer
25 views

Locales and links not working as intended

I have taken over a project and Im having a small problem with locales. It is running Craft 2.6.3016 A section has a locale “en” where the english URL format is “en/contact”, and the entry also have ...
1
vote
0answers
11 views

modifyEntrySources hook with reverse relations

Is it possible to do a reverse relation query in a custom entry source? https://docs.craftcms.com/v2/plugins/hooks-reference.html#modifyentrysources I have two entry sections, one called courses and ...
1
vote
1answer
28 views

How do I remove the index.php from all URLS in Craft 2 CMS?

I am very new to Craft and have only been working with it for a few hours. However, I am stuck with something I can't seem to figure out. I understand the basics of templates, of which I have an ...
2
votes
0answers
31 views

Can you make Craft 2 Stateless?

So we are moving to Google App Engine Flexible which means we cannot store sessions on files. So I wanted to know if anyone has been able to make Craft 2 Stateless and how was it accomplished? Thanks....
1
vote
1answer
26 views

Sending a custom email in the users prefered locale

Usecase: I'm sending out custom emails based on certain events to my users. These users have chosen a certain prefered locale in their profile settings and I'd like for those emails to be in that ...
2
votes
1answer
117 views

Merging 2 Entries Array's

I have these to arrays that I need to merge into one array, but can't figure it out. Please advise {% set entries = craft.entries.section('publications').search('nonMembers:0') %} {% set entries = ...
1
vote
1answer
35 views

Craft 2 JS error in CMS since upgrade to 2.7.0

My Control Panel has stopped working since upgrading to Craft v2.7.0. in chrome. I get the following JS error no matter what is clicked in the entry fields and no action is taken. So for example if I ...
0
votes
0answers
9 views

Is there a Craft 2 plugin that displays a Structure nav tree on a single entry control panel page?

Is there is an existing Craft 2 plugin that will display a Structure nav tree menu on a single entry control panel page? So if I click into a level 2 entry in the control panel, I might see a block at ...
0
votes
0answers
13 views

Trying to paginate from filtered multi-select within a Matrix

I've been trying to paginate some shoes for a store, I've been able to filter inside the loop but that causes gaps, example if one shoe is filtered out I would get 7 shoes on the page instead of the 8 ...