Jump to content

Juergen

Members
  • Posts

    1,306
  • Joined

  • Last visited

  • Days Won

    13

Everything posted by Juergen

  1. Hello @ all, I have a some templates which will be loaded via AJAX. They are located in a separate folder under site/ajax/ so they are not in the PW template folder. I have bootstraped these templates via "include("../../index.php");" so I can query PW fields via API calls. It works quite well and I get all values from my PW fields. Unfortunately if I switch the language from German to English, all values will stay in the default language (German). So the language change will not be taken into account, because there are no different urls for each language (no PW pages). Has someone dealed with the same problem and could give me a hint how to take the language change into account? My idea was to add a query string with the id of the language at the end of the AJAX href (like "path/to/myajaxtemplatefile?id=1008) but maybe someone has a better idea. I dont want to create a real PW page for such small piece of information. Best regards
  2. Yep, that was the problem! Now it works.... I only use it for testing purposes at the moment..... so this is not a problem. Thanks for your quick help and response!!
  3. Thanks @bernhard but the problem is only there by installing or upgrading Handson tables. I did a lot of other updates (PW, some field types and modules,...) - without any problems. I guess you mean how, because I did it to get the latest version? I made it with the default PW update - like all others. After the update failed, I deinstalled and deleted the module. Afterwards a fresh install of the module was done from the PW module directory. There are no other error messages than the one I have posted above. I have Tracy running beside - but no error message. Best regards
  4. Hello @bernhard, I have tried to update Handson tables but I always get this error: It also happens after uninstall and deletion of the older version and a fresh install. Best regards Jürgen
  5. I use it on the latest PW 3 DEV without any problems.
  6. @szabesz I can confirm this behaviour.
  7. I also had some troubles with sessions and form data sometimes ago. In my case I wanted to store multiple infos (fe first name, last name, email,...) inside a session. I have tried it with an array, but this didnt work. So I ended up to put my form data into an array and convert this array into a json array before storing it into a session and this works. After that I have outputed the form data by converting back the json array to a standard array (so jsonencode, jsondecode) was the key of success for me to work with multiple data and sessions. Best regards
  8. Issue will be fixed by Ryan in the next update https://github.com/processwire/processwire-issues/issues/344#issuecomment-324061230
  9. 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.
  10. 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.
  11. 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
  12. 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
  13. Only as an information: I have opened a new github issue at https://github.com/processwire/processwire-issues/issues/344
  14. 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!!!!!!!
  15. Thanks @abdus, I will wait for a while if someone posts another solution. Otherwise I will open a new Issue on Github. Best regards
  16. 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.
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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.
  23. 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
  24. Thanks @LostKobrakai, I will try it like this and post my result here.
×
×
  • Create New...