Giter VIP home page Giter VIP logo

craft-porter's Introduction

👋

Hi. I'm Jason, but most people call me Mayo, based in Manchester. I've been a self taught developer for around 15 years, but with a traditional graphic design background. Right now, I'm the Co-founder of MadeByShape, where I am the lead developer and work with global brands such as BBC, BlackBerry and 20th Century Fox right through to small-medium start ups.

On the side I'm a digital product developer working on my own ventures, as well as a Craft CMS Developer.

Working on 👨‍💻

  • Every Creative ~ Hiring platform built specifically for creative studios/agencies & products 🚀
  • Tap Tourist ~ A little guide to finding the best craft beer spots in and around Manchester 🍺

Stack 🤓

Currently using Craft CMS, Tailwind CSS, VueJS, AlpineJS, Netlify + DigitalOcean.

Writing 📝

I try to write every so often on various topics, have a read.

craft-porter's People

Contributors

bymayo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

craft-porter's Issues

Failed to instantiate component or class "bymayo\porter\variables\PorterVariable"

Hi Jason, there is a problem to include the DeleteAccountForm into my Templates (see Stack trace).
Loading the Form with {{ craft.porter.deleteAccountForm() }}

on this line:

{% if currentUser and craft.porter.settings.deleteAccount %}

I then scrolled through the History of the Plugin and saw, that you removed the namespace an the inherited libaries in the defective file: /src/variables/PorterVariable.php few Months ago.
So I just added them again and it works now ✌.

added to file /src/variables/PorterVariable.php:

namespace bymayo\porter\variables;
use bymayo\porter\Porter;
use Craft;

System:
Craft CMS 4.2.1.1
PHP version 8.1.9
Linux 5.4.0-72-generic
MySQL 8.0.23

Here the Errors:

Not instantiable – yii\di\NotInstantiableException
Failed to instantiate component or class "bymayo\porter\variables\PorterVariable".

ReflectionException: Class "bymayo\porter\variables\PorterVariable" does not exist in /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php:507

Stack trace:
#0 /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php(507): ReflectionClass->__construct()
#1 /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php(385): yii\di\Container->getDependencies()
#2 /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#3 /home/vagrant/xx/vendor/yiisoft/yii2/BaseYii.php(345): yii\di\Container->get()
#4 /home/vagrant/xx/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject()
#5 /home/vagrant/xx/vendor/yiisoft/yii2/di/ServiceLocator.php(74): yii\di\ServiceLocator->get()
#6 /home/vagrant/xx/vendor/craftcms/cms/src/helpers/Template.php(90): yii\di\ServiceLocator->__get()
#7 /home/vagrant/xx/storage/runtime/compiled_templates/e1/e1e944121636c2b1847dfdf004b49ece.php(41): craft\helpers\Template::attribute()
#8 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_d3e78d63bf730e1f32521fa5c08aa48d->doDisplay()
#9 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#10 /home/vagrant/xx/storage/runtime/compiled_templates/08/082642088bfadabf7d3776435bb0e552.php(292): Twig\Template->display()
#11 /home/vagrant/xx/vendor/twig/twig/src/Template.php(171): __TwigTemplate_7129d93ddf3d1787758882ea8da39810->block_account()
#12 /home/vagrant/xx/storage/runtime/compiled_templates/b7/b7ce87a899d73972bedb70bcb29e1e8e.php(75): Twig\Template->displayBlock()
#13 /home/vagrant/xx/vendor/twig/twig/src/Template.php(171): __TwigTemplate_45fbd9b2468fd874474b0351c09ece51->block_content()
#14 /home/vagrant/xx/storage/runtime/compiled_templates/32/32a8ae1bc72d719289deb9e15af6ef11.php(166): Twig\Template->displayBlock()
#15 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_39c7f8fc1f11d4ab3a2f68b3e1f41840->doDisplay()
#16 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#17 /home/vagrant/xx/storage/runtime/compiled_templates/b7/b7ce87a899d73972bedb70bcb29e1e8e.php(49): Twig\Template->display()
#18 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_45fbd9b2468fd874474b0351c09ece51->doDisplay()
#19 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#20 /home/vagrant/xx/storage/runtime/compiled_templates/08/082642088bfadabf7d3776435bb0e552.php(49): Twig\Template->display()
#21 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_7129d93ddf3d1787758882ea8da39810->doDisplay()
#22 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#23 /home/vagrant/xx/storage/runtime/compiled_templates/d1/d1ab8f71c923eafdf8501b95da04e4d3.php(55): Twig\Template->display()
#24 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4cf20a0adc7635f753889fec41c95f6e->doDisplay()
#25 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#26 /home/vagrant/xx/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
#27 /home/vagrant/xx/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()
#28 /home/vagrant/xx/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render()
#29 /home/vagrant/xx/vendor/craftcms/cms/src/web/View.php(428): Twig\Environment->render()
#30 /home/vagrant/xx/vendor/craftcms/cms/src/web/View.php(481): craft\web\View->renderTemplate()
#31 /home/vagrant/xx/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(52): craft\web\View->renderPageTemplate()
#32 /home/vagrant/xx/vendor/yiisoft/yii2/web/Response.php(1095): craft\web\TemplateResponseFormatter->format()
#33 /home/vagrant/xx/vendor/craftcms/cms/src/web/Response.php(286): yii\web\Response->prepare()
#34 /home/vagrant/xx/vendor/yiisoft/yii2/web/Response.php(339): craft\web\Response->prepare()
#35 /home/vagrant/xx/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#36 /home/vagrant/xx/web/index.php(12): yii\base\Application->run()
#37 {main}

