texts:
I'm building a custom plugin and need to have a publicly accessible (non-CP) route as part of the plugin.

From what I've read I can use registerSiteRoutes() to register non-CP routes within my plugin. However, I'm getting a 404 when I do this. Here's my setup.

MyPlugin.php

<?php
namespace Craft;

  class MyPlugin extends BasePlugin {

    ...

    public function registerSiteRoutes() {
      return array(
        'myroute'           => array('action' => 'myplugin/access/index')
      );
    }
  }

MyPlugin_AccessController.php

<?php
namespace Craft;

class Portal_AccessController extends BaseController {

  protected $allowAnonymous = true;

  public function index() {

    $templatesPath = craft()->path->pluginsPath().'myplugin/templates/site/';
    craft()->path->setTemplatesPath($templatesPath);

    $this->renderTemplate('index');

  }

}

I have setup a basic template at /plugins/myplugin/templates/site/index.html

Hitting mydomain.com/myplugin results in a 404. Am I thinking of this correctly? Is it possible to have a non-CP route that points to a controller method in my plugin?


texts: How to retrieve Site Url and Site Name in Plugin

texts:
I'm having an exceedingly difficult time trying to retrieve the Site URL and Name in a custom plugin I am developing.

My research has led me to believe this would work:

$envVar = craft()->config->get('environmentVariables');
$siteUrl = $envVar['siteUrl'];
$siteName = $envVar['siteName'];

But in practice this hasn't worked. Does anyone know the correct way?


texts: I've noticed a few blog posts referring to the Profiling Summary Report. In the blog posts the author shows examples of it showing on Chrome's devtools. I'm in dev mode but can't see this on my Chrome devtools. Is there some more configuration needed to show this in the newest versions of Craft?


texts: Create a new calendar from front-end entry form

texts: I'm using Craft CMS and I want to allow users to create their own Calendars from a template. Basically like a front-end entry form for a section, or how I do it in the back-end. I don't see any mention of how to do so in the documentation for the Solspace Calendar plugin for Craft CMS.


texts: Getting total rows from current Super Table within Matrix Block (too many rows)

texts:
This is my first site in Craft CMS (coming from EE) and trying to get my head around a few things.

I've got a matrix field that defines various types of content - one of which is a 'Super Table' field. In this 'Super Table' field, I've got one particular field called 'linkText' which I'm trying to pull through. I did successfully BUT it came through 19 times. I've been trying to suss out where this number comes from.

I have a matrix field called 'pageContent'. The particular Block Type I'm looking at is called 'textBlock'. Within that block I then have a rich text field called 'Text' which pulls through perfect i.e. once as expected. I then have the troubled 'Super Table' field called 'callToAction' which has a linkType and linkText in there.

{% for block in entry.pageContent %}

    {% if block.type == "textBlock" %}

        {% for row in block.callToAction %}

             <p>{{ row.linkText }}</p>

        {% endfor %}

    {% elseif block.type == "customTable" %}

        etc, etc,

    {% endif %}

{% endfor %}

I'm sure it's something stupid, it is late! ;) but been checking the docs for a while and can't solve it. Any help would be great.


texts: User activation email markdown not (correctly) parsed, no link etc

texts:
Our User registration is not working correct anymore.

This is how the Email content part looks after registering a new public user:

Hallo craft_user.friendlyName,
danke für das Einrichten eines Benutzerkontos auf craft_siteName. Um
Ihr Konto zu aktivieren, klicken Sie bitte auf den folgenden Link:

craft_link

Wenn Sie diese Email nicht erwartet haben, ignorieren Sie sie
bitte einfach.

The markers are not parsed at all. The same result occurs, if I send a second activation mail via the CP.
It does already work. We started with Craft 2.3 and did all updates to 2.6. I have no idea when and why this happens.

This is the part of the (original) /app/translations/de.php:

'account_activation_body' => 'Hallo {{user.friendlyName}},

danke für das Einrichten eines Benutzerkontos auf {{siteName}}. Um
Ihr Konto zu aktivieren, klicken Sie bitte auf den folgenden Link:

{{link}}

Wenn Sie diese E-Mail nicht erwartet haben, ignorieren Sie sie
bitte einfach.',

Any suggestions?


texts:
Is it possible to show all tags that are related to a category? I can't find anything on it.

Thanks.

Edit:

What I am looking for is this:

I know a category slug or name. I want to get all tags associated with entries in that category.

I can't seem to get this to work using the relatedTo param.


texts: Is it possible to use a lightswitch (or something similar) for different post types?

texts:
My question is closely related to this question: How do I display entries from multiple entry types?

I would like to have two blog post types:

Regular blog posts (Title, Body, etc)
External links posts (Link out to another site)

I imagined I would display them in the same area, by dates created, like a standard blog, but clicking some of the links would go to external link.

I want to make this as easy as possible for my client, so I would like them to be in the same place if possible, but also open to any other solutions. Has anyone done something like this?

I thought about the possibility of two channels, and combining all posts and ordering by date? Not completely sure how I would go about that though.


texts: Sprout Email conflicts with Craft Contact Form

texts:
I have the latest versions of Craft CMS, Sprout Email and Craft Contact plugins. Sprout behaves fine with some notifications I have set up. However, if I submit a contact form it throws a PHP error - mb_convert_case() expects parameter 1 to be string, array given

If I disable Sprout, then Contact Form works fine.

Looking at the logs, I see that submitting the form triggers a 'When an entry is saved' event and Sprout starts looking at whether it is something it should handle and then chokes when trying to parse it as an entry.

I finally got things to work by disabling the "Enable Sent Email tracking" feature in Sprout Email, but I would prefer not to have to do that.

Has anyone encountered anything like this or have any thoughts on this? Thanks for any input!


texts: Why aren't my images displayed on the homepage

texts:
Our homepage.twig is a section
Our Matrix is called "angebote" (it's german don't ask :D)
We created two entries for our matrix
This is our Code inside the homepage.twig file for including the matrix on our page:

Our issue is as follows: the
headline of the matrix will show up correctly but the matrix image won't be displayed. We tried everything the internet has to offer but can't solve the problem. It seems like the issue isnt in the code itself because the image icon is shown, but the image source cant be found.

One more notice to give: We have to use an older craft version for our website, in fact :
Craft CMS 3.5.13.2
Additionally here are a few more screenshots of our Craft Configuration:

We hope you can help or give us some advice
thank you!


texts:
Trying to better my skills and take a simple Craft-driven website to a more modern level with some VueJS. I'm still very much learning Vue.

The course I've been following recommends using vue-cli to create an app, and it runs it's own development server. I've done this and things work well. However, I'm not sure the best way to integrate that with Craft. Do I run the vue create project-name inside of my Craft project? What does that do for the development server? I'm currently using MAMP for Craft, do they clash?

I would like to eventually get to a point where I use GraphQL and then in theory my Vue app can live elsewhere and this is not a problem. However, whilst I'm learning I just want to add some very basic things to my existing site, like responsive menu toggles, dropdown menus etc. I understand I could just use the CDN and do things that way, but then I'm not sure of the best approach to take with templates and components etc.

As you can probably tell, very much at a beginner level so I would appreciate any thoughts. I've read LOTS of guides, but none seem to really answer these questions.

Many thanks in advance!


texts: Cannot enable Craft plugin in control panel

texts:
I'm attempting to enable a plugin from within the Craft control panel but I am unable to do so. It shows Disabled and when I click "Enable" it shows "Plugin Enabled" at the top but still shows disabled below and will not enable.

I'm not getting any errors reported and it seems to work on other environments just will not work now?


texts: Namespace issues with binding Javascript

texts:
I'm building a plugin that relies on Javascript to function correctly. Having tried different methods, I can't get the ID names to remain consistent.

Here's an example of the code that is being output.

<input type="text"
id="fields-slider-output"
name="fields[slider]"
value="539">

<input
id="fields-input"
type="range"
name="fields[slider]"
value="539"  min="0 max="1000" step="0">

The first input is a text input, and displays the ID as you would expect. The span element below only contains "fields-", and leaves out the name of the field. The same happens with the range input, which is the most surprising, as it's a form input with a name.

When using JavaScript, the "fields-" namespace is left out entirely, which means that the Javascript can't bind to an element.

$("#slider-input")[0].oninput = function () {
    $('#slider-value').html(this.value);
};

I'm using this code from the Craft docs.

$id = craft()->templates->formatInputId($name);
$namespacedId = craft()->templates->namespaceInputId($id);

I've also looked into the namespacing HTML docs (http://buildwithcraft.com/docs/apis/templatesservice#namespacing-html) with little success.

Does anyone know a possible solution to this? Bearing in mind this Fieldtype requires Matrix support, so using a class instead of an ID is not an option.

Thanks.


texts: Do email messages use control panel or translation file template when sending by key?

texts:
When an email key is registered for use with craft()->email->sendEmailByKey, it shows up in the control panel at Email Settings->Messages. This seems like a great way to allow easy editing of the messages by clients.

If I have something hardcoded in my plugin's translations folder (e.g. /translations/en_us.php) corresponding to the email message key, will the subject and body always come from that file, or will it come from the data in the control panel? Specifically, if an update is made to the template in the control panel, does that completely override the template defined in the translations file? If so, is there a way to revert back to the version in the translation file?


texts: Is there a way to speed up password hashing?

texts:
I am setting up a system that migrates users from an external source and have determined the most time expensive part is when the UsersService _setPasswordOnUserRecord method hashes the password

$hash = craft()->security->hashPassword($user->newPassword);

This is taking about 2 secs where the rest of the operation for saving a user is about .2 sec. There are close to 10k users to it's really adding up! Is there any way to use a faster type of hash or bypass the hashing, or am I out of luck?

example:

    $user = new UserModel;

    $user->firstName    = "First";
    $user->lastName     = 'last';
    $user->newPassword  = '123456';
    $user->email        = 'email@email.com';
    $user->username     = 'username';

    $wasSaved = craft()->users->saveUser($user);


texts:
For my multi-lingual-Page (de + en) I've made a 404.html-File in my templates-Folder with a language-changer for html-content-output like
{% if craft.app.language == 'de-CH' %}
Hallo
 {% else %}
Hello
 {% endif %}

When I open the 404-pages local (localhost/404 and localhost/en/404) it works. Also when I open them in live with direct url (www.example.ch/404 and www.example.ch/en/404) everything works fine.
But when I will open a wrong URL like "www.example.ch/tesxt" (correct URL: www.example.ch/test) I get a HTTP 404 – Not Found – yii\web\NotFoundHttpException Template not found: tesxt
Settings:

