• Content Count

  • Joined

  • Last visited

Community Reputation

43 Excellent

1 Follower

About MarcoPLY

Profile Information

  • Gender
  • Location
    Reggio Emilia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I have this simple structure with two separate pw installation: Root |----Site-one ( |----All Pages |----Site-two ( |----All Pages There are few page that would be very nice if I could update them in site-one and show it on the site-two without changing the domain. Is it possible Share contents between two different installations? There are some IPA that I can call the contents from the site-one installation? I try to looking in the forum and I find a link to a module call service-pages but all link give me error 404, also I see the rss module but I'm not sure that can call all the contents from the site-one pages.
  2. MarcoPLY

    Thank you @BitPoet, the problem still unsolved. The images are loaded inside the folder, I checked via ftp. But after a few hours/day they are deleted. This only happens in a folders with lots of images inside, if I create a new one and reload the images this problem is solved. There are no notice about the memory issues, could it always be this?
  3. MarcoPLY

    Hi @flydev Is it possible have access to all variable in sendConfirmationEmail ? I'd like to include the person's name and password in the e-mail notification, but the moment I'm only able to access the e-mail. Also for the buildConfirmationForm I can't add eg. the e-mail inside the text. I try use this but doesn't work. sprintf($this->_('Thank you, a confirmation code has been emailed to you at %s.'), $email) Perhaps it's the same problem that I can't access to all variables from the registration form.
  4. Ok, now redirect users based on their country works. So, for be honest I don't have do a lot, I use on of the free service @adrian write above and I have read this great post from @rayn (thank you). Anyway this code works quite well, but for sure it's possible write it better. <?php function getUserIP() { $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)) { $ip = $client; } elseif(filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); $http = new WireHttp(); $url = $http->getJSON(''.$user_ip); $country = $url['country']['code']; ?> <?php foreach($languages as $language) { if(strpos($config->httpHost, "$language->") === 0) { $user->language = $language; break; } } $name = $sanitizer->pageName(substr($country, 0, 2)); $language = $languages->get($name); if($language->id && $name != $user->language->name) { $url = "" . $page->localUrl($language); $session->redirect($url); } ?> If the language it's not set for the country it will load the default language. This can be used also for redirect users to any subdomain or whatever, just need change the $session->redirect($url). substr it can be useful sometime this service give me back an hidden character. I have just a notice in TracyDebug where start the foreach, if I put it after $country give me an error, look like there is an error in the previous lines but honestlyI did not understand what it is. --- * In the Ryan post there is the code for filter the language by Browser's HTTP Accept-Language. As @theo had said.
  5. wow. Thank you very much @adrian the ip service look very nice! I will study the cookie modulo and also probably will implement it on the sites. Thanks again for sharing your knowledge! Yes @theo, I have just find this post. I think will use the HTTP Accept-Language, it's a better way. For the country specific products I will use the geolocation service that suggested Adrian. I will Upload this post when I finish all the code. So, if some one will need in the future.
  6. MarcoPLY

    Thank you I was two days that I was working on this!!
  7. yes @bernhard, I will do this for this particular situation, because it's a subdomain that you must be logged for see the page and I will have the country code (we have decided now for the same reason you say you). But anyway In our next step we will open the e-commerce in the USA, we will make an other subdomain and we need to redirect all the USA traffic to this subdomain. so, if we do not find another solution we will use a service like @Soma I know it's not the best but in this case we have to do in this way, special for the user came form the USA that will see different products compared to European ones. They will not have access to the UE site.
  8. @Soma yes, I understand you, but unfortunately in this case we are obliged because some pages have terms that should be used in the current language. Example, unfortunately not all know the VAT number equivalent that here in Italy is Partita IVA. These things and others can confuse users. I would like in any case to leave the possibility to change the language for those who want, but the first language should be the one come form the country IP.
  9. works well and have nice IPA system. But over 1000 requests for day need a bit expensive plan like 500$/y. So, the economic issue could be not a problem, but would be great if there is a solution that doesn't include accounts with external platforms. But anyway, if I want use ipinfo and test it, how I can redirect the user. I can make a hook inside my ready.php ? I have to use addHookBefore('Session::redirect', function(HookEvent $event) ? Or something like this, that at moment doesn't work... <?PHP function getUserIP(){ $client = @$_SERVER['HTTP_CLIENT_IP']; $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; $remote = $_SERVER['REMOTE_ADDR']; if(filter_var($client, FILTER_VALIDATE_IP)){ $ip = $client; } elseif (filter_var($forward, FILTER_VALIDATE_IP)) { $ip = $forward; } else { $ip = $remote; } return $ip; } $user_ip = getUserIP(); $http = new WireHttp(); $url = "{$user_ip}/country"; $response = $http->get($url, ['country' => '']); $country = filter_var ( $response, FILTER_SANITIZE_ENCODED); // the country have a hiddend code if ($country == "IT"){ $session->redirect('/it'); } elseif ($country == "FR") { $session->redirect('/fr'); } else { $session->redirect('/'); } ?> Anyway I have to redirect always on the current page not always on the homepage. An also other problem it's that some people could choose to use the website form other languages. It's a bit tricky
  10. Hi, I looked in to the forum if there was any post but I have not found, it seems strange ... anyway. Is it possible, using pw, based on the user's country redirect the users to their language page? I was looking at IP geolocation services but they all seem to pay. is not there a system that does not require subscriptions? or even better, an internal system in pw?
  11. MarcoPLY

    Hi @Sevarf2 Probably it's better this one: $wire->addHookAfter('LoginRegister::buildLoginForm', function($event) { $form = $event->return; $form->description = false; // Remove the description foreach ($form->children as $field) { // loop form fields if($field instanceof InputfieldSubmit) { // if we reach the submit button then $field->value = 'My Submit'; // change the value } } $event->return = $form; }); Probably me too later this week I will try to use, I think this could works. Take a look in the 1° page of this post there are also other part of code that maybe can help you.
  12. MarcoPLY

    hi @Sevarf2, I know maybe it's not exactly what you were looking for, but could put you in a good direction. I didn't test yet but look so nice. I have find here wire()->addHookAfter('LoginRegister::buildProfileForm', function($event) { $form = $event->return; foreach ($form->children as $field) { if ($field instanceof InputfieldEmail || $field instanceof InputfieldPassword) { $form->remove($field); } } }); Maybe it's enough make a different hook in instead of $form->remove($field) If you want to use just for a specific form you can make the hook in that page, instead of in the ready.php
  13. MarcoPLY

    Hi @flydev! I try to use this hook, but doesn't work for me. If I use $u->roles->add(wire('roles ')->get ("bs-user")) give me an error "unexpected $u (T_VARIABLE) I try to use $u->addRole('bs-user') like is in the documentation, but also this not work. I try also to use $u->of(false) ... $u->of(true) for see if need a new formatting before assigning values to a user. But the user does not register. How can I add a specific role from a hook? UPDATE: The problem not was wire()->addHookBefore('LoginRegister::createdUser', function($event) { $u = $event->arguments[0]; $u->addRole('bs-user'); $u->save(); }); But in the way I rendering the registration form: If I use $input->get->register = 1 for rendering only the registration form the hook doesn't work. I have to call also the login form <?php $login = $modules->get('LoginRegister'); echo $login->execute(); $Register = $modules->get('LoginRegister'); $input->get->register = 1; echo $Register->execute(); ?>
  14. MarcoPLY

    Hi. Is it possible customize the registration form for different pages ? I have to add a specific roles for the user make the registration from a specific page. And also add one more input in this registration form. I try to add the role following your idea in the other post but this of course doesn't work. wire()->addHookBefore('LoginRegister::buildLoginForm', function ($event) { $form = $event->arguments[0]; $string = $page->path(); $field = 'invoice_IVA_VAT'; // hide a field for all forms except the one on the page. if ($string !== 'business-landing') { $f = $form->get($field); $f->collapsed = Inputfield::collapsedHidden; } // add them new role if ($string == 'business-landing') { $u = $event->arguments[0]; $u->roles->add(wire('roles')->get("bs-user")); $u->save(); } $event->return = $form; }); I see you have use addHookBefore LoginRegister::createdUser in that post. But if I want choose the page where this it's apply I have to use buildLoginForm, correct? How I can add the roles after the registration and a new field? UPDATE: For add a custom roles need to use an hook by this: wire()->addHookBefore('LoginRegister::createdUser', function($event) { $u = $event->arguments[0]; // get user object $u->addRole('bs-user'); $u->save(); }); Be sure to render the login form (and not only the registration form).
  15. Hi, We have made an e-commerce with PW3 and Padloper, the e-commerce sell in Europe in Euro. Now we want extend the e-commerce in the USA and sell in Dollar. We have think to run a different website for the USA versione, because with have different products and we want customize some pages. The idea is to run a new installation with a new Padloper module in a sub.domain, but the best will be keep all the other page, like the blog, in sync with the first website. Any advice on how to do it ? I read about Multiple sites with multiple databases, that could be a good solution because let me make a new installation of Padloepr module and customize the pages. But I'm not sure about how to import the page from the first website and show up in the new installation, in the way we don't have to upload website.