Next yii\di\NotInstantiableException: Failed to instantiate component or class "bymayo\porter\variables\PorterVariable". in /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php:509

Stack trace 2:
#0 /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php(385): yii\di\Container->getDependencies()
#1 /home/vagrant/xx/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build()
#2 /home/vagrant/xx/vendor/yiisoft/yii2/BaseYii.php(345): yii\di\Container->get()
#3 /home/vagrant/xx/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject()
#4 /home/vagrant/xx/vendor/yiisoft/yii2/di/ServiceLocator.php(74): yii\di\ServiceLocator->get()
#5 /home/vagrant/xx/vendor/craftcms/cms/src/helpers/Template.php(90): yii\di\ServiceLocator->__get()
#6 /home/vagrant/xx/storage/runtime/compiled_templates/e1/e1e944121636c2b1847dfdf004b49ece.php(41): craft\helpers\Template::attribute()
#7 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_d3e78d63bf730e1f32521fa5c08aa48d->doDisplay()
#8 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#9 /home/vagrant/xx/storage/runtime/compiled_templates/08/082642088bfadabf7d3776435bb0e552.php(292): Twig\Template->display()
#10 /home/vagrant/xx/vendor/twig/twig/src/Template.php(171): __TwigTemplate_7129d93ddf3d1787758882ea8da39810->block_account()
#11 /home/vagrant/xx/storage/runtime/compiled_templates/b7/b7ce87a899d73972bedb70bcb29e1e8e.php(75): Twig\Template->displayBlock()
#12 /home/vagrant/xx/vendor/twig/twig/src/Template.php(171): __TwigTemplate_45fbd9b2468fd874474b0351c09ece51->block_content()
#13 /home/vagrant/xx/storage/runtime/compiled_templates/32/32a8ae1bc72d719289deb9e15af6ef11.php(166): Twig\Template->displayBlock()
#14 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_39c7f8fc1f11d4ab3a2f68b3e1f41840->doDisplay()
#15 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#16 /home/vagrant/xx/storage/runtime/compiled_templates/b7/b7ce87a899d73972bedb70bcb29e1e8e.php(49): Twig\Template->display()
#17 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_45fbd9b2468fd874474b0351c09ece51->doDisplay()
#18 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#19 /home/vagrant/xx/storage/runtime/compiled_templates/08/082642088bfadabf7d3776435bb0e552.php(49): Twig\Template->display()
#20 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_7129d93ddf3d1787758882ea8da39810->doDisplay()
#21 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#22 /home/vagrant/xx/storage/runtime/compiled_templates/d1/d1ab8f71c923eafdf8501b95da04e4d3.php(55): Twig\Template->display()
#23 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4cf20a0adc7635f753889fec41c95f6e->doDisplay()
#24 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#25 /home/vagrant/xx/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
#26 /home/vagrant/xx/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()
#27 /home/vagrant/xx/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render()
#28 /home/vagrant/xx/vendor/craftcms/cms/src/web/View.php(428): Twig\Environment->render()
#29 /home/vagrant/xx/vendor/craftcms/cms/src/web/View.php(481): craft\web\View->renderTemplate()
#30 /home/vagrant/xx/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(52): craft\web\View->renderPageTemplate()
#31 /home/vagrant/xx/vendor/yiisoft/yii2/web/Response.php(1095): craft\web\TemplateResponseFormatter->format()
#32 /home/vagrant/xx/vendor/craftcms/cms/src/web/Response.php(286): yii\web\Response->prepare()
#33 /home/vagrant/xx/vendor/yiisoft/yii2/web/Response.php(339): craft\web\Response->prepare()
#34 /home/vagrant/xx/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#35 /home/vagrant/xx/web/index.php(12): yii\base\Application->run()
#36 {main}