I only have one index.php
I only have one 404.html
in general.php: 'devMode' => false,
the 404.html is directly in templates-Folder (src>templates>404.html)
installed Plugins: DigitalOcean Spaces Volume, Freeform, Redactor (I think these will not disturb the 404 page)
Craft Version: 3.5.17
PHP-Version: 7.3.17


texts: Best practice for collecting a response from a third party

texts:
So I'm in the middle of creating a plugin that allows users to make payments with GoCardless. Once payment has been made on the GoCardless website the user needs to be redirected to a PHP script that will confirm the payment was all hunkie-dorie... but....

Where do I put this script? At the moment I've put it inside a folder that is inside the htdocs folder but I'm having problems calling craft()->plugin_name->confirmPayment() from this location as craft() is undefined here.

Help greatly appreciated, thanks!


texts: Craft ships with PHPUnit... How can we use it to test our plugins?

texts: Since Craft ships with a copy of PHPUnit, is it possible to use that to run tests on a plugin? Or do we need to have a separate copy installed?


texts: How can my plugin generate a generic modal window in the Control Panel?

texts:
I'm working on a plugin, and it requires a modal to be displayed when the user interacts with a field of my Field Type. When the user finishes interacting with the modal, they would click "Done".

This is the standard modal that displays when you select Assets...

I basically want a more generic version of this modal, where I can put anything I want into the middle of it.

I would love to have something like this:

What's the best way to pull that off?


texts:
I'm trying to create an archive of PDF newsletters in Craft 3. I want to create a list of entries sorted by month and year. Then each year would appear separately. Finally, I want each asset within the entry to be linked to the month name for download.

I can get each entry to output by month - but it is not separating by year. I'm also not certain how to call just the asset in this loop. Would it be better to link to an entry and then show the asset there?

Here's what I have so far:

{# all entries sorted by year/month   #}
{% set allEntries = craft.entries.section('sectionName').limit(null).orderBy('postDate desc') %}

  {% for year, entriesInYear in allEntries.all() | group("postDate.year") %}

{{ year }}

        {% for month, entries in entriesInYear | group("postDate|date('F')" ) %}

            {% for entry in entries %}
                {% for asset in entry.file %}
                {% endfor %}
            {% endfor %}

                {{ month }}

        {% endfor %}

  {% endfor %}

This outputs:

June

May


texts: Commerce: How can I check order history to see if a product type has been purchased?

texts:
I am building a plugin that grants access to a "hidden" (for lack of better words) entry. if a user has purchased a specific product type.

For example, I don't care which piece of clothing the user purchases, just as long as it was of type clothing.

How can I check the users order history to see if they have purchased a qualifying product?

Thank you for any suggestions!


texts: Is it possible to have one Craft install running

texts:
Can a Craft install run on multiple domains and/or subdomains?

For example having the same Craft install running a blog Channel at blog.example.com and also an about Single at example.com


texts: In a matrix, link to entries with a future date

texts:
This is somewhat related to this How can I display a "pending" entry in my "_entry" template?

I have an 'events' section where some entries have a future date - the above link solved my issue to get those listed in a sidebar and display single entries while ignoring the date. So far so good.

I have a homepage slider (a matrix field) where each slide can link to an entry - problem is those entries with a future date from the 'events' section are simply not showing up.(block.slideLink is my entries field inside the matrix)

Any ideas how to get around this?

{% for block in entry.homeslider %}
    {% if block.type == 'slides' %}

{{ block.slideTitle }}

{{ block.slideIntro }}

                        {% for link in block.slideLink %}
                        lees verder...
                        {% endfor %}

    {% endif %}
{% endfor %}


texts:
Hopefully this is a simple question but I couldn't find a clear answer anywhere - I just want to be able to pull in data from a specific entry, where I know the identifier.

In this particular case, the entry is a single. Currently I'm doing this:

{% set entry = craft.entries.section('myChosenSection').first() %}

Is this correct, or is there a more concise way?


texts: Output two date languages on the same page without localization

texts:
I'm trying to output a date like this for instance:

{{ now|date('l, j-m-Y') }}

This outputs the date in my standard language. I need it output on the same page in English too. Is this possible?


texts: logo uploaded through backend doesn't come through (on my environment)

texts:
I've got a logo uploaded through the backend, I've got the file locally & can see it on the craft login screen and the backend.

Colleague can see it fine on the front end on a template, but I cannot.

Loading it in on the front end with: {{ craft.rebrand.logo.url }}

It just seems to timeout while the page is being loaded:

Storage folder is 777'd recursively, I presume it's loading it through that (due to the /cpresources/ path)

Anyone got any ideas?


texts: Find entries with multiple start and end dates from the same date field

texts:
I've got a front end form where a user can select multiple months to find entries with dates in those months.
I had code that does that for one month, but now I need to expand that to multiple months.
{# craft.app.request.getParam('departure') format is going to yyyy-mm-dd #}

{% if craft.app.request.getParam('departure') | length %}
    {% set lastDay = craft.app.request.getParam('departure') [0:7] %}
    {% set lastDay = lastDay ~ '-31' %}
    {% set firstDay = craft.app.request.getParam('departure') %}
    {% set entries = entries.startsOn(['and', '>= '~firstDay, '< '~ lastDay]) %}
{% endif %}

I was trying to combine it as I have with other fields like so:
 {% set deptDates = [] %}
    {% set deptDates = deptDates|merge(['or']) %}
    {% for dept in craft.app.request.getParam('departure') %}

        {% set lastDay = dept [0:7] %}
        {% set lastDay = lastDay ~ '-31' %}
        {% set firstDay = dept %}
        {% set deptDates = deptDates|merge(['and', '>= '~firstDay, '< '~ lastDay]) %}

    {% endfor %}
    {% set entries = entries.startsOn(deptDates) %}

But, for obvious reasons, this didn't work :)
Any ideas gratefully received!


texts: No Underscores Allowed in Freeform Field Handles?

texts:
We're trying to use Solspace Freeform with a third party CRM and it (the CRM) has a field name convention that uses underscores (x_firstName, etc). We're trying to set up corresponding forms in Freeform and want to map fields using the same field names as the CRM but it appears that it (Freeform) will not let you use underscores when typing out the handle for a field.

Does anyone have any knowledge of this? It seems an odd convention in Freeform to disallow underscore in its field handles.


texts: How do I change the URL used to access Craft?

texts:
By default you can access Craft on a site by visiting /admin. How can I change the URL for this to something else?

For example: /new-url


texts:
First Craft install so please excuse me if this is a newbie Q.

Templates are in /craft/templates. Is it possible to move those to a different location? Our other sites (EE) have templates stored with the UI theme source files so everything to do with the the site look and feel is in one place.

Thanks.


texts: Handling non-image uploads when updating user photo from front-end form

texts:
We have a front-end form that allows users to update their profile photo. If a user attempts to upload a non-image file, instead of the actionSaveUser controller failing and throwing an error, it gets to $this->_processUserPhoto and then throws an Exception

             {
200                 // Invalid SVG. Maybe it's missing its DTD?
201                 $svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$svg;
202                 $this->_image = $this->_instance->load($svg);
203             }
204         }
205         else
206         {
207             $imageInfo = @getimagesize($path);
208
209             if (!is_array($imageInfo))
210             {
211                 throw new Exception(Craft::t('The file “{path}” does not appear to be an image.', array('path' => $path)));
212             }

Is there a more graceful way to handle this so I can return an error to the user instead?


texts: How can I retrieve a global value in a different locale?

texts:
Not much to add to the question, other than I need to display a global's value in a different locale to the current locale.

Is this the best way of doing it?

craft.globals.getSetByHandle('localeModal').locale('es').getFieldValue('headline')


texts:
I have a Matrix field where one of my child fields is a Dynamic Dropdown that uses the following code to pull in entries:

{% for entry in craft.entries.limit(null).section('dealers').type('online') %}
  { "value":"{{ entry.id }}" , "label":"{{ entry | raw }}"
    {% if entry.uri == '__home__' %} , "default":true{% endif %}}
    {% if not loop.last %},{% endif %}
{% endfor %}

The Matrix field has a handle of mensPDPLinks and the child field has a handle of retailer.

The above code creates a dropdown containing a list of retailers from another section.

When editing an entry containing this field a person can add as many retailers as needed by adding additional Matrix rows. It should be storing the entryID for each of the retailer entries they select. There are additional Matrix child fields to include other data to each retailer they select.

In my templates I'd like to loop through the entries (retailers) they've added in the Matrix field and display some data from the retailers entry.

Can someone point me in a direction? I'm kinda lost as to how I can do this.


texts:
I have a front end form based on the entry form example provided by craft documentation which allows logged in users to submit an entry to a specific section. Form validation is not working in that required fields are not being picked up on submission. So if the field is empty it still submits the form.

I have the user group set up so users are not able to use the CP or submit live entries so the entry is sent through as disabled so that the admin users can monitor entries before enabling them.

Am I correct in thinking that because the entry is being saved as disabled that craft does not validate the post data? If this is correct what is the work around as I do not want users to be able to post live entries.

Cheers


texts: How to set error message in element action?

texts:
I call a service function inside the performAction method of custom element-action and I'd like to show an error message to user if the service function returned false.

I was able to set success message by using:

$this->setMessage($this->getParams()->successMessage);

But I don't know how to set an error message i.e. with red background.


texts: Insert entry into article field (elementselect?) on a user, with the "onBeforeSaveEntry" hook

texts:
I'm having a hard time inserting new content into an elementselect field for a user.

Here's the code I'm working on so far, inside a custom plugin init()

parent::init();
craft()->on('entries.onBeforeSaveEntry', function(Event $event) {
    $entry = $event->params['entry'];
    $isNew = $event->params['isNewEntry'];

    if ($isNew) {
        $user = craft()->users->getUserById($entry['authorId']);

        $focusList = $user->getContent()->focusList;

        if (!is_array($focusList)) {
            $focusList = array();
        }
        array_push($focusList, $entry);
        $user->getContent()->focusList = $focusList;

        craft()->users->saveUser($user);

    }
});

I'm tring to add a "onBeforeSaveEntry" hook, that first checks if the entry is new.

If it is, add the entry to the authors "focusList" (an article field without limits)

But I can't get it to work. Any suggestions?

The error message I'm stuck with so far:

"CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails" is the error message I'm battling


texts:
Is it possible to access twig filters in a plugin? I want to be able to preview how text will look in a textarea using Markdown for a discussion board, it'd be awesome to use ajax to send the content to the controller then return the filtered version for preview, something like:

public function actionPreviewContentAjax()
{
    $this->requireAjaxRequest();

    $content = craft()->request->getPost('textarea_content');

    // somehow apply twig's "| markdown" filter to $content

    $this->returnJson( $content );
}

Is twig accessible in this manner or am I out of my mind? :X


texts: How to update a field when a user views a page

texts:
I am building a site for a client that is effectively a job board with a messaging system.  They want to know who the last person in their office was to view a specific application and to know who/when someone views specific pages/messages.

I am hoping for something like

set x = users.lastvisitor
if currentuser != users.last vistor
insert currentuser & date into users.lastvisitor

Can anyone point me in a direction?  I am new to Craft so don't know how it handles things like this. I am using matrix blocks for the messages, is it possible to add an entry through a query instead of a form?


texts:
I have a fresh LAMP instance based on a bitnami image on AWS. All server requirements are met for Craft 2, but I'm getting a 500 error when trying to hit the site:

  site.com is currently unable to handle this request. HTTP ERROR 500

Seeing this in the error log:

  Uncaught Error: Call to a member function run() on integer

I've done separate db tests for pdo and mysqli -- connectivity seems fine. Permissions all look correct (774). Any thoughts on what could be causing?


texts: How to route short tag to external web site

texts:
I am writing a plugin to that will map http://short.com/e9DG to http:/longdomainname.com/longsubpagename

I assume I need to use the config/routes.php but am having struggling to understand how how to set this up. I keep getting 404 as it cannot resolve the url.

As a test I have the foloing code

return array(
    'e9DG' => array('action' => '/cocktailrecipes/ingredients/new'),
);


texts:
I want to add source tracking to my Craft CMS site.  Using Google Analytics I can track users through just about the entire process but can't see them as they go through account registration.

I want to simply add a query parameter to the {{ link }} from the activation email.

I can see that if I add {{ link }}&source=test that the additional query param shows up, however what I really want is something like this:

&source={{ craft.request.getCookie('traffic_src') }}

However the above solution returns the activation code and source= which leads me to believe that it is undefined

What is the best way to approach this problem of accessing a cookie for a user in one of Craft's email messages.


texts: Express Server posting user data to Craft

texts:
First of all let me just say that I have only been using Craft for a few months and still has allot to learn about it.

My issue is quite simple in that I have an express server running to display the data on the front-end. I am using Craft as a solution for the client to add or change content on their site. This is working well. I am even able to use your Element API to retrieve data from Craft and together with my Express server I can manipulate and display content where it is needed.

My client has now recently asked me to add a section that would allow users to register users and this is where I am starting to have problems. Or at least, this is where I need some expert knowledge.

I would just like to save the user data via post. I have looked at a few options out there but honestly I don't want to build a plugin to handle this. Is there a way I could post and save data to Craft without it being too complicated?


texts: How can I show next/previous paging that's limited by specific criteria?

texts:
I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the leadershipType field matches the current entry's leadershipType value.

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}&lt;{% endif %}
{% if next %}&gt;{% endif %}


texts:
Stuck on a problem at the moment… trying to output a Rich Text field (copy) from an entry. The copy is contained in a matrix field (so: Entry -> Matrix Field -> Copy Field) but I can’t access it no matter what I try.

The Matrix Field Type is genericContent, the entry is relatedContent and the copy field is simply named copy.

Here's the code I currently have, I've tried various other options but none work.

{% set entries = entry.relatedContent %}

{% for entry in entries %}
    {% switch entries|length %}
        {% case '1' %}
            one
        {% case '2' %}

                    {{ entry.sectionTag.first }}

{{ entry.title }}

{{ entry.genericContent.copyMatrix.copy.first }}

{{dump(entry.genericContent.copyMatrix.copy.first)}}

        {% case '3' %}
            three
        {% case '4' %}
            four
    {% endswitch %}
{% endfor %}


texts: Can you batch-change all authors in the CP?

texts:
Context: When we insert content for clients on full-service projects, sometimes we leave the original author. This author is usually from my shop and has admin-level permissions. When we turn the site over to clients, many times they can't override an admin due to their own (appropriate) permissions.

Question: Is there a way to batch-change all authors to either another author or null? Forethought is obviously the best thing in this case, but it's a pain to go into each entry and remove/change authors, and I'm lazy. I wasn't able to find a workaround or plugin. This question shows what to do in the database, but I'm wondering about the CP.


texts:
I'm using many "entry type" templates as described here: http://buildwithcraft.com/help/entry-type-templates. I'm using ElementAPI to render full entries as HTML embedded into JSON. I'm using this transformer method:

craft()->templates->render('path/to/template/template-name', [
    'entry' => $template
])`

This works fine. But I need to assign the corresponding template to each entry-type. I have not found a solution. I can't seem to access the name or path of the assigned template. I don't really need the path, but need the name. The following seems right, but doesn't work:

'path/to/template/' . $template->getTemplateName()

Any ideas??

Thanks!


texts: How to display the parent category on an entry page?

texts:
I have a simple Craft 3 website, with products that are organised in categories.

Can someone please tell me how to do the following:

On the the individual product pages (_entry.html) display a 'breadcrumb' menu that includes the parent category name/url (I've followed the few examples posted here - they don't work).

And also be able to simply display the name of the parent category of the product in text (e.g. to use as part of the h1 title for the product page).

Many thanks for your help - it is very much appreciated!


texts: Any robust plugins with Markdown Extra support?

texts:
I've tried @monooso’s Smartdown plugin but can’t get it to run on my local install of Craft 2.5 under PHP 5.6.10.

I have content that parses fine as regular Markdown but just fails totally with the smartdown filter applied. I've read somewhere that Smartdown is a work in progress. (I'll ask Stephen about it.)

I note with interest a recent release from Pixel & Tonic for a Parsedown plugin: https://github.com/pixelandtonic/Parsedown.

But not yet found a plugin that executes either Markdown Extra or Parsedown Extra on regular Plaintext fields.


texts: Redactor inserts reference tags into IMG when using image transforms, but tag not being processed by parseRefs

texts:
Been working with Craft for about a year, but today for the first time I had to modify the Redactor config to place images inside a body field. I added 'image' to my buttons array and everything seemed OK. The button appeared and I could see and select from all my sources. I selected an image and added it to my body. After I save and check the page, image appears as expected.

Next, I try the same image again, but use an image transform instead. Now when I load the page, the image is missing. When I inspect the page's source, I see this.

I'm just echoing out entry.body as you'd expect. Do I need to run this through a special filter or tag to use the right.

Before saving the image, I tried viewing the markup in the RTE's HTML mode and I see this.

If I remove the hash from the src URL, the field is saved without issue and I can view my image. Adding it back in recreates the issue.

Is there something else I should be doing in my Redactor config, field settings, or template to make this work right?

Thanks in advance.

UPDATE:
It appears that Redactor is inserting something called a reference tag into my src attribute instead of a regular path. (Why I would want this I don't know.) In the templates, I'm suppose to pass the field value through the parseRefs tag to change that reference into a proper path. Like so...

{{ entry.body|parseRefs|raw }}

But it appears that nothing is changing (tried with and without raw). I read in the comments for this old SE Q (Is it possible to use Twig in a Rich Text Field?) that parseRefs doesn't work on rich text fields, but that bring up the question of why Redactor is inserting these tags into my rich text in the first place, especially when regular old paths are working so well.


texts:
I have an ongoing issue with the admin. It seems to stop responding periodically. For example, I just created a new section in a site I am developing and hit save, I get spinner and it just sits there and doesn't respond. I look on the server and there is no activity. There are no javascript errors. If I reload the page the details have saved.

I am using a recent version of Chrome on Windows 8.

It seems to happen maybe every 1 out of 10 admin setting type pages


texts: File upload error in MS Azure after custom domain was pointed to Azure server

texts:
I am facing an issue with file uploads. I installed a new installation of Craft CMS on Microsoft Azure server. MS Azure assigns a default domain to your webapp like example.azurewebsites.net.
So while the default domain was assigned, I uploaded few asset files (images) successfully.

Later we had a custom domain added to Azure like mydomain.org
Once the custom domain was mapped, I edited the SiteURL (in Settings -> General -> mydomain.org) to the custom domain.
Now I am unable to upload asset files.

The error log shown in the Craft CMS craft.log (from Server Info) is move_uploaded_file(): Filename cannot be empty (D:\serverpath\craft\app\assetsourcetypes\BaseAssetSourceType.php:170)

Can someone please help.


texts: Advanced layout: Best way to create a tabbed page with variable content in each tab

texts:
I'd like to create some tabs on a page, and the content inside each tab. The thing is, inside one tab you will have 3 columns which would have a title/body in little sections for each column. Then in another tab you'll have a masonry list so a title and then a bunch of spans repeated. Another tab might be a body field and an image.

So you can see there is repeating content inside each tab and you can't have a matrix in a matrix as far as I can see.

How would those more experienced approach it? Am I overthinking it? I'd like something that is easy for the customer (of course!).

Updated with diagram and what I had in mind.


texts:
Is it possible to control the Matrix layout with CSS within the CP?

The Rich Text fields I have are currently displaying like this:

But I'd like this specific field to look something like this:

I'd like to avoid using a plugin if possible.


texts: MySQL 5.6 backup to MySQL 5.7... what to do

texts:
I just changed my db server, and I managed to import a db dump to the new system.
What troubles me is that, once done, I noticed I have now MySQL 5.7.32, while the previous database server was 5.6.48.
I checked the project from the browser and so far it seems to work as expected, without errors.
Should I care about this? Was I supposed to somehow migrate the dump before actually load it?
I searched Craft CMS docs but I did not find any detail on this.
Thanks in advance!


texts: I have a plugin that makes several and potentially slow database calls that eventually return 8 Entries. Is there a way to make use of Craft's built in caching on the plugin side? Using the {% cache %} tag doesn't seem to be doing the trick.


texts: Is it possible to use a loop variable to target a specific field entry?

texts:
I'm looping through the rows of a table field and hoping to target a specific field entry based on the loop.index. Here's a simplified example of what that might look like:

{% for row in entry.table %}
   {% set foo = entry.field ~ loop.index %}
{% endfor %}

The doesn't work, but I’m curious if I just have the syntax wrong or if I’m thinking about this the wrong way.


texts:
Is there a way to return the number of columns in a table?

I tried {{ entry.tableHandle | length }} but this seems to return the number of rows rather than columns.

I've got a site with a couple of tables and I'm trying to output the number of columns in a given table to use for my CSS responsive column width.

I.E. If table was 2 columns, it would output a 2 and I would use that to set column width to 50% etc...


texts: How can I reference images separately within a rich text field?

texts:
I'm migrating some posts from Wordpress, and the posts on Wordpress have the images within a rich text field.

I need to reference the image separately to the rest of the rich text field - below the image there is usually one or two lines of text.

Is there any way I can either:

a. Reference the image in my Twig separately to the rest of the rich text field, or

b. Somehow split the rich text field so that the image url becomes an asset within Craft.

I'm using Feed Me to import the data into Craft and WP All Export to export the data out of Wordpress.

Thanks!


texts: From my searches it looks like Placid is the way to go for showing Facebook contenton the front-end of my website. What I'm completely confused about is how to get started. Does anyone have a simple step-by-step answer on how I connect Placid to my Facebook page?


texts:
I'm having an issue with Sprig + Blitz Caching. I'm trying to load a user image if currentUser exists, though I'm having an issue with the caching. Sprig is loading in the unregistered user photo when logged in. I'm unsure if it's setup right.
      {{ sprig('components/_componentUser', {}, {
        's-trigger': 'refresh, load'
      }) }}

Then in my _componentUser
  {% if currentUser %}

            {% else %}

  {% endif %}


texts: Front-end entry form not updating custom fields in existing entry

texts:
I have an entry form (in a local v3.5.13.1 dev context) configured to update existing entries in a particular section. On load, it’s reflecting existing data (input via the Craft control panel) perfectly well, including Assets and Matrix field content.
But when I'm logged in as a Super Admin and I submit changes, it will receive updates to the entry Title field but not to any custom fields.
No errors are being reported and it redirects to the desired page.
At present, I have stripped it right back to the Title field and a single Plain Text custom field but no joy. Here is my form code:
{% set entry = entry ?? create('craft\\elements\\Entry') %}
{% set redirectUrl = "partners/#{entry.id}" %}
{% set sectionId = entry.sectionId %}

<form method="post" accept-charset="UTF-8">
    {{ csrfInput() }}
    {{ actionInput('entries/save-entry') }}
    {{ redirectInput(redirectUrl) }}
    {{ hiddenInput('sectionId', '5') }}
    {{ hiddenInput('enabled', '1') }}
    {{ hiddenInput('entryId', entry.id) }}
    {{ hiddenInput('entryVariable', 'badEntry'|hash) }}

    {% macro errorList(errors) %}
        {% if errors %}

            {% for error in errors %}

{{ error }}

            {% endfor %}

        {% endif %}
    {% endmacro %}

            Organisation name
            {{ input('text', 'title', entry.title, {
                required: true,
                class: entry.hasErrors('title') ? 'text error' : 'text'
            }) }}
            {{ _self.errorList(entry.getErrors('title')) }}

                Headline:
                Optional, 10 words or fewer recommended

            {{ input('text', 'headline', entry.headline, {
                required: true,
                class: entry.hasErrors('headline') ? 'text error' : 'text'
            }) }}
            {{ _self.errorList(entry.getErrors('headline')) }}

        <input type="submit" class="btn" value="Update page">

</form>

No updates to the Headline field get saved. Updates to the Title field do. Where can I be going wrong?


texts: Multiple Service/Variable/Controller plugin files

texts:
I'm not sure if I missed documentation on it, but is there a method to follow when including additional plugin files for services, controllers, variables etc.?

For bigger plugins it'd help to do this, something like

- /myplugin
   -/services
      -MyPluginService.php
      -MyPlugin_OtherService.php
      -MyPlugin_AnotherService.php

I've tried doing this and being sure to follow the service structure of:

namespace Craft;

class MyPlugin_OtherService extends BaseApplicationComponent
{

  public function testing()
  {
      return "success!";
  }

}

But when trying to access it from say the myPluginVariable.php file, I get the CException error that the property is not defined.

return craft()->myPlugin_OtherService->testing();

Is there a step I'm missing? Do I need to declare these extra files somewhere so that they are included?


texts:
Looking to build a largish site with Craft and I need a way to organize the entries for content editors/creators. Adding headers down the side will help for channels/structures, but all singles seem stuck in the predefined singles tab.

I've tried adding a custom field to each page but it doesn't seem possible to sort by a custom field from within the entries view, which makes this rather useless.

Is there anything built in that I'm missing or perhaps a plugin that can help me to group together related content on this page? You can imagine this becoming hard to navigate with dozens or even hundreds of pages.


texts:
I need to make a database on a remote server, and since I have been using craftman installer which uses Docker to install Craft CMS and DB locally I have no idea how does the DB actually looks like. How can I check and see what is DB like, and export the sql file so that I can import it on the remote server?
I have tried to connect to it using these settings:

Host: 127.0.0.1
Username: root
Password:
Database: craft
Port: 3306

I have also tried with changing the Db name from craft to the name of my project, but that didn't work either, not sure where I can find the right settings and how to connect to DB?


texts: How to automatically redirect a url based on dynamic content

texts:
We have a some conditional logic for a dashboard style setup. We have urls like :

neptune/{id}/details
neptune/{id}/options
neptune/{id}/confirm

etc..

The actual urls accessible depend on the status of the elements in question, and the whole process has a flow setup - the user has to go through each part in turn, ie. details > options > confirm, however they can go back and revise and drop out entirely and pick up where they left off later.

This all works fine, but to smooth out things we'd ideally have a way to automatically force a redirect from a urls based on the current state. If this were ExpressionEngine we'd have a tag like :

{redirect="neptune/{id}/confirm"}

What's the equivalent Craft/Twig setup? Or is there an alternative better setup.

Note : this isn't for the main flow of the user, only needed for the actual edge cases where a user may revisit (ie. manually) an out of flow url somehow, so isn't related to the core logic.


texts: I'm new to the Craft and I just want to ask if how am I able to perform an HTTP request in Craft just like AJAX. Where should I perform it? What should be the flow?


texts: How to check if a DateTime attribute is set?

texts:
I have a optional dateFinished attribute in my Record:

protected function defineAttributes()
{
    return array(
        ...
        'dateFinished'  => AttributeType::DateTime,
        ...
    );
}

Some Records have it set to a DateTime other have it set to null (default).

To prevent Twig errors I tried using the is defined test:

{{ log.dateFinished is defined ? log.dateFinished|date('m.d.y - H:m'|t) : '-'}}

But this doesn't work, I'm getting the typical "Scope error". After taking a look at the dump() it looks that even a null value is getting defined:

  ["dateFinished"]=>
  object(Craft\DateTime)#2670 (3) {
    ["date"]=>
    string(19) "2014-07-15 17:48:25"
    ["timezone_type"]=>
    int(1)
    ["timezone"]=>
    string(6) "+00:00"
  }

  ....

  ["dateFinished"]=>
  array(2) {
    ["column"]=>
    string(8) "datetime"
    ["type"]=>
    string(8) "datetime"
  }

I tried to solve this by "Check(ing) if a variable is a date with Twig":

{{ log.dateFinished is defined and log.dateFinished.timestamp is defined ? log.dateFinished|date('m.d.y - H:m'|t) : '-'}}

But this doesn't make a difference, I'm still getting the "Scope error". Any ideas?


texts:
I have  in a Single-Line Text Type in a Table Field Type which is inside a matrix. Now I want to replace all of them through Find and replace option. But when I use  and Yes in Find and Replace Fields respectively then nowhere it is replaced. However a task runs saying Replacing “” with “Yes” but still nothing happens.

Could anyone please help.


texts: Retrieving custom settings in Craft 3 plugin

texts:
I'm trying to retrieve the settings that a user sets in a Craft 3 plugin. The method I used in Craft 2 plugins doesn't seem to work anymore. To demonstrate the problem, I'd made a plugin and uploaded it to GitHub to demonstrate it.

Basically though, when I trace out my plugin's settings, I can see the value that is custom set in the trace readout.

Craft::trace($this->settings, __METHOD__);

returns:

  {s:9:"someField";s:17:"MY CUSTOM MESSAGE";s:14:"' . "\0" . '*' . "\0"
  . 'classSuffix";s:5:"Model";s:23:"' . "\0" . 'yii\base\Model' . "\0"
  . '_errors";N;s:27:"' . "\0" . 'yii\base\Model' . "\0" .
  '_validators";N;s:25:"' . "\0" . 'yii\base\Model' . "\0" .
  '_scenario";s:7:"default";s:27:"' . "\0" . 'yii\base\Component' .
  "\0" . '_events";a:0:{}s:30:"' . "\0" . 'yii\base\Component' . "\0"
  . '_behaviors";N;}')

When I try to access this value directly though, I'm only ever able to get the default value. I had expected to return the user customize value instead.

Craft::trace($this->settings->someField, __METHOD__);

returns:

  Some Default

Here's a link to the full 'non-working' version of the plugin that demonstrates the issue.

https://github.com/johnfmorton/craft3settingsTestPlugin

So, my question is how can I retrieve the individual settings for my Craft 3 plugin?


texts: Entry Count plugin performance / template optimisation

texts:
I'm using Ben Croker's Entry Count plugin in my News channel but have noticed a huge performance hit, I know its probably down to how I am loading the entries in to my template so I am looking for some help on that please.

The News Channel where it is being used has tens of thousands of entries.

The server logs highlighted this query https://pastebin.com/02uF0Mat taking up to 3 minutes to complete, therefore maxing the CPU and crashing the site.

My template code:

{% cache globally using key "trending-news" %}
    {% set countedEntries = craft.entryCount.entries.section('news').limit(4) %}

    {% for entry in countedEntries %}

{{ entry.postDate.format('jS F Y') }}
{{ entry.title }}

    {% endfor %}
{% endcache %}

So I think this code is loading thousands of news entries and then displaying only 4, is there a way I can just load the top 4 only?

Massive thanks in advance!


texts: I have a situation where I need a form to submit and be sent to my company's email address AND to an email address outputted from an email field from the entry that the form sits on. Is it possible to have a hidden input in the template that contains the email addresses I want the notification to go to?


texts: How do Twig filters interact with concatenated strings and shorthand "if-else" ( `var ? true : false` ) strings?

texts:
If I am outputting content like this:
{{ entry.maxWidth|length ? entry.maxWidth ~ 'px' : 'unset' }}

...and I want to apply the |raw filter to the output (nevermind if it makes sense in this case; it's just an example), where do I put it?
Do I go overboard, applying the desired filter to each bit of string, like this?
{{ entry.maxWidth|length ? 'max-width: '|raw ~ entry.maxWidth ~ 'px;'|raw : 'max-width: unset;'|raw }}

Is it applied after any string concatenation (~) is done?
{{ entry.maxWidth|length ? 'max-width: ' ~ entry.maxWidth ~ 'px;'|raw : 'max-width: unset;'|raw }}

Or is once per set of double-brackets ({{ ... }}) sufficient?
{{ entry.maxWidth|length ? 'max-width: '~ entry.maxWidth ~ 'px;' : 'max-width: unset;'|raw }}


texts:
In this video it looks like Courtney has tabs (Content | Design) in the individual fields in a Matrix. I can't work out how to do this, is it a plugin? It seems a great way of organising the fields for the editor

https://vimeo.com/294976443

Screengrab:

Thanks for any insight


texts: What variables are available to redirectToPostedUrl?

texts:
Craft's Web Controller has a redirectToPostedUrl method. Copied here for the sake of discussion:

public function redirectToPostedUrl($object = null, string $default = null): YiiResponse
{
    $url = Craft::$app->getRequest()->getValidatedBodyParam('redirect');
    if ($url === null) {
        if ($default !== null) {
            $url = $default;
        } else {
            $url = Craft::$app->getRequest()->getPathInfo();
        }
    }
    if ($object) {
        $url = Craft::$app->getView()->renderObjectTemplate($url, $object);
    }
    return $this->redirect($url);
}

We can call this method from our plugin controllers to redirect to the posted URL in the redirect input field and use a dynamic {siteUrl} variable. In my template, I have a redirect value that uses {siteUrl}:

<input type="hidden" name="redirect" value="6026760a62b9c6007a4b5695a65acbabG2540f8cb3727b998a1c78da45db863f{siteUrl}?id={id}">

And in my Controller, I receive that value and redirect to that location:

return $this->redirectToPostedUrl($object);

That all works fine. I can pass my custom $object to this method and the {id} or any other part of the model I wish to process can appear in the URL.

My question is, where is {siteUrl} being made available to the redirectToPostedUrl method? In looking closer at renderObjectTemplate it never appears to specifically make global variables available. And, if I try other global variables such as {currentUser.id} nothing gets rendered. In Craft 2 I believe this method made environmentalVariables available for parsing but those are no longer supported in Craft 3.

So why and how does {siteUrl} work? Are there other variables that are available to be used in the redirect URLs too that we don't explicitly make available by passing them in via the $object argument?


texts:
I'm working on a website where members can add entries with the frontend form.

After creating the entry I want them to change the "status" with custom field by sending them an email link. The link is send with postmaster after x amount of days.

How can I do this in a safe way? Using GET (if user is logged in)?

site.com/status/?entry_id=200&status=new_status

Is it possible with just a twig template?


texts:
Is it common to have a (near)constantly running 'Deleting stale template caches' task ongoing? I commonly log in to see a task still pending several hours after the last change to the site was made, looking in the database the task usually has 50000+ 'steps'. Each step runs reasonably quickly (although it sometimes hangs) but the process appears to be taking up quite a lot of disk IO according to newrelic and clearly some pages are not getting their cache cleared for quite some time...

What could cause this and it it solvable?

If it's any help I have a reasonably large dynamic menu that i've put in 'cache' tags around and also have one channel with >1200 entries in it and the site is in 5 languages (although the channel with 1200 entries isn't localised) so this isn't a tiny site, performance still seems sluggish at times however.


texts:
Hi I have a plugin which is basically a form. This form has upload file field which I added in the backend side in Assets fields so I have something like this:

                <fieldset>

                        Upload File
                        <input type="file" name="fields[myAssetNameHandle]">

                </fieldset>

I send the form to the server with ajax like this:

    var formData = new FormData($form[0]);
    $.ajax({
        type: 'POST',
        dataType: 'json',
        url: '{{ actionUrl("myplugin/sendApplication") }}',
        data: formData,
        processData: false,
        contentType: false,
    ......

On the myPluginController I have validation

    $model = new myModel();
    $model->test_var = craft()->request->getPost('test_var');

    if ( $model->validate() ) {

    }else{

    }

Evrithing works fine except that I did some restriction to upload files on that asset field for example only documents so when I upload an image I do not have any errors. So how can I get the errors for that field and if there are no erorrs how can I get the name so After validation to add the file into the db? Thank you in advance and sorry for my English if is not so good.


texts:
I keep getting this error when I go to install Craft: "Declaration of Craft\UrlManager::parseUrl() should be compatible with that of CUrlManager::parseUrl()"

I am installing on a subdomain.  The database credentials are in place, the permissions are correct and the craft folder is found.

I have devmode enabled and the last stack trace item is pointing to "craft/app/etc/web/UrlManager.php(18)".


texts:
Folks:

This is surely something real basic. I have not been able to create a database backup manually or when updating.

Mysqldump is installed.
I know the location of mysqldump (/usr/local/bin/mysqldump).
The log doesn't appear to reveal anything.

I have modified the .env file using the info from the MAMP database backup article (substituting the path for the MAMP one in the article). No joy.

According to the config docs, I need to change the PATH variable.

The question is: how do I do this? Specifically:

Where is this change made? Which file? general.php? .env? Elsewhere?
What is the syntax to make this work?


texts: Is it possible to set up and manage stock in Craft Commerce even if a product stock goes into the negative? The current commerce project I'm working on is open to the public so anyone can add items to a cart but only registered and approved members will have the ability to submit carts as orders. What I would like to be able to do is keep out of stock products available in the store so that they can be added to carts and orders. The orders are manually processed so an out of stock item just means that further production is needed. Tracking negative stock would also help guide production because it would give insight into how many of a given product is needed at any given moment in time.


texts:
I have a structure section, where the last child should be an anchor in the slug:

parent/parent#child

I'm trying to setup conditional url formats on nested entries as such:

{parent.uri}{% if object.getDescendants().total() != 0 %)/{% else %}#{% endif %}{slug}

I've also tried the simpler

{parent.uri}{% if object.hasDescendants %)/{% else %}#{% endif %}{slug}

but keep getting stuck tasks when re-saving entries. Can someone tell me what I'm doing wrong? Thanks in advance


texts: What is the appropriate way to query and Hard Delete existing Soft Deleted Elements for a Custom Element?

texts:
I have a Custom Element where the Soft Delete functionality is not necessary. Right now, existing users of this plugin may have thousands of Soft Deleted Elements in their Elements table that don't need to be there.

I am writing a migration that removes those, and, making some other updates so that when they get deleted in the first place, they get hard deleted.

Where I'm not clear on what the appropriate path forward is how to delete the existing Soft Deleted Elements. As far as I can tell, running the Garbage Cleanup hardDelete method is not really the right way to do this as I can't target a specific Custom Element of my choosing - it's all or nothing. I don't want to delete Soft Deletes that may be important for users, I just want to delete the ones in our plugin.

Next,it seems I can't use deleteElementById as it doesn't give me a way to indicate I want to Hard Delete, so I need to use the deleteElement method called by the deleteElementById method and recreate any code necessary to convert the ID into an actual Element class that I can pass to the deleteElement method. Something like:

foreach ($results as $key => $elementInfo) {
    $element = Craft::$app->elements->getElementById($elementInfo['elementId'], MyCustomElement::class, $elementInfo['siteId']);

    if ($element && !Craft::$app->elements->deleteElement($element, true)) {
       // Fail
   }

   // Success
}

However, this doesn't appear to work either because getElementById returns null, I expect because it's excluding Soft Deleted items from what it's retrieving.


texts:
Is there a possibility or plugin that I can see all my tags that I am using on my Craft page?

So that I can edit the tags when I, for example, wrote some tags wrong or just want to delete some and so on.

All the best.


texts:
In Craft 2 there used to be a Nested Entries field, but this is not available in Craft 3.

I know I can do {parent.uri}/{slug} in the Entry URI Format field, but if I want it to be appended by something static it doesn't work.

i.e. static/{parent.uri}/{slug} doesn't work because children uri sets to static/static/parent/child (edited)


texts: How can I display the related posts (by category) at the bottom of each post?

texts: I'm converting a WordPress blog to Craft - first time playing with categories in Craft, so how can I display the related posts (by category) at the bottom of each post?


texts:
Hi I'm fairly new still to CraftCMS. I built one website with it a few years ago and have tinkered with it ever since and I do like it a lot. What I've been asked to do is create a website directory for front end users to create an account and add their own content. It sounds like it might be beyond my ability though. Normally I develop in Wordpress (building bespoke themes and scripting custom fields) but even with something like this I would still resort to a plugin. Is this something that can be done fairly straight forward with Craft or do you know of a plugin for Craft that would achieve this?
Each account should get approval by admin before going live. They can then upload a profile picture, bio, gallery of images, text, video, and pdf and change password, email and other user details. It should also have it's own interface styling rather than Craft CMS back end interface. I have attached a crude example of what I have been asked to look into.
If you could give me a few pointers as to where I should look to see if it's something I could take on then that would be a great help.
Thanks very much.


texts: I'm looking to create an infinite scrolling section of entries on a site we're building. Has anyone tackled this yet? What's the best way to approach this?


texts:
I've been away from using Craft (and web development in general) for a while now.
I'm having trouble getting the assets paths working for a site in my config, I gather things have changed since I last used Craft:
use craft\helpers\App;

$isDev = App::env('ENVIRONMENT') === 'dev';
$isProd = App::env('ENVIRONMENT') === 'production';

return [
// Default Week Start Day (0 = Sunday, 1 = Monday...)
'defaultWeekStartDay' => 1,

// Whether generated URLs should omit "index.php"
'omitScriptNameInUrls' => true,

// The URI segment that tells Craft to load the control panel
'cpTrigger' => App::env('CP_TRIGGER') ?: 'admin',

// The secure key Craft will use for hashing and encrypting data
'securityKey' => App::env('SECURITY_KEY'),

// Whether Dev Mode should be enabled (see https://craftcms.com/guides/what-dev-mode-does)
'devMode' => $isDev,

// Whether administrative changes should be allowed
'allowAdminChanges' => $isDev,

// Whether crawlers should be allowed to index pages and following links
'disallowRobots' => !$isProd,

'dev' => [
    // Base site URL
    'web' => 'http://url.test',
        'baseUrl' => 'http://url.test/',
        'assetsBaseUrl' => 'http://url.test/assets',
        'assetsBasePath' => '/Users/test/Documents/Google Drive/htdocs/test/web',

],

];


texts:
The company whose website I'm building host events, and for each of these events, it is only possible to purchase tickets on certain days, but for each event, there can be more than 1 such day.

They want a view which shows:

Event A

Ticket sale days: day 1, day 2

Event B

Ticket sale days: day 1

Event C

Ticket sale days: day 2

And another view which shows:

Ticket sale day 1

Event A
Event B

Ticket sale day 2

Event A
Event C

I'm currently using a single-column table field for the ticket sale days which allows me to add as many dates as I wish. With this, I can implement the first view above really easily by looping over the rows in the table.

However, the second view has me stumped since I am unable to group the entries by the rows in the table field. Note that I want to keep this data within a single 'events' section.


texts: Excessive resource usage / virtual memory size

texts:
Our server is generating lots of emails that follow this template:

subject:

lfd on host.foo.com: Excessive resource usage: foo (24056 (Parent PID:16356))

body:

Time:         Wed Jan 31 11:31:20 2018 -0500
Account:      foo
Resource:     Virtual Memory Size
Exceeded:     556 > 512 (MB)
Executable:   /opt/cpanel/ea-php71/root/usr/bin/php-cgi
Command Line: /opt/cpanel/ea-php71/root/usr/bin/php-cgi /home/foo/public_html/index.php
PID:          24056 (Parent PID:16356)
Killed:       No

Sometimes I can attribute these to image transforms, but other times they appear somewhat randomly. I received 13 in a row earlier today. I've seen this type of email from several servers that run Craft sites. I've researched excessive resource emails in general, but the answer always seems to be "just add it to csf.pignore" - which I don't want to do.

So, I'm wondering if anyone knows what Craft process may be generating this type of email. I don't think that we're doing anything out of the ordinary.

Thanks!


texts: How do I proceed when I want to show another language when the actual language is deactivated?

texts:
I have two languages (German and French).
In my sections I have German enabled as default language. French is off by default.

My Problem is:
I always want to show content, even if the other language is disabled and, when an entry is not translated yet, show a note like "Entry not translated yet."

I know about localeEnabled and status and I can query the following way:

{% set entries = craft.entries.section('referenzen').localeEnabled(false).status(null).find() %}

That outputs all of the entries.
But I am running into problems with the "_entry" template.

And I don't really know how to differentiate between entries that have their status turned off vs. entries that only have a language turned off.

Does anybody have a solution to this problem?

Cheers
Stefan


texts: MySQL "Access denied for user" after moving to new server

texts:
I've moved my Craft 3 installation to a new server.

When connecting to the original database, everything works fine.

However, when trying to connect to a new MySQL database (I've tried hosting this on both the new server and RDS) I'm getting the error: Access denied for user. I migrated to the new database by exporting via the Craft CP and then importing to the new database via MySQL Workbench.

I've tried connecting to both servers using a vanilla PHP connection (i.e. new mysqli(host, username, password) and it works perfectly fine -- I can even query the database and return results.

I only run into this error when the connection is opened by the original Craft index.php (the one with the $app->run() command). I've checked the output of the (new Dotenv\Dotenv(CRAFT_BASE_PATH))->load(); line and it does properly return the settings defined in .env, which are the same as the ones used in the vanilla connection I mentioned above.

The side-effect of this error in storage/logs/phperrors.log is Allowed memory size of <memory_limit> bytes exhausted ... in /var/www/craft/vendor/yiisoft/yii2/db/Connection.php.


texts: For those who have implemented Craft Commerce and needed product reviews, what has been a good solution for you?


texts:
I'm currently doing the following query, it's working nicely on my local environment but on Production it's allowing all users to see all entries which is really strange? I can't see anything wrong with my code that would be causing this to break?

{% set campaigns = craft.entries.section('campaigns').authorId(currentUser.id).all() %}
{% set proposals = craft.entries.section('proposals').relatedTo(campaigns).all() %}
{% set proposalsByGroup = proposals|group('proposalStatus') %}


texts: Bulk resave entries to trigger onSaveEntry event

texts:
I have a site with a hundred+ or so entries. I've added a new field to my entry template, but it won't take effect until it's been activated by a onSaveEntry event.

I've gone through maybe 15 entries or so now and resaved them manually, but it's proving to be a long and painstaking process.

Is there a way for me to batch resave all enabled entries in order to trigger this onSaveEntry event?


texts: How does a plugin make use of Craft's storage?

texts:
I am building a plugin that needs to cache generated images into a directory in Craft, presumably the craft/storage directory. I took a glance in the docs, but couldn't find much in the form of how to use storage. When building similar functionality in EE I used the their cache directory, so looking for something similar with Craft.

So how does one cache generated files in local directory so they can be used later to prevent the overhead of constantly having to generate the image?


texts: Can you override the default sendmail path in Sendmail transport config in Craft 3?

texts:
Many shared hosting accounts require custom flags that are passed to sendmail in order for them to work properly.

Since Craft 3 uses Swiftmailer for its mailing library and Swiftmailer's default Sendmail command is /usr/sbin/sendmail -bs (https://github.com/swiftmailer/swiftmailer/blob/master/lib/classes/Swift/Transport/SendmailTransport.php#L30), is there a way to override that from Craft's config/app.php to set a custom sendmail command?


texts:
What is the best method to render Javascript on specific page using name instead of id. This is what I found but not sure how to use name instead.

{% if entry.id == 2 %}
{% endif %}

{% if entry.section == homepage %}
    //Content goes here
{% endif %}


texts: Plugin fieldtype settings for ColumnType::LongText being inserted as varchar(255)

texts:
I’m working on a plugin that includes a custom fieldtype. Using Craft 2.6.2911, the fieldtype’s defineSettings looks like this:

public function defineSettings ( ) {
    return [
        'json_data'  =>  [
            AttributeType::String,
            'column'  =>  ColumnType::LongText
        ]
    ];
}

When I add this field to a tab group, the new column is added to the craft_content table as a varchar(255), not a text-type column.  Is there an additional definition I need somewhere?

I did not see a relevant note in the changelog for builds of Craft between 2.6.2911 and 2.6.2944.

When reviewing my database schema, I'm seeing the following:

| field_jsonSync             | varchar(255)           | YES  |     | NULL    |                |


texts: How can I store Craft sessions in the database?

texts:
Is it possible to configure Craft 3 to store session data in the database? On some other CMS's this can be enabled.

The reason I'm exploring this is because we're having an issue whereby PHP sessions get "locked up" due to a long-running request that forces all other PHP requests under the same session to be queued up until the prior ones complete (until the session files are written and released from their lock). This isn't ideal.

The problem is a common one amongst PHP apps that use file-based sessions. This article explains it in-depth:
https://ma.ttias.be/php-session-locking-prevent-sessions-blocking-in-requests/

I've seen this plugin which appears to support DB sessions in Craft 2, but haven't come across anything for v3.


texts: syntax error, expecting variable (T_VARIABLE) in Search Plus Custom Mapping

texts:
I’m looking for a little help with Custom Mapping for the Search Plus plugin. I think(?) I'm getting pretty close, but stuck on something (and I do front end web design, so this is just over my head) I’m using https://transition.topshelfcraft.com/software/craft/searchplus/usage/hooks-events as a reference and used https://pluginfactory.io to create the plugin.

Per the instructions in the documentation above, I’ve added this to the bottom of the plugin :

public function searchPlus_addAlgoliaMapping()
{
    $ret = [];
    $ret['name'] = 'GHCC Staff Mapping2';
    $ret['handle'] = 'GHCC_Staff2';
    $ret['description'] = 'Mapping for Staff Page';
    $ret['method'] = 'example.testMapping';
    return $ret;
}

public function testMapping(element)
{
    $ret = [];

    $ret['objectID'] = $entry->id;
    $ret['title'] = $entry->title;
    $ret['activityId'] = $entry->id;
    $ret['id'] = $entry->id;
    $ret['slug'] = $entry->slug;
    $ret['url'] = $entry->url;
    $ret['uri'] = '/' . $entry->uri;

return $ret;
}

But am getting an error: syntax error, unexpected ')', expecting variable (T_VARIABLE) referencing line 186  public function testMapping(element)

Was wondering if anyone had any tips

Thanks!


texts: Min/Max numeric search returning odd results

texts:
Following on from my earlier search question...

Searching for entries across multiple fields including a relationship

I'm finding that the min/max wage search behaves oddly.

I have a range of wage values from 95 to 175.

If I search for a min of 95 with no max then I only get results from 95 up to 100.

Likewise if I search for a max value of 150 then I only get results greater than 100 and less then or equal to 150.

If I use both min and max criteria then I get no results.

I'm guessing this is something to do with variable type but can't see how I can force the variables to be integers/numbers rather than strings.

The simplified code I'm using to do the matching is:

{% set wage_from = craft.request.getParam('wage_from') ? craft.request.getParam('wage_from') : 0 %}
{% set wage_to = craft.request.getParam('wage_to') ? craft.request.getParam('wage_to') : 9999 %}

{%
  set results = craft.entries({
      section: 'vacancies',
        wage: [
          'and',
          '>= ' ~ wage_from,
          '<= ' ~ wage_to,
        ]
    })
%}


texts: "An unknown error occurred." appears when I try to log into Craft's admin using browsersync's proxy mode

texts:
I've stumbled upon a weird thing.

When I run browsersync as browser-sync start -p localhost:8000 and try to log into Craft's admin at localhost:3000/admin I get the message "An unknown error occurred."

If I enter the wrong password, nothing at all appears nor happens.

This can be worked around by logging in once at localhost:8000/admin, and then accessing the proxied version after... But I'd be sweet if I could login through the proxied version :)

Any suggestions on how this can be resolved?

Here's the log generated once I've deleted all the contents of the logs and then press the login button: http://pastebin.com/3LjbQLj0


texts: Unknown Errors when trying to select category

texts:
Just like the post says, I'm getting unknown errors when selecting a category from a field. Nothing shows up in the craft error logs but here's what the console says:

Just wondering if anyone else experienced this or if it's just a problem with our build.


texts: How to extract a list of "copy password reset urls" for all users?

texts:
We are migrating users from a e-commerce site to a new craft commerce 2.x site.

Apparently it's a little too confusing for our customers to use the "forgot password" link to obtain a new password.

So our idea was to send them an email with their username and a link where they can directly set their password.

e.g. "user1", "https://mysite.com/actions/users/set-password?code=qwaZDk6mSa0tbnLBx8U4WkTnTBclK1ZZ&id=779e05ca-5c39-4f66-a56c-9a431bd0b355"

Is it possible to obtain these links programmatically.

We have about 800 users, so copy/pasting them would be very tedious.

any hints?

Cheers
Stefan


texts: How do I upload photos into my assets list/library?

texts:
I get the following error message when I try to upload the photo:

"Upload failed. The error message was: Error uploading the file: The file system path "/home/tramweb/public_html/craft/assets/content/" set for this source does not exist."


texts: Redactor has destroyed my mailto links, now what?

texts:
I migrated from EE > CraftCMS. The email links in my EE WYGWAM fields were encoded as JS. When we imported to CraftCMS we lost all of those links. They now look like this:

joe@schmoe.com

Any ideas on how I could fix this? Perhaps I can pass my Redactor field through a filter that looks for an email pattern, and use Retcon to rewrap the link?

I'm looking for a solution that does not involve reimporting my data, as it's not an option at this point.


texts: Output tags from matrix fields related to an entry

texts:
Using the code below, Craft was able to get related tags to an entry, before I decided to move TagFieldType to MatrixFieldType.

{% set entries = craft.entries %}

{% for entry in entries %}

{{ entry.title }}

   {% for tag in craft.tags.relatedTo(entry) %}

     { tag.title }}

 {% else %}

No tags found

 {% endfor %}

 {% endfor %}

I'm quiet struggling to pull tags out so I rather share with you my Field's structure in my CP.

I took many options to consider, Why I can't get it right, even found the post, that same handles may cause a problems, so I gave them all unique handles.


texts: commerce/cart/updateCart throws page not found

texts:
Adding products to the cart throws a page not found (404) error that has this header;

Page not found.
↵
Caused by: Invalid Route – yii\base\InvalidRouteException
Unable to resolve the request: commerce/cart/updateCart
in /Users/a/Sites/ae-dev/vendor/yiisoft/yii2/base/Controller.php at line 128

Very strange. Anyone encounter this issue?


texts: How do you list categories in a category group?

texts: I would like to output a list of all the categories in a category group on the front end. How do I do that?


texts: Assets are not saved in dynamically generated folders

texts:
I setup an Assets field called Images. My Default Upload Location is set as {parent.uri}/{slug}

My File System Path for that folder is img/

The directory structure that is generated is correct and in this format: img/artists/artist_name/category_name/project_name

But the images are being saved in the root img/ directory.

What am I missing?


texts: Can notes on line items be updated on checkout?

texts:
Currently, a user has to click update on each line item to save changes to quantity or a note. The quantity might make sense to the user as it updates the price, but a user could assume that the note would just need to be filled out.

Wondering if there's a simple way to allow the user to fill out notes without clicking update and have them save.


texts: Assets S3 Cache Duration and CP Thumbnails

texts:
What does everyone consider a sensible cache duration to use when using Assets with S3/Cloudfront? Is 3 hours sensible or should it be longer?
Secondly, does this have any impact on the assets being displayed within Craft? Listing Asset directories takes a while due to my connection speed I'm sure but aren't these assets cached locally?


texts:
I'm having a problem getting entries related to a tag with accentuated characters.
Here is what the URL looks like : fr.craft.dev/actualites/tag/Traçage%20électrique

The same page work fine with a tag without accents.

Is there anything special to do to fix this on my side ?
Or is-it a problem with craft ?
Here is my code :

{% set tag = craft.tags.name(tag).first() %}
{% set newsCriteria = craft.entries.section('news').relatedTo(tag).limit(5) %}

Thanks for your help.

Nicolas


texts:
I'm building a simple contact form plugin and I would like to be able to provide a default form that the developer can include in his own template.

Most plugins I've seen provide the controller and all the code to process a submitted form but you still have to create your own form.

At the moment I tried 2 methods, using a hook and a template variable.
While both work I was wondering if there wasn't a better/cleaner method.

The downside of using a hook is that you can't pass variables to the template (or am I wrong?) and the template variable feels like a misuse of the functionality.

Isn't there a way to use the existing twig import function? Maybe by registering a namespace twig path in the plugin?(https://symfony.com/doc/current/templating/namespaced_paths.html)


texts: How to create delayed charges with Craft Commerce or use Stripe's stripe-php library directly

texts:
I need to have delayed credit card charges for my client.  From
Stripe's end it looks fairly straightforward by creating a customer and
saving their information for a later charge.

https://stripe.com/docs/charges#saving-credit-card-details-for-later

But, it looks like Omnipay doesn't support Stripe's Customers.
https://stackoverflow.com/a/29862591/2177602

One solution might be to create my own payment gateway plugin for Craft commerce
that doesn't use Omnipay but it's implied that Omnipay is required according to
https://craftcommerce.com/docs/payment-gateways#adding-additional-gateways.

It looks like I need to use Stripe's stripe-php library directly.  How
would I do that and integrate with Craft commerce?


texts: filter matrix blocks by multiple light switch value, and then merge them

texts:
I have a (Craft 3) matrix field with two different block types that each have a similar light switch field that I want to use to create anchor links on my page.
I need to be able to test whether any of the fields have the light switch enabled, and also loop through all of those entries.

Orignally, both light switch fields were named 'anchor', but that seemed to cause problems, so now they have two different labels. I'm having trouble combining them into a single object though, or even working with them separately in the same template:

{% set anchors = entry.pageBuilder.type('subhead').anchor('= 1') %}
{% set anchorLinks = entry.pageBuilder.type('copy').anchorLink('= 1') %}

Anchors: {{ anchors|length }}
AnchorLinks: {{ anchorLinks|length }}

If I use the code above as-is, the value of one of the objects is always 0. But if I use either of those lines indivdually, they return the proper value.

I also tried merging the two objects, but I still run into the same issue of the value of one of the objects being incorrectly set to 0.

{% set anchors2 = entry.pageBuilder.type('copy').anchorLink('1').find() %}
{% set anchors1 = entry.pageBuilder.type('subhead').anchor('1').find() %}

{% set allAnchors = anchors1|merge(anchors2) %}

one {{ anchors1|length }}
two {{ anchors2|length }}
all {{ allAnchors|length }}

{% for anchor in allAnchors %}
    {{ anchor.subhead }}
{% endfor %}

Is this a bug, or am I doing something wrong?


texts: Where do you set PEM file passphrase for Craft CMS Push Notification Plugin for an iOS app?

texts:
Does anyone know where to set the passphrase for the PEM file that is configured in the Push Notification Plugin for Craft CMS?

I have created a new app and set the Certification Location to the PEM file location. I have tested on the server to confirm that the certificate and key files work. However, when I try to send a new alert -- I get the following error:

stream_socket_client(): Unable to set private key file

Which I'm sure is due to the fact that I haven't told it what the passphrase is. However, I can't find any documentation that explains where to put this configuration setting.

Any help is greatly appreciated.

Plugin Github Reference: https://github.com/boboldehampsink/pushnotifications


texts: Apply imageTransform on twitter media feed

texts:
{% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended', count: 20 }) %}
            {% if response.success %}
            {% for tweet in response.data %}
            {% if tweet.extended_entities.media is defined %}
            {% for item in tweet.extended_entities.media if item.type == 'photo' %}

            {% endfor %}
            {% endif %}
            {% endfor %}
            {% endif %}

This throws a Runtime error: Impossible to invoke a method ("getUrl") on a string variable ("http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg").

What other method is possible?

Using the Imager plugin:
{% set externalImage = 'http://pbs.twimg.com/media/DlAIWwkUcAAY_3u.jpg' %}

{% set transformedImages = craft.imager.transformImage(externalImage, [
                { width: 200, height: 200 }])
              %}
         {% set response = craft.twitter.get('statuses/user_timeline', { tweet_mode:'extended', count: 20 }) %}
            {% if response.success %}
            {% for tweet in response.data %}
            {% if tweet.extended_entities.media is defined %}
            {% for item in tweet.extended_entities.media if item.type == 'photo' %}

            {% endfor %}
            {% endif %}
            {% endfor %}
            {% endif %}}


texts: How do I get Matrix elements to copy their content across language Locales?

texts:
I returned to a site designed months ago, and added a second language to it.

From the beginning, this site had prominent composition of entries out of multiple elements in their matrix, with formatting choices selectable on the elements (like positioning and size for images; or position left or right for compound pull quote/citation blocks.

This all works fine, and now in languages. However, there is the fact that languages other than the first used seem not ever never to have their Matrix of content blocks copied over into the new language. The Matrix is there, of course, but empty.

This emptiness is the case with first save starting with an entirely fresh entry, which is a noted in the add as the only case at present where Craft normally copies content to other available languages, and very handily so.

Really I think this is a bug report, but maybe not?

Add:

At present copy over does, as commented below, operate only at the point of first save to a first language. If you edit after saving, only that first save will have been copied, and your edits won't be. If you add fields to the section, and fill them in for a first language, nothing will be copied for those to other languages.

This is clearly worth looking into for persons who use multiple languages/Locales, but isn't so simple to do well, and I believe it is somewhere down the list for Craft futures, likely properly so compared other desires. Worth mentioning, though ;)


texts:
I'm currently using a route to get a specific asset for a gallery section of my site. URL is similiar to http://craft.dev/place/place-name/gallery/1 (Where 1 is the number in the gallery.)

I'm currently doing the following in the template

{% extends '_layout' %}

{% set entry = craft.entries.slug(craft.request.getSegment(2)).first() %}

{% set image = entry.images[craft.request.getSegment(4) - 1] %}

{% block content %}

    {{image.getImg('featuredImage')}}

{% endblock %}

It works currently but is there a cleaner way to do it without the - 1?


texts: No index.php file created during install using composer

texts:
This is on Centos 7.5 using a vmware local vm

Installed Apache, MariaDB 10.2, PHP 7.1 (Remi) in that order

Logged in as root, no sudo or su

Installed composer 1.6.5 without issue

  cd /var/www/html
  composer create-project craftcms/craft .
  ./craft setup
  No errors or warnings after confirming "yes" to "Install Craft now?"

I had the same problem trying to install from the archive manually but I figured I might have done something wrong so I set up a clean new LAMP VM and used only composer. I appreciate any help.

Directory contents below

  [root@localhost html]# ll
  total 128
  -rw-r--r--  1 root root    387 Jul 17 13:37 composer.json
  -rw-r--r--  1 root root 100025 Jul 26 15:02 composer.lock
  drwxr-xr-x  3 root root     88 Jul 17 13:37 config/
  -rwxr-xr-x  1 root root    577 Jul 17 13:37 craft*
  -rw-r--r--  1 root root    330 Jul 17 13:37 craft.bat
  -rw-r--r--  1 root root    926 Jul 26 15:06 .env
  -rw-r--r--  1 root root    875 Jul 17 13:37 .env.example
  -rw-r--r--  1 root root     31 Jul 17 13:37 .gitignore
  drwxr-xr-x  2 root root     24 Jul 17 13:37 modules/
  drwxr-xr-x  4 root root     51 Jul 26 15:02 storage/
  drwxr-xr-x  2 root root     40 Jul 17 13:37 templates/
  drwxr-xr-x 28 root root   4096 Jul 26 15:02 vendor/
  drwxr-xr-x  3 root root     77 Jul 17 13:37 web/


texts: Restricting access to user groups with Control Panel access only

texts:
I know I can restrict template output to Admins only with :

{% if currentUser.admin ?? false %}

…and to any logged in user with:

{% if currentUser ?? false %}

And I’m aware of accessCp as a permissions handle.

Can I use that, or similar, to restrict template output to any user group that is allowed to access the CP – without having to cycle through specific user groups in the template?

I tried:

{% if currentUser.accessCp ?? false %}

…but that doesn't work.

I'm using Craft 3.1.29.


texts:
Getting this error in the PHP error log file while trying to install craft.

PHP Fatal error:  Class 'Craft\DbCommand' not found

The file is there, permissions are granted and I've tried reinstalling twice. Any other ideas?


texts: URI is not a valid URI error after recent update

texts:
Has this old issue recurred in a very recent update:
URI is not a valid URI

Just a few weeks ago I imported Korean content using FeedMe just fine, I have a setting 'limitAutoSlugsToAscii' => false, also. All Korean content and URLs were correctly showing in Korean.

I have updated Craft several versions since.

I need to do a re-import, but Korean is now all in English, and I get errors in FeedMe:

KO Categories Feed: Node #30 - {"uri":["URI is not a valid URI"]} - Process.php: 460.

If I manually edit the entry and set the URL to say 무게_감지_센서, the Admin CO also shows the error:

URI is not a valid URI

Thanks


texts:
I'm having a problem installing locally on my Mac (using MAMP Pro, Sequel Pro).  I followed all the steps in the Mijingo installation video - plus a few others.  When I go to install Craft CMS I get the following error message:

  Service Unavailable  Our site is temporarily unavailable.  Please try again later."

I checked terminal and .htaccess appears hidden under the public directory.  I changed the permissions.  And the config file appears to be pointing in the correct places.

What might I be missing? ...or at the very least, how do I delete and start again fresh?  Is it as simple as deleting the Craft files and starting over again or are there hidden files that need to be addressed before I can start clean again?


texts: Your usual setup for blogpost matrix field

texts:
What is your usual setup for blogpost/article matrix field?

I can think of:

Header
Richfield
Quote (author+text)
Image(asset, position, description)


texts: Entry Tracker to see who has completed the course

texts:
I'm working on a project using Craft CMS for the first time, so far so good, however i'm stumped on how to do the following:

Create a button on each entry in a structure that states you have read the follow article. When you click you have read the article, it reflects on your account page that you have read the follow article(s).

Hopefully this makes sense, but it's almost like a LMS, you learn about something on the page you click you have completed the stage then move on to the next stage.

Thanks!


texts:
Is there a lesson/tutorial/docs about going from local to production on server with Craft 3?

What files should be uploaded  ( and which not )
What folders need to be one level up of the root - where to change the paths to this folders
Change config files.
Go from dev to production.

Thank you!


texts: Preserving  tags inside a  tag in a Redactor rich text field

texts:
If I have multiple paragraphs of text in a rich text field, and I select them all and select "Quote" from the formatting menu, the
 tags are stripped out and replaced with double
 tags, like so:

This is some text.

Here's some more text.

Is there any way to preserve the
 tags, like so?

This is some text.

Here's some more text.

I've been through the Redactor documentation and config settings and haven't found anything that seems relevant.


texts: Getting orders by property in Commerce 2 from Plugin

texts:
In Commerce 1 i can select orders by a specific property as follows:

$criteria = craft()->elements->getCriteria('Commerce_Order');
$criteria['orderStatusId'] = 1;
return craft()->elements->getCriteria('Commerce_Order', $criteria);

How can i do this in Commerce 2?


texts: PHP Error - Cannot modify header information - headers already sent

texts:
Trying to run an import using the Import Plugin but I keep getting errors.
Checking the Logs the error is:

Cannot modify header information - headers already sent (C:\sitepath\craft\app\framework\web\CHttpRequest.php:1490)

The line 1490 is the first setcookie line in the code below:

I have tried downloading the latest version of Craft but has made no difference.

protected function removeCookie($cookie)
{
    if(version_compare(PHP_VERSION,'5.2.0','>='))
        setcookie($cookie->name,'',0,$cookie->path,$cookie->domain,$cookie->secure,$cookie->httpOnly);
    else
        setcookie($cookie->name,'',0,$cookie->path,$cookie->domain,$cookie->secure);
}

Is this a Craft bug or what is the cause of this error?


texts: Smart Map - Output map locations from relationship file in a matrix

texts:
I have "locations" section where each entry is a location, with a Smart Map field for the address.

I have another section "pages", where I have a matrix field which contains an entry relationship field, where I can select entries (locations) from the first channel.

I'm trying to output a map of all locations selected in my matrix field, but I'm getting an error:
Property "Craft\SmartMap_AddressModel.title" is not defined.

I'm using the code below to get the address fields from the individual entries, and put them into an array. I think maybe I'm not understanding what exactly needs to be in the locations array:

{% set locations = [] %}

{#  loop though all relationship fields for this entry #}
{% for block in entry.pageBuilder.type('listingGroup') %}

    {#  loop through related entries #}
    {% for member in block.listing %}

        {# get individual entry address #}
        {% set address = member.address %}

        {# add entry address to locations array #}
        {% set locations = locations|merge([address])%}

    {% endfor %}
{% endfor %}

{{ craft.smartMap.map(locations, options) }}


texts: Eager loading EntryElementType from custom ElementType in a plugin

texts:
trying to get my head wrapped around eager loading element relationships in my plugin. A little context, I’m working on a navigation module and I have a Node element type, which belongs to a Navigation and has one Entry element type:

public function defineRelations(){
return array(
  'element'    => array(static::BELONGS_TO, 'ElementRecord', 'id', 'required' => true, 'onDelete' => static::CASCADE),
  'navigation' => array(static::BELONGS_TO, 'Navee_NavigationRecord', 'required' => true, 'onDelete' => static::CASCADE),
  'entry'      => array(static::HAS_ONE, 'EntryRecord', 'entryId', 'required' => false),
);

}

When I’m getting my nodes, I’d like to eager load the entry for each node. This is where I’m just sort of falling down on they syntax. If I currently have (without eager loading):

$criteria = craft()->elements->getCriteria('Navee_Node');

Would I eager load the entries by doing something like:

$criteria = craft()->elements->getCriteria('Navee_Node')->with(ElementType::Entry);

I should note that what I'm really trying to do is pull the uri for each related entry without having to run an additional query every time I iterate over the navigation. So maybe my thinking is wrong and I don't need to eager load the entire EntryElement type, but just a particular field?

Thanks so much in advance for any insight you can provide.

MW


texts:
When I go to control panel > Settings > Fields, I get a page that throws TypeError: Argument 1 passed to craft\services\Fields::getGroupById() must be of the type integer, null given

This is identical to the issue described here: https://github.com/craftcms/cms/issues/3561

Any ideas as to what might be causing this issue?


texts:
Why he generate the PDF again and again when nothing changes? Is there a hidden option for that?
I tried to use it with the Google Font Rubik but no chance. Any Ideas?
Is it possible to Save the generated PDF in an Asset field to the Post?

I've a preparse Field at the Moment but I've nothing what I can prompt if it's exist or not. He also regenerate the PDF on every Save. No cool :/

Here is my Preparse Field

{% spaceless %}
  {% if not entry.preparsePrintmakerCertificate|length %}
    {% set html %}

        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>

          {{ entry.title }}

          {{ entry.postDate.format('M') }}
          {{ entry.postDate.format('d') }}

          {{ entry.postDate.format('Y') }}

    {% endset %}

    {% set settings = {
        filename : 'bestwebsite-gallery_sotd_' ~ entry.postDate.format('Y-m-d') ~ '_' ~ entry.slug|kebab
    } %}
    {% set pdfUrl = craft.printmaker.pdfFromHtml(html, settings).url %}
    {{ pdfUrl }}
  {% endif %}
{% endspaceless %}


texts: Craft 3.1 Deleting Anything Renders CMS Unresponsive

texts:
I have a Craft install setup on a LAMP Digital Ocean droplet - everything has been configured to the install requirements.

Yesterday I started having issues with not being able to delete entries, sections, categories - basically anything in the CMS. I noticed there was an update from 3.0.47 to 3.1.0, I updated hoping that would solve my issue but it has not. I looked through the php and apache error logs though there's nothing helpful there.

Clicking the delete button on anything makes the CMS go unresponsive for 3 minutes or so and then it reloads the webpage with no changes. I'm at a loss for what to do next as there's no console log errors or php/apache errors.


texts: Craft Commerce 2: Subscription Payment Gateway

texts:
I am working in Craft 3 with the Commerce 2 plugin. I am trying to create new subscription plan there. But I am not able to do so because I don't have any Payment Gateway Installed that supports subscription. I tried to find it in Plugin store but not luck.

Can anyone suggest me any Payment plugin that support subscriptions.

Thanks


texts:
Where in the Craft Control Panel can I globally delete a tag?

Not from a specific entry, but completely out of the system.


texts: Why are the email settings fields not showing, and how do I fix this?

texts:
I'm trying to set up SMTP in Craft backend Settings > Email to get Mandrill working. But regardless of which protocol I choose, no settings fields are shown, and when I click save it just says "Couldn’t save email settings". It's the same in both Firefox and Chrome.

What could be the problem here, and how do I fix it?

Many thanks in advance and best regards.

/Monkey


texts: Purging inactive carts in Craft Commerce

texts:
I've a Commerce store with orders dating back to September and have the following in my config:

'purgeInactiveCarts' => true,
'purgeInactiveCartsDuration' => 'P1M',

The docs say that the purging should be triggered by me visiting the Inactive carts area of the Commerce order section, but it isn't. Does anyone know if:

The trigger is time limited, e.g. is only called once a day?
There are any known issues with the purging of inactive carts?
Anything else I could look at?


texts: Craft 3 - Can't access the craft() in plugin controller

texts:
I'm making a Craft 3 plugin to read a CSV file and insert the data as Categories.

I used pluginfactory.io to scaffold my plugin.

I can't access craft() in my controller (ImportCsvController.php).

My controller action:

    public function actionDoSomething()
    {
      $categoriesGroups = craft()->categories->getAllGroups();
      return json_encode("hi");
    }

My namespacing:

<?php

namespace workyard\csvtocategoryimporter\controllers;
use workyard\csvtocategoryimporter\Csvtocategoryimporter;
use craft\web\Controller;
use Craft;

The error message:

Call to undefined function workyard\csvtocategoryimporter\controllers\craft()

Any ideas why I can't access craft(). Do I have to "use" something in the namespace section?