-
Posts
1,423 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Juergen
-
Issue will be fixed by Ryan in the next update https://github.com/processwire/processwire-issues/issues/344#issuecomment-324061230
-
Thanks @abdus, I know about this possibility, but I would prevent this. Another solution would be to load the forms via Ajax. For the moment I will leave the template cache disabled.
-
Hi @Zeka thanks for your response, but it is the same behavior independent if I add "submit" or "*" in the GET or/and POST field.
-
Hello @all, I have a problem by using the template cache on a template with a form. On a page I have a contact form, and I have defined cache deactivating variables to prevent loading the page from cache after form submission. I use query strings after the url: ?submit=success or ?submit=error (depending on the form validation). If I push the submit button, the page will be reloaded always with the same query string (in my case ?submit=error, because this is my default query string after submission). After the page reload the template cache is disabled, but the form values will not be sent to my email address. If I fill out the form once more (remember template cache is disabled at the moment) and I push the submit button everything works fine. So it seems that the template cache prevents values from beeing submitted. Does anyone have a working strategy to use template cache with forms? Thanks in advance
-
Hello, today I want to introduce you to a php honeypot class that I have implemented to my forms to prevent form submissions via spam bots: https://github.com/dominiquevienne/honeypot The class creates a honeypot and a token field. It checks for time from page rendering to form submission correct token filled in honepot field failure attempts All settings can be changed via a config array (fe set min time until form submission to 5 seconds, if the form will be submitted faster it must be a spam bot,...). Just take a look at the documentation and maybe its interesting for you. Best regards
-
- 3
-
-
Only as an information: I have opened a new github issue at https://github.com/processwire/processwire-issues/issues/344
-
Yes, the id of the role works, but I think this is not usual behavior that the name of the role works with "=" and not with "!=". Anyway, thanks for the tipp!!!!!!!
-
Thanks @abdus, I will wait for a while if someone posts another solution. Otherwise I will open a new Issue on Github. Best regards
-
Hello maxf5, yep that was a copy/paste mistake in the previous post, but on my site I have used the right role name and it doesnt work at all. So its not the wrong order of the words. :-( In opposition "roles=login-facebook" works.
-
The suggestions above dont work in my case (PW 3.0.71). I am using the following code to exclude all users which have the role "facebook-login". $users->find("roles!=login-facebook"); But this shows all users, even users with the role "login-facebook", so it seems that "!=" (not) will not be accepted. Just to mention: my users have sometimes more than 1 role. Does anyone know how to define a "not" in a find method. Best regards Jürgen
-
I found this line of code in config.php line 131: $f->addOption(0, $this->_('Make all Facebook users point to the same ProcessWire user'), array('disabled' => 'disabled')); Should I remove the disabled array to make it work or is there another possibility without changing the code? Best regards
-
Thanks for this module!!! I am wondering, because "mapping to the same user account" is always disabled. Creating a new user account for each Facebook login user will lead to problems in my case, because I dont allow to register an email address twice. (fe. same email address on Facebook Login and default login). This is because I have a "forgot password" link on my frontend where you have to enter the email address only to get an email with a new password. If there are two equal email addresses in the DB this leads to problems. I dont want to rewrite it to enter the username in addition to the email address, because sometimes people forget username and password. So how can I map all FB Logins to one user account? It will also be a great addition if it would be possible to connect facebook logins to the default user account. Fe. if someone is logging in with FB and the same email address is also stored in the user DB, then the user will be asked if he wants to connect his FB Account with the default account. If "yes" then the user will be asked to enter his password to verify this is his own default account. If the password is entered correctly than the FB Login Account will be connected to the default account. Best regards Jürgen
-
Using array in session force a logout in frontend
Juergen replied to Juergen's topic in General Support
Anyway, I use another solution: I convert the array into a json object, put it into the session variable and afterwards I convert it back to an array like this. Inside $Post $valuesbefore = array( $user->fields->get('usergender')->$label => $user->usergender->id, $user->fields->get("user_first_name")->$label => $user->user_first_name, $user->fields->get("user_real_name")->$label => $user->user_real_name, $user->fields->get('email')->$label => $user->email, _t('Username', 'Login') => $user->name, //$user->fields->get('pass')->$label => 'yes', $user->fields->get('language')->$label => $user->language->id, $user->fields->get('userimage')->$label => $user->userimage->basename, 'Password' => 'no'//special type ); $valuesbefore = json_encode($valuesbefore); $session->predata = $valuesbefore; The session variable predata holds the json array and after submission I grab this session variable and convert it back to a php array like this: $valuesbefore = json_decode($session->predata, true); Now I have submitted a session with an array- 1 reply
-
- 2
-
-
Hello @ all, I have a user profile frontend form and I want to show a message what has been changed after submitting the form. Therefore I have created an array which contains the original user data before something will be changed in the DB. //create array of stored user data $valuesbefore = array( $user->fields->get('usergender')->$label => $user->usergender->id, $user->fields->get("user_first_name")->$label => $user->user_first_name, $user->fields->get("user_real_name")->$label => $user->user_real_name, $user->fields->get('email')->$label => $user->email, _t('Username', 'Login') => $user->name, $user->fields->get('pass')->$label => $user->pass, $user->fields->get('language')->$label => $user->language->id, $user->fields->get("userimage")->$label => $user->userimage ); $session->valuesbefore = $valuesbefore; I have called it $valuesbefore. After that I have started (created) a new session (name=valuesbefore) which should hold the array with the original userdata for comparing with the new userdata after form submission. This piece of code is after the POST command. My problem is that if I use an array inside the session I will always be logged out after form submission. If I use a string everthing is ok. Is there a limitation of using arrays inside the PW session function? Best regards Jürgen
-
Mmmhh: This works $apikey = "50******************-us14"; $listid = "0**************f"; //1) Check Mailchimp if email is not registered Valitron\Validator::addRule('notSubscribed', function($field, $value, $params = array()) { $MailChimp = new \DrewM\MailChimp\MailChimp($params[0][1]); $subscriberHash = $MailChimp->subscriberHash($value); $result = $MailChimp->get('lists/' . $params[0][0] . '/members/' . $subscriberHash); return !($MailChimp->success() && isset($result['id'])); }, ': '._t('Your email address is already on the newsletter list. Therefore you don`t need to subscribe once more.', 'Newsletter')); And then you can validate the field $v->rule('notSubscribed', 'nameofmyemailformfield', [$listid,$apikey]); It seems that $params doesnt accept keys, only values so I use "$params[0][0]" and "$params[0][1]" for the list ID and the API key value. I have also integrated the complete Mailchimp code instead of the function I have used before. Place this code in _init.php and the new validation rule can be used anywhere.
-
This works: Valitron\Validator::addRule('notSubscribed', function($field, $value, $params) { return !isSubscribed($value, "0*******f", "50****************-us14"); }, ': '._t('Your email address is already on the newsletter list. Therefore you don`t need to subscribe once more.', 'Newsletter')); $v->rule('notSubscribed', 'nameofmyemailfield'); But........ It only works if the list ID and the API-key are hard coded. I have tried to use params like this in the rule: $v->rule('notSubscribed', 'nameofmyemailfield', ["listID" => "0*******f"]); But they will not be fetched if I use $params['listID'] instead of the hard coded list id value. PHP Notice: Undefined index: listID in
-
Thanks @LostKobrakai, I will try it like this and post my result here.
-
Hello @ all, I am using Mailchimp V3 and Valitron as my validation library. I am struggeling to add a custom validation rule which checks if the entered email address is registered at my Mailchimp account. I know that there is a documentation about how to add custom rules at the Valitron page, but its not very clear to me. Does anyone have done something similar and can point me into the right direction. For now I am testing the email address after Valitron has validated my inputs. The following function checks if the entered email address is registered at Mailchimp. function isSubscribed($emailAddress, $listId, $apikey) { $MailChimp = new \DrewM\MailChimp\MailChimp($apikey); $subscriberHash = $MailChimp->subscriberHash($emailAddress); $result = $MailChimp->get('lists/' . $listId . '/members/' . $subscriberHash); return ($MailChimp->success() && isset($result['id'])); } $isRegistered = isSubscribed($subscribenewsletteremailvalue, $listid, $apikey); This function returns true if the email adress is registered and false if not (variable = $isRegistered). How can I integrate this function inside a custom validation rule?? Best regards
-
Some time ago, I made a site for a company which sells wool. In this case I use the fieldtype color for the different colors of a wool product (as a color scheme board). In this case I use the old color picker field (I think it was from Soma). This could be a possible usecase example for this fieldtype.
-
Hello @Can this line of code in your module code leads to an error message $value->getLanguageValue($user->language) Call to a member function getLanguageValue() on string Best regards
-
Thanks for the detailed response @bernhard I havent build a CRM with PW til now, but maybe a pricing table with different prices for different product sizes could be a useful application in my case Best regards
-
Thanks for the new fieldtype @bernhard Can you give me an example of a particular use case where you have used this fieldtype. I know there are some examples in the post above, but I guess they are only for demonstration purposes. Do you have an example of a real life usecase so I can get an idea about how it can be used? Best regards
-
module Recurme – Processwire Recurring Dates Field & Custom Calendar Module.
Juergen replied to joshuag's topic in Modules/Plugins
Sorry @totoff, but I have no example here at the moment, but Fullcalendar provides some render functions. I have used them to manipulate the output via Jquery. Fe adding Uikit classes to the buttons (uk-button) and so on. This was the way I have done some manipulations to the calendar. Take a look at this functions and use standard Jquery code to add classes, markup and so on. The calendar itself doesnt need to be manipulated, but as I have written above I have used UiKit markup at the buttons and I have used Uikit badges for the events in the calendar and Uikit tooltips after hovering a link . That was it. -
module Recurme – Processwire Recurring Dates Field & Custom Calendar Module.
Juergen replied to joshuag's topic in Modules/Plugins
Sorry, @totoff, my fault. It mean the Fullcalendar. I use it with Uikit markup (badges,..) so I always call it "UiKit calendar". This was a mistake. Anyway, you can use it with recurme. Here you can find the Bootstrap calendar. Both are available on Jsdelivr CDN. So no need to include the files locally. Best regards -
module Recurme – Processwire Recurring Dates Field & Custom Calendar Module.
Juergen replied to joshuag's topic in Modules/Plugins
Works also with UiKit calendar and Bootstrap calendar if you are using a framwork. If you are using UiKit calendar you can make fe a template which outputs all the calendar dates in a json array. Then you can load this template (or lets say the event dates) via ajax into the UiKit calendar template engine. Its very easy.