TypeError - array_merge(): Argument #2 must be of type array, null given

When I try to load the DeleteAccountForm in my Template with this command: {{ craft.porter.deleteAccountForm() }} following Error occours:

TypeError: array_merge(): Argument # 2 must be of type array, null given

$properties = array_merge($defaultProperties, $properties);

Stack trace:
#0 /home/vagrant/xx/vendor/bymayo/porter/src/services/DeleteAccount.php(42): array_merge()
#1 /home/vagrant/xx/vendor/bymayo/porter/src/variables/PorterVariable.php(20): bymayo\porter\services\DeleteAccount->renderFormTemplate()
#2 /home/vagrant/xx/vendor/twig/twig/src/Extension/CoreExtension.php(1607): bymayo\porter\variables\PorterVariable->deleteAccountForm()
#3 /home/vagrant/xx/vendor/craftcms/cms/src/helpers/Template.php(101): twig_get_attribute()
#4 /home/vagrant/xx/storage/runtime/compiled_templates/e1/e1e944121636c2b1847dfdf004b49ece.php(77): craft\helpers\Template::attribute()
#5 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_d3e78d63bf730e1f32521fa5c08aa48d->doDisplay()
#6 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#7 /home/vagrant/xx/storage/runtime/compiled_templates/08/082642088bfadabf7d3776435bb0e552.php(290): Twig\Template->display()
#8 /home/vagrant/xx/vendor/twig/twig/src/Template.php(171): __TwigTemplate_7129d93ddf3d1787758882ea8da39810->block_account()
#9 /home/vagrant/xx/storage/runtime/compiled_templates/b7/b7ce87a899d73972bedb70bcb29e1e8e.php(75): Twig\Template->displayBlock()
#10 /home/vagrant/xx/vendor/twig/twig/src/Template.php(171): __TwigTemplate_45fbd9b2468fd874474b0351c09ece51->block_content()
#11 /home/vagrant/xx/storage/runtime/compiled_templates/32/32a8ae1bc72d719289deb9e15af6ef11.php(166): Twig\Template->displayBlock()
#12 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_39c7f8fc1f11d4ab3a2f68b3e1f41840->doDisplay()
#13 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#14 /home/vagrant/xx/storage/runtime/compiled_templates/b7/b7ce87a899d73972bedb70bcb29e1e8e.php(49): Twig\Template->display()
#15 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_45fbd9b2468fd874474b0351c09ece51->doDisplay()
#16 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#17 /home/vagrant/xx/storage/runtime/compiled_templates/08/082642088bfadabf7d3776435bb0e552.php(49): Twig\Template->display()
#18 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_7129d93ddf3d1787758882ea8da39810->doDisplay()
#19 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#20 /home/vagrant/xx/storage/runtime/compiled_templates/d1/d1ab8f71c923eafdf8501b95da04e4d3.php(55): Twig\Template->display()
#21 /home/vagrant/xx/vendor/twig/twig/src/Template.php(394): __TwigTemplate_4cf20a0adc7635f753889fec41c95f6e->doDisplay()
#22 /home/vagrant/xx/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling()
#23 /home/vagrant/xx/vendor/twig/twig/src/Template.php(379): Twig\Template->display()
#24 /home/vagrant/xx/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render()
#25 /home/vagrant/xx/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render()
#26 /home/vagrant/xx/vendor/craftcms/cms/src/web/View.php(428): Twig\Environment->render()
#27 /home/vagrant/xx/vendor/craftcms/cms/src/web/View.php(481): craft\web\View->renderTemplate()
#28 /home/vagrant/xx/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(52): craft\web\View->renderPageTemplate()
#29 /home/vagrant/xx/vendor/yiisoft/yii2/web/Response.php(1095): craft\web\TemplateResponseFormatter->format()
#30 /home/vagrant/xx/vendor/craftcms/cms/src/web/Response.php(286): yii\web\Response->prepare()
#31 /home/vagrant/xx/vendor/yiisoft/yii2/web/Response.php(339): craft\web\Response->prepare()
#32 /home/vagrant/xx/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#33 /home/vagrant/xx/web/index.php(12): yii\base\Application->run()
#34 {main}

