Stack Exchange Network

Stack Exchange network consists of 175 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
14 views

Open pop on click of custom action and get filled data

I created a new custom action. A new button is added in getAvailableActions() as we can se in below screenshot in red marked rectangle, now when i click on that button (Cusotm Action) i want to ...
0
votes
0answers
10 views

What is CDbException Error: SQLSTATE[42000]: Syntax error or access violation while moving a site to remote?

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #28 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'site....
1
vote
0answers
10 views

Templating not displaying after Craft server migration

A small team and I have inherited a Craft 2 site. We are brand new to craft with no previous experience with it. In wanting to work on offline copies of the sight the team is attempting to migrate the ...
1
vote
1answer
10 views

Craft error on NFS filesystem

I have a Craft 2 install that's been working fine until recently when the admin page is giving an error: file_put_contents(): Exclusive locks are not supported for this stream The front end is fine....
1
vote
1answer
29 views

Multiple and or relatedTo in plugin element criteria

I am trying to return entries that relate to a series of categories. For example, I am trying to return clothing, in this example, I want to return all entries related to (flannel or denim) and (blue ...
1
vote
1answer
29 views

ID of matrix printed instead of value

I have strange issue and cannot find out the solution for that. I have this field (matrix with some text values): https://imgur.com/a/KaFXubJ Also I have this entry: https://imgur.com/a/cPMrGul And ...
1
vote
1answer
14 views

Craft 2 - Returning Value in Variable from Plugin to Template

I am working with a plugin and wish to return a value from it to the template that calls it. In my plugin, there is an XML feed call, and I would like to pass a value(variable) from the plugin to the ...
1
vote
1answer
66 views

Variable “entry” does not exist in template at Structure Section

So, the subject. I am currently working with customer of craftcms v2. I am setting up Structure Section where I want to add Entry Type for index listing of items and add some items in list. So, here ...
1
vote
1answer
27 views

Craft 2, MySQL database, Twig, JavaScript files

I have created in Craft 2 CMS, under the profile of users (ex. parents), new tab for (children), where parents can fill in there children information. The data is saved in a database under the ...
1
vote
1answer
18 views

Log Errors from twig template

I need to log flash messages from craft.session.getFlashes to a error log file from a particular twig template in Craft 2. Is there a way to do it ?
1
vote
2answers
41 views

Unable to access site after importing DB

I am installing a repo locally, and everything runs smoothly and I am able to see the site and login to my admin. But when I import my DB then visit my site: I get the error message "Site unavailable"....
1
vote
0answers
23 views

Shipping and billing addresses dissapear when close and open the page

I have the following problem. When I set shipping and billing address on my cart and exit the page, the addresses are cleared once I open the page again. Is it possible to disable this behavior? ...
1
vote
1answer
51 views

Using Recaptcha v2 and Guest Entries plugin

How can I prevent bots from sending tons of messages from a frontend form, it uses the Craft Guest Entries plugin. I'm using Recaptcha 2 but it only hides the submit button and it doesn't work using ...
1
vote
1answer
18 views

Craft 2.6 Session Issues

We are having issues staying logged in to Craft (2.6). There was a plugin error which is what we thought was causing the issues, so we removed the sprout SEO plugin. However the error still persists. ...
0
votes
0answers
19 views

CP doesn't recognize update from 2.7.3 to 2.7.4

I have a site running Craft 2.7.3. My update flow is to make sure that my development branch is up to date (with no outstanding commits) and that my local db is up to date with production. I then ...
1
vote
1answer
44 views

Adding entry type using setContentFromPost

I'm creating a new user using $user->setContentFromPost(). It all works fine except I can't attach an entry to an Entries field. $user = new UserModel(); $user->username = $email; $user-...
1
vote
1answer
19 views

How to determine if a user's email has changed

I'm trying to determine if a user has changed their email address via a front-end form. From what I've gleaned, the best way to do this would be by checking the existing record during users....
1
vote
1answer
15 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
16 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
44 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
68 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
37 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
50 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
49 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
16 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
27 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
21 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
18 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
56 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
21 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
59 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
36 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
27 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
54 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
28 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
18 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
29 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
28 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
12 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
29 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
35 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
32 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
227 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
37 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
14 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 ...