Jump to content

iNoize

Members
  • Posts

    165
  • Joined

  • Last visited

Everything posted by iNoize

  1. Thats actually my code. It works for register but dont work for the Email new user. Ive thought i could write i plugin hook but i cant So please help where is the mistake ? $fu = $modules->get('FrontendUser'); // prepare login form (default parameters) $fu->login(); // Default parameter //$fu->login(array('username', 'password')); // Additional LoginPersist and ProcessForgotPassword module integration (built-in) $fu->login(array('username', 'password', 'forgot')); // process login / form submit $fu->process('../objekte/'); // output form echo $fu->render(); $modules->get('EmailAdminNewUser'); // lade Modul um den Admin zu benachrichtigen $u_vorname = $modules->get('InputfieldText'); $u_vorname->label = $this->_('Vorname'); $u_vorname->attr('id+name', 'u_vorname'); $u_vorname->required = 1; $u_vorname->fhSanitizer = 'text'; $nachname = $modules->get('InputfieldText'); $nachname->label = $this->_('Nachname'); $nachname->attr('id+name', 'nachname'); $nachname->required = 1; $nachname->fhSanitizer = 'text'; $unternehmen = $modules->get('InputfieldText'); $unternehmen->label = $this->_('Unternehmen'); $unternehmen->attr('id+name', 'unternehmen'); $unternehmen->required = 1; $unternehmen->fhSanitizer = 'text'; $strnr = $modules->get('InputfieldText'); $strnr->label = $this->_('Strasse / Hausnummer'); $strnr->attr('id+name', 'strnr'); $strnr->required = 1; $strnr->fhSanitizer = 'text'; $plz = $modules->get('InputfieldText'); $plz->label = $this->_('Plz / Ort'); $plz->attr('id+name', 'plz'); $plz->required = 1; $plz->fhSanitizer = 'text'; $tel = $modules->get('InputfieldText'); $tel->label = $this->_('Telefonnummer'); $tel->attr('id+name', 'tel'); $tel->required = 1; $tel->fhSanitizer = 'text'; $fu->addHookBefore('save', function($event) { $form = wire('fu')->form; $user = wire('fu')->userObj; $user->addRole('registered'); if(!count($form->getErrors())) { wire('fu')->userObj->u_vorname = $form->fhValue('u_vorname', 'text'); wire('fu')->userObj->u_nachname = $form->fhValue('nachname', 'text'); wire('fu')->userObj->u_unternehmen = $form->fhValue('unternehmen', 'text'); wire('fu')->userObj->u_hausnummer = $form->fhValue('strnr', 'text'); wire('fu')->userObj->u_plzort = $form->fhValue('plz', 'text'); wire('fu')->userObj->u_telefonnummer = $form->fhValue('tel', 'text'); } }); // prepare register form $fu->register(); $fu->register(array('username', $u_vorname, $nachname, $unternehmen , $strnr, $plz, $tel, 'email', 'password')); $fu->process('/'); echo $fu->render(); The admin need an email with new user details and a link to activate this user. Because there are 3 different view gropus of users. Where i put the code for my custom email to the user admin ? I tried to understand it with the after hooks but how to hook the press on the registeration button ? Thanks PS: I have some problems with the forget user funktion. I see it twice ? if im logged in i see blank place. can i set a message like you are logged in currently ?
  2. Hello, i have the new fileds, I dont really understand how to write the form values to the user template values ? Cound you post an example ? Also I need that an email will sent to the admin if an user is registered. User have to be activated and chooses for a group by the admin. Thanx for the advice
  3. Hello, I need some advice how to solve the problem. I try to use the search function and need to choose between normal pages and pages without tpl files. i have found this post from Soma how can i change the output for me ? https://processwire.com/talk/topic/1746-dont-show-pages-without-template-file/?p=16309 if tpl nofile_ then show url from parent if tpl show normal link if($matches->count) { // we found matches echo "<h4>Es wurden $matches->count Ergebniss(e) gefunden:</h4>"; // output navigation for them (see TIP below) echo "<ul class='nav'>"; $tmpls = $templates->find("name^=nofile_"); foreach($matches as $match) { echo "<li><a href='$match->url'>$match->title</a>"; echo "<div class='summary'>$match->summary</div>$match->template </li>"; } echo "</ul>"; // TIP: you could replace everything from the <ul class='nav'> above // all the way to here, with just this: renderNav($matches); } else { // we didn't find any echo "<h3>leider wurden keine Ergebnisse gefunden</h3>"; } tnx
  4. Hello, I have some trouble with the blog-author role. I have also an editor role which can edit and add the pages. exampleuser - editor-role -blog-author but only superuser can edit the Pages. How I can handle this problem ? Thanks
  5. Hello, i try to write an Import Script. Some basic skills i've learned from different postst. But its not really enough so i try to start a new Topic. I have an zip file with xml and images inside. The different objects have three different actions "ADD | CHANGE | DELETE" so the Idea is at the ADD Action to check is the page ID I use for the ID the Object Number alredy exist. If not create page if the Change Action than check if ID exist grab this Page and write new values if Delete Action then Grab this ID if exist and change Parent. IMPORTANT: After all I have to delete the Zip file and all the TEMP Files. How to handle in the right way temporary fils with processwire ? Maybe i dont need the external extract Script ? This is my current CODE: <?php $userRolesSelector = 'superuser'; // bootstrap ProcessWire. Update the path in the include if this script is not in the same dir include("./index.php"); if( ! wire('user')->hasRole($userRolesSelector)) { header('HTTP/1.1 403 Forbidden'); exit(1); } include "import/op_file.php"; // Different functions to handle the zip file EXTRACT Read etc.... // here some (pseudo/example)code set_time_limit( intval(60 * 5) ); // give it 10 minutes, you may also increase this echo "<pre>"; readXML(); exit; //******************************************** /** ----------------------------------------------------------------- * @desc Finde XML/ZIP, entpacken und einlesen der daten */ function readXML() { $opfile = new OPfile(); // dbg is a wrapper for "echo", so you can ignore it via one Flag in op_tools echo "DOC ROOT: ".$_SERVER['DOCUMENT_ROOT']; // Set your path here ... $ropa=dirname($opfile->GetTheRoot())."/"; //opfile $ropa=$ropa . "demo/"; echo "ROOT: ".$ropa; $modpa=$ropa; $projpa=$ropa; $origfolderfrom=$ropa."import/ftpin/"; $ftptemp=$ropa."import/temp/"; $folderfrom=$origfolderfrom; // Find the ZIP/XML File in the FTP Folder // $fileinfo will be used by following functions. you can add more information if needed $fileinfo= $opfile ->GetUpload($origfolderfrom ); // return = assoc-array $fileinfo ['temp']=$ftptemp; $fileinfo ['folder']=$origfolderfrom ; // Extract or Copy the Files, so we can prozess the xml info if ($fileinfo['type'] =='zip') { // if it is ZIP , extract it to temp $xmlfilename= $opfile ->ExtractZIP($fileinfo); echo "<p> XML ist:".$xmlfilename."</p>"; echo "<p>Kopiere: " .$fileinfo ['folder'].$xmlfilename ." <br> nach: ". $ftptemp.$xmlfilename."</p>"; }else{ // if it is XML copy it to temp $xmlfilename = $fileinfo['file']; copy ($fileinfo ['folder'].$xmlfilename , $ftptemp.$xmlfilename); echo "<p>Kopiere: " .$fileinfo ['folder'].$xmlfilename ." nach: ". $ftptemp.$xmlfilename."</p>"; }//if // XML File from temp folder $stat = $opfile ->LoadXML($ftptemp.$xmlfilename); $path = $ftptemp.$xmlfilename; if (file_exists($path)) { $xml = simplexml_load_file($path); echo "<p>Erfolgreich geladen <br></p>"; $nodeList = $xml->xpath('//immobilie'); } // you can access the XML Object by: $opfile ->XMLdata; if ($stat == true) { // read basic infos form XML File $xinfo= $opfile->decodeUTF8($opfile ->XMLinfo()); // print_r($xinfo); echo "Objekte im Import: ".$xinfo['anzimmo']."<br >"; echo "Anbieter ID: ".$xinfo['anbieterid']."<br >"; }else { // Error in Processing. Stop the run. $xinfo['anzanbieter'] =0 ; $xinfo['anzimmo'] =0; echo "Fehler In der XML Datei"; // exit can be put away. The For Loop does not run with azi=0 exit; }//if $azi=intval($xinfo['anzimmo']); // get the number of Objects in archive // save our start time, so we can find which pages should be removed $started = time(); // keep track of how many changes we've made so we can report at the end $numChanged = 0; $numAdded = 0; $numTrashed = 0; // the parent page of our items: /about/what/ is a page from the basic profile // update this to be whatever parent you want it to populate... $parent = wire('pages')->get('/about/'); if(!$parent->id) throw new WireException("Parent page does not exist"); for ($ni=1; $ni<=$azi;) { //$xinfo['anzimmo'] echo "<h2>=======Object=".$ni."======</h2>"; $idata = $opfile->GetOneImmo( $ni, $xinfo); // $idata stores all the values in the Array for current Object $action=$idata['verwaltung_techn'] ['aktion']['aktionart']; if ($action =='') { $action="ADD"; }//if $page = wire('pages')->get($idata['verwaltung_techn']['objektnr_extern']); if($action == 'ADD') { if(!$page->id) { $page = new Page(); $page->parent = $parent; $page->template = 'immo'; // template new pages should use $page->name = $idata['freitexte']['objekttitel']; echo "Adding new page:".$idata['verwaltung_techn']['objektnr_extern']." Titel ".$idata['freitexte']['objekttitel']." <br>"; $numAdded++; } // print_r($idata); // now populate our page fields from data in the feed $page->of(false); // ensure output formatting is off $page->title = $idata['freitexte']['objekttitel']; $page->summary = $idata['freitexte']['dreizeiler']; $body = "<h2>".$idata['freitexte']['dreizeiler']."</h2>"; $page->body = $body; } if($action == 'CHANGE') { echo "CHANGE"; if(!$page->id) { $page = new Page(); $page->parent = $parent; $page->template = 'immo'; // template new pages should use $page->name = $idata['freitexte']['objekttitel']; echo "<h2>Change page data:</h2>".$idata['verwaltung_techn']['objektnr_extern']." Titel ".$idata['freitexte']['objekttitel']." <br><br>"; $numChanged++; } } if($action == 'DELETE') { echo "DELETE"; $numTrashed++; foreach($changes as $change) echo "\nUpdated '$change' on page: $page->name"; } $ni++; }//for Object echo "\n\n$numAdded page(s) were added"; echo "\n$numChanged page(s) were changed"; echo "\n$numTrashed page(s) were trashed\n"; }//funktion ?>
  6. Hello, for me worked the tutorial from Soma https://processwire.com/talk/topic/2089-create-simple-forms-using-api/ in most cases fine. (I HATE TO CODE FORMS BUT ITS NECESSARY ) This is for the PHP Code. For Example you can Put it in the contact-template.php <?php $out = ''; // create a new form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'subscribe-form'); //generate the Form with <form id="subscribe-form" ... // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $field->attr("class" , $field->attr("class") . " form-control"); // generate <input id="name" class=" form-control ..... " $form->append($field); // append the field to the form // create a text input $field = $modules->get("InputfieldText"); $field->label = "Adresse"; $field->attr('id+name','adresse'); $field->required = 1; $field->attr("class" , $field->attr("class") . " form-control"); $form->append($field); // append the field to the form // create a text input $field = $modules->get("InputfieldText"); $field->label = "Plz/Ort"; $field->attr('id+name','plz'); $field->required = 1; $field->attr("class" , $field->attr("class") . " form-control"); $form->append($field); // append the field to the form // create email field $field = $modules->get("InputfieldEmail"); $field->label = "E-Mail"; $field->attr('id+name','email'); $field->required = 1; $field->attr("class" , $field->attr("class") . " form-control"); $form->append($field); // append the field // create a text input $field = $modules->get("InputfieldTextarea"); $field->label = "Nachricht"; $field->attr('id+name','text'); $field->attr("class" , $field->attr("class") . " form-control"); $field->required = 1; $form->append($field); // append the field to the form // oh a submit button! $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Absenden"); $submit->attr("class"," btn btn-lg btn-primary"); $submit->attr("id+name","submit"); $form->append($submit); // form was submitted so we process the form if($input->post->submit) { // user submitted the form, process it and check for errors $form->processInput($input->post); // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); if($email && (strpos($email->value,'@hotmail') !== FALSE)){ // attach an error to the field // and it will get displayed along the field $email->error("Bitte Email eingeben."); } if($form->getErrors()) { // the form is processed and populated // but contains errors $out .= $form->render(); } else { // do with the form what you like, create and save it as page // or send emails. to get the values you can use // $email = $form->get("email")->value; // $name = $form->get("name")->value; // $text = $form->get("text")->value; // // to sanitize input $name = $sanitizer->text($input->post->name); $adresse = $form->get("adresse")->value; $plz = $form->get("plz")->value; $message = $form->get("text")->value; $subject = "Web Anfrage"; // $emailFrom = $form->get('email')->value; $emailFrom = $sanitizer->email($form->get("email")->value); $emailTo = 'youremail@domain.com'; $body = "Die Email ist von ".$name."\r\n"."\r\n".$adresse."\r\n".$plz."\r\n".$message; mail($emailTo, $subject, $body, "From: $emailFrom"); $out .= "<h2>".$name."</h2><h2> Ihre nachricht wurde versendet.</h2>"; } } else { // render out form without processing $out .= $form->render(); } ?> and at the place where you will have your form you can use <?php echo $out; ?> Its not 100% perfect solution but as I was new to processwire and also PHP it works for me.
  7. Thanks for the Tutorial. Is it possible to render the form with custom HTML code ? currently reders $form->render(); this Markup <form> <ul> <li> <label></label> <div> <input> </div> </li> <ul> </form> Is it possible to create own ? Example <form> <div class=one> <div> <label></label> <input> </div> <div> <label></label> <radio> </div> </div> <div class=twoe> <div class="custom1"> <label></label> <input> </div> <div class="custom2"> <label></label> <textarea> </div> </div> </form> Or is there a Exmaple how to handle ALL Input Field Types ? Selct ? Preselected Items ? Radio ? Requirements and and and ... EDIT:
  8. Hey people, i try to chose the SmartKeywords with an tags (page | multiplearray) field. http://prntscr.com/7d7yi5 what i have to change that i get as Keywords the title of the choosen pages ? currently i have the id's in the code <meta name="keywords" content="1088|1091|1082|1083|1084|1085|1086"> where i have to make changes in the Module ? // case 'keywords': if($configData['keywords']) { $pageData['keywords'] = $configData['keywords']; } elseif($configData['keywordsSmart'] && $page->get(implode('|', $configData['keywordsSmart'])) != '') { $pageData['keywords'] = strip_tags($page->get(implode('|', $configData['keywordsSmart']))); } break; or here // Default Keywords $field = $modules->get("InputfieldText"); $field->name = "keywords"; $field->label = __("Keywords"); $field->description = ""; $field->value = $data['keywords']; $field->columnWidth = '50%'; $field->showIf = 'useParents=0'; $fieldset->add($field); $field = $modules->get("InputfieldAsmSelect"); $field->name = "keywordsSmart"; $field->label = __("Smart Keywords"); $field->description = __("We will use those fields (in this particular order) if you don't fill in the keywords field"); foreach($fields as $selectField) $field->addOption($selectField->name); $field->value = $data['keywordsSmart']; $field->columnWidth = '50%'; $field->showIf = 'useParents=0'; $fieldset->add($field); Nobody an solution for me ??
  9. iNoize

    Real estate site

    seems pretty cool. The backend tabs and listings are custom code or based on some existing modules ? could you give me some beginner advices ? I try to code something similar for my own usage and at the same time learn a lot of ne processwire and code skills
  10. Hello, is it possible to get the Distance between two selected points ? I will try to get the distance between two points. The idea is to get near airport and show the distance to the choosen city near airport ? I have no idea how to start to realize this. Some one expierence with this kind of problem ? Thanks
  11. Ive solved the Problem with different parents e.G. for each Land an Parent DE TR EN .........
  12. Thanks, I had to put jquery in the <head> also. Now It works with the cluster and custom icons https://processwire.com/talk/topic/690-map-marker-fieldtype/?p=25865 One question for teh category field. Wchich kind of field it have to be ? Textfield ? echo "\n\n<div id='map'></div>"; //div to show in template map $js = "<script type='text/javascript'>"; $js .= "RCDMap.options.zoom = 2;"; $js .= "RCDMap.init('map', 0, 0);"; foreach($page->children as $items) { $cat = $items->category ? $items->category->name : 'default-icon'; //Uses a field called category for icon. $js .= "\nRCDMap.addMarker('{$items->title}', '{$items->url}', {$items->map->lat}, {$items->map->lng}, '{$cat}');"; } $js .= "RCDMap.fitToMarkers();"; $js .= "</script>"; echo $js; dont get really to work with the custom icon. $cat = $items->category ? $items->category->name : 'default-icon'; //Uses a field called category for icon.
  13. Thanks, no i tried to view the Map with thy RCDMap.js but something goes wrong. I get always the error with the mapNote http://prntscr.com/6j2zmp with one adress i see the Map without marker. With more than one its only a grey div. What could be the Problem ? I use this way https://processwire.com/talk/topic/690-map-marker-fieldtype/?p=18338
  14. Thanks a lot. Ive importet already the adresses. <?php include("./index.php"); // bootstrap ProcessWire's API, if applicable // // // the example template and parent we will be using, change for your use $template = wire('templates')->get('city'); $parent = wire('pages')->get('/verkaufsstellen/de/'); // // get your file, read it into an array $archiveData and start to import it: // // here some (pseudo/example)code set_time_limit( intval(60 * 10) ); // give it 10 minutes, you may also increase this $completeurl = "http://myhxmlurl.de/map.xml"; $xml = simplexml_load_file($completeurl); foreach($xml as $node) { // create the new page to import $page = new Page(); $page->template = $template; $page->parent = $parent; $page->title = $node->Firma; $page->map->address = $node->StrasseNr.",".$node->Plz." ".$node->Ort; $page->save(); // testing echo 'id: '.$page->id.'<br/>'; echo 'path: '.$page->path; } // $t = Debug::timer(); // do some expensive code execution here // echo Debug::timer($t); How to renew the geocode without a new page ?? And have also trouble with the 'useHoverBox' => true options. maybe you have an
  15. Ive imported about 500 adresses. Now I have to open every page and click on the adress field to geocode right the adress. Its possible to do this via API ? http://prntscr.com/6hf9zx after click http://prntscr.com/6hfa3a
  16. I don't really understand why you need some profi monitor if you come from music and never had to do something with color management or something else. I've IeaRn on the newest Lacia (2006) Monitor to design & make beauty the product's/pics for some big companies like KNORR, MAGGI, PERIE and its a science. My goal was that it seems well if it's printed. All the Color management, print profiles etc. have to be configured especially for the print/screen output . You will never have the same thing for all users. E.g. you have a good screen with well configured colkor management. On you Screen is the Artwork perfect. BUT !!! On other devices screens/ printers / phones you will never had the same thing. Every hardware is configured with other ways . In most cases with the humans eye. So what's the main goal that you Will reach with better or new screen ? Your own ? For customers ? Screen / print product's ??
  17. WOW Thanks for your answer, This is the proof that with PW is nothing impossible
  18. Pretty modern and maybe too modern look for Russian CarParts . It's not so easy to choose the right font in Russian. Here it looks really futuristic. I'm watching on my phone but it seems to be really huge. All the dealers news shops maps WOW. How many people fill the content ? So it works really fast. It Will be interesting to take a look on the site structure for the amount of content. For Example how many differen templates do you use ? With / Without template files. Whats initialized in the settings? Which method do you use for the output for the content. There are a lot of different examples here and there but it's especially interesting for such a huge project. Which way you have chosen. https://processwire.com/talk/topic/740-a-different-way-of-using-templates-delegate-approach/
  19. I also promise untill you have time . There are many people like dazzyweb for asking questions . Some People use the current module here. Could maybe someone export an example profile with the Shop (Invoice, PayPal,Email notification ) ? I've seen 3 or 4 different versions. One in the Modules Repo. Modifications done by Soma and some modified files by Nicko. So it's for halfcoders like me confusing which one to use now ? I've tried to combine this examples for me but it won't really work.
  20. Its possible to test the module ? Or to see a demo or something ? When do you thing it could be online ?
  21. YAY your timing couldn't be better ! TNX a lot
  22. my first idea was the same like Soma's for every language own image var. I thought maybe there is a simple way. At the end I have about 10 Languages maybe and i have to upload foe every language all the 4 pictures ? I have to write an function ? How to check which language is active currently ? I come not around to solve this so, because the customer want it so
  23. Hello I need some advice how to solve my problem. I have a slider with 4 images. The first picture is different for every language. How can I define with the most efficient method which images should shown for every language??
  24. Had the Same Problem If still there for me worked to change in the ShoppingCart.module from total_sum = $total_sum to total_sum = '$total_sum' // Update cart to db or insert new row if there isn't $update = $this->db->query("INSERT INTO {$this->className} SET items = '$items', total_sum = '$total_sum', session_id = '".$this->getSession() ."'ON DUPLICATE KEY UPDATE items = '$items', total_sum = '$total_sum'"); and $update = $this->db->query("UPDATE {$this->className} SET items = '$items', total_sum = '$total_sum' WHERE session_id = '" . $this->getSession() . "'"); EDIT !!! So i found a better way and the real problem I think. This Error comes if you dont use the Standart Location. Based on the Module in /wire/modules/LanguageSupport/LanguageSupport.module on line wire('config')->dateFormat = $this->_('Y-m-d H:i:s'); // Sortable date format used in the admin $locale = $this->_('C'); // Value to pass to PHP's setlocale(LC_ALL, 'value') function when initializing this language // Default is 'C'. Specify '0' to skip the setlocale() call (and carry on system default). if($locale != '0') setlocale(LC_ALL, $locale); I had the problem that my float field was always with an comma " , " set. If you put the brackets like my first idea total_sum = '$total_sum' you will have trouble later with the PayPal module for examle. So i have set the setLocale(LC_NUMERIC, 'C'); every time if I use float. ShoppingCart.module setLocale(LC_NUMERIC, 'C'); // Update cart to db or insert new row if there isn't $update = $this->db->query("INSERT INTO {$this->className} SET items = '$items', total_sum = $total_sum, session_id = '".$this->getSession() ."'ON DUPLICATE KEY UPDATE items = '$items', total_sum = $total_sum"); // var_dump($total_sum); exit; return true; and $total_sum = $this->getTotalSumFromItems($items); $items = json_encode($items); setLocale(LC_NUMERIC, 'C'); $update = $this->db->query("UPDATE {$this->className} SET items = '$items', total_sum = $total_sum WHERE session_id = '" . $this->getSession() . "'"); return $items; and It work for me. I dont think its the best way but for me it works currently. Greetz
×
×
  • Create New...