When I load it with properties like this, everything now works just fine:

{{ craft.porter.deleteAccountForm(
   {
	  fieldClass: 'w-full',
	  fieldContainerClass: 'mb-6',
	  buttonClass: 'button',
	  buttonText: 'Profil endgültig löschen'
   }
) }}

So I think you can't merge the default properties array with custom properties if there are zero given. Probably check beforehand.

You don't have permission to delete your account

Getting this error, which permission to I have to set to allow this? I only see an "Delete users" permission in the Group settings (CraftCMS), but it's not clear if this is "own user" or "all users".

Magic link timezones bugfix

Hi bymayo,

There is a bug, resulting in the Magic Link functionality not working for certain timezones. Craft saves DB entries in UTC. Therefore in certain timezones, a magic link will always be expired.

I believe the fix is as follows. On line 196 in MagicLink.php replace:

if (DateTimeHelper::currentTimeStamp() <= (strtotime($query->dateCreated) + $this->settings->magicLinkExpirySeconds))

With:
if (DateTimeHelper::currentTimeStamp() <= (DateTimeHelper::toDateTime($query->dateCreated)->format('U') + $this->settings->magicLinkExpirySeconds))

Hope this helps. Would be great if you can update the plugin.

Unknown variables using the default Twig form

Hey, when I want the full control and copy the content of the default Form:
bymayo/porter/src/templates/components/deleteAccountForm.twig into my Twig Template, it doesn't know the default Variables.
Do you have any Idea how to load your default Variables/Properties in a Twig File ?
In the previous version I could get it by {{ craft.deleteAccount.settings('confirmationKeyword') }}

Actually I just want to change/translate the confirmation sentence:

{{ 'Type the phrase'|t }} <span class="{{ confirmationClass }}">{{ confirmation }}</span> {{ 'to confirm you want to permanently delete your account.'|t }}

Thanks in advance.

Support for new user registration

Is there support for new user registration, which would work the same as the login functionality, and proceed to create a new user, generating a random password under their account if the email address does not match any user?

If this doesn't exist, it would be good if it followed the standard Craft approach to registrations, in addition to:

  • Setting the redirect after login, for new registered users which would be in addition to users who do have an account already.
  • Assign to Craft default member group or select one or multiple groups.
  • Be able to submit user field data before signing up (e.g. username, country, etc)
  • Nice to have: Upon user signup token link - have the option to not complete registration until they completed some fields upon. Only upon submission will it sign the user in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.