![](http://processwire-forums.s3.us-west-2.amazonaws.com/set_resources_6/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
kreativmonkey
Members-
Posts
56 -
Joined
-
Last visited
Everything posted by kreativmonkey
-
Comment Spamprotection without Akismat
kreativmonkey replied to kreativmonkey's topic in Wishlist & Roadmap
After i learned a few things about php, i believe that i can port the plugin. But for that I need some help with the integration of functions. For the Plugin i need to save the IP (in shorted form) within the Comment. For this reason I have to expand to an IP field the comment database. All the filters are Optional: Check the comment IP with approved comments in the database Match the comment IP with external spam Database trust comments with gravatar classify BBCode as spam use regular expression create and use a local spam database At the moment i create the functions for doing the stuff in the list above. The next step is to integreat the Plugin to the processwire System and at least i will add support to limit comments to defined language. For all who interested at this plugin can follow on the Github project: https://github.com/kreativmonkey/antispam-guard -
How to modify/add the templates setting
kreativmonkey replied to kreativmonkey's topic in Module/Plugin Development
I think i found the right hook to add some settings to the templates edit Page: protected function ___buildEditForm(Template $template) { so i can use .... addHookBefore('ProcessTemplate::buildEditForm', buildEditForm($event)) .... protectet function buildEditForm(Template $template) { $t = new InputfieldWrapper(); $t->attr('title', $this->_x('Notification', 'tab')); // $t->head = $this->_('Optional usage and placement in the page tree'); $t->attr('class', 'WireTab'); $t->attr('id', 'tab_notification'); $t->add($this->buildEditFormNotification($template)); $form->add($t); ...} protected function buildeditFormNotification(Template $template){ ....} do i need to Hook the executeSave() to save my fields? Is addHookBefore the right one ore do i need addHook ore addHookAfter?.... Thanks for your help! -
Hi, i would like to modify the template settings pages and add some options for a notification module. How can i do that and how can i get this information back in the module? Thanks for your help!
-
Thanks Mats, that's work fine. I must change Something in the Module for using the LDAP v3 Protocol. Now i found a problem in this module by changing password in ldap. When the user change his Password he can login with the old password on processwire. But when he login with his new password the login hangs in a loop. Processwire ask the ldap again and again and ldap answer true again and again. after this loop i can login with the new password. i can't find the part who loops the login! Thats the part who i change: public function ___login(HookEvent $event) { if ($event->return) return; // Skip if already logged in $username = $event->arguments [0]; $password = $event->arguments [1]; // skip if user already exists locally //if (!$this->users->get("name=$username") instanceof NullPage) // return; // Set default user domain name if not given //$username = str_replace('@', '', $username) == $username ? "$username@{$this->defaultLoginDomain}" : $username; // Workaround $ldapusername = "uid=$username,ou=People,dc=ffmyk,dc=de"; if ($this->ldapUserLogin($ldapusername, $password)) { $wireUserName = $this->sanitizer->pageName($username); $user = $this->users->get("name=$wireUserName"); if ($user instanceof NullPage) { $usersPath = $this->users->getGuestUser()->parent; $user = new User (); $user->parent = $usersPath; $user->name = $wireUserName; $user->pass = $password; foreach ($this->userDefaultRoles as $role) $user->addRole($role); $user->save(); } else { $user->setOutputFormatting(false); $user->pass = $password; $user->save(); } // Reset given LDAP-Username to WireUsername $user = $this->session->login($wireUserName, $password); $event->return = $user; $this->message($this->_('Logged in via LDAP')); return; } and public function ldapUserLogin($user, $password) { $connection = $this->connectLdap(); if (!$connection) return false; ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3); $bind = @ldap_bind($connection, $user, $password); return ($bind !== false); }
-
Hallo, how can i change the Module to login every User with LDAP? The Problem is when a User change his LDAP Password, he can login on Processwire with the old password so long he not login with the new Password! That is a big Security Problem. So i will authenticate every User by checking the LDAP. Any Idea?
-
Hi Marvin, i have problems to install this module on my Processwire Projekt. I have install php-ldap extension and activade ldap.so in my php.ini but after upload the ldap-sign-in folder to my Processwire modules folder, i can't see the module in the Processwire modules list. What is the Problem?
-
Thank you guys!!! That solve my issue!!
-
I get always empty RSS Feed output! On my Page i call the RSS module by url selector like blog/rss and for the output i need the same page array that i use for the /blog page. But in the RSS Feed i get no content! $blogposts = $pages->find("template=post, publish_date<$today, sort=-publish_date, limit=10"); if($input->urlSegment1 === 'rss'){ // retrieve the RSS module $rss = $modules->get("MarkupRSS"); // configure the feed. see the actual module file for more optional config options. $rss->title = "Letzte Blogeinträge"; $rss->render($blogposts); return; } else { $content = renderPosts($blogposts, true); }
-
Hi Adam Kiss, thank you for the replay but this didn't solve the problem. I get every day 10 or more massages from this error selector '' or selector '%'. I can't locate the problem in my code....
-
Hi, scince two weeks i have start my live webpage with processwire. Now i get the following error message on the administration e-mail for error messages: Error: Exception: Unknown Selector operator: '%' -- was your selector value properly escaped? (in ./produktiv/wire/core/Selectors.php line 281) That error is called by the guest user and i don't know what this user do! I think this user is a bot because the error triggers day and night. Now i would like to protect the page, that this error message never come back. But i don't know how i can start to find out what the bot calls! The only idea that i have is the $input->urlSegment but when i type in http://www.url.example/% i get the message "Bad Request" and nothing happends on the error log! Or this part of Code: /*************************** * Redirect the old URLs to the new Position * Use the oldurl field on the Post template **************************/ $thisurl = $sanitizer->url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); $redirect = $pages->get("template=post, oldurl=$thisurl"); if(!$redirect instanceof NullPage){ $session->redirect($redirect->url); } Can anyone help me?
-
that is embarrassing to me.... and I have been working for over an hour on it and have not seen it. Sorry and Thanks a lot!
-
Hi, i like to display rendom images from pages to my sidebar, now i give up and ask you! Thats my Code, i have create with the results of my searches: $pagesWithImages = wire('pages')->find("images.count>0, template=post, limit=10, sort=rendom"); $out = "<div class='sidebar gallery'><h3><i class='fa fa-picture-o'></i> Gallery</h3><div class='row'>"; foreach($pagesWithImages as $p){ if(!count($p->images)) continue; $pageUrl = $p->httpUrl; $pageTitle = $p->title; $images = $p->images->getRendom(); $out .= "<div class='col-md-4 col-sm-6 col-xs-6'><a href='$pageUrl'><img class='img-responsive' src='{$images->size(80,80)->url}' alt='$pageTitle'/></a></div>"; } return $out .'</div></div>'; at the first line i wont to get all pages with images inside put that dosn't work, i become a lot of pages without images... so i test for images at the loop, that works! In the loop i get informations from the page and now the problem, i wont to get a rendom image from the image array (the output formatting is alway an array!!) and than i call this image to the ->size() function! Fatal error: Call to a member function size() on a non-object in /processwire/site/templates/_init.inc on line 172 i don't know what i have to do! print the array i loop the array, i do a lot of things but always the same error massage that i try to call a member function on a non-object! But there is an object and the cheatcheet says "Returns a single random item from this WireArray." that sounds to me like to get $image->first() but not the first one but rendom!
-
Hi Marcus, first thank you for this Module. I use it with PW 2.6 and it works perfect. In my case i have creat an Bookmark Icon to display if the page is flagged or not.I display this icon on a list of Pages like the following image: For this case i do a little modification on the renderLink function at your module: public function renderLink(Page $page, $add = "<i class='fa fa-bookmark fa-lg' title='Setze ein Lesezeichen für %s'></i>", $remove = "<i class='fa fa-bookmark fa-lg bookmark-activ' title='Entferne das Lesezeichen für %s'></i>") { /* * Render link switch to flag/unflag pages */ if (!$this->allowedRoles) { echo("You need to grant flagging permissions first!"); }; $user = $this->user; $input = $this->input; if(!$page->id) $page = $this->page; $currentPage = $this->page; $pages = $this->pages; $session = $this->session; $userFlaggedPages = $this->user->flaggedpages; $user_role_stack = array(); now i can call this function with: echo $flags->renderLink($page); so i can use this on a list of pages: foreach($pages as $p){ echo $flags->renderLink($p); } i don't know how a batter solution than this.
-
Hi Community, i started to creat my Website with Processwire for a Month. Now i will start with a lot of tuneup by manage all from the frontend. On my Page are Users they can creat Content, i have build a Publishing Workflow and after Publishing the user can't edit the page. All that on the Backend (Admin), now i will creat a frontend management for the users. My Templates use MapMarker, Imagefield, Repeater Group Fields... Is it possible to provide the Backend form to the frontend with in all the features? I know i need the jquery and functions from the backend but i don't find the right Topic within this informations.... I know in tho forum are a lot of topics but i don't found the right one. Can you help me to start? Thanks
-
Display $user->image error on Frontpage
kreativmonkey replied to kreativmonkey's topic in Getting Started
not that i know of! the only point i change the output formatting is in the import script for my posts but that is not load on this templates! i don't manipulate anything on the $user pages. The image output works great on all pages (with any template) that i have created but it didn't work on the other pages on the same templates... EDIT: The full error while using $user->avatar->size(30,30)->url: Fatal error: Exception: Method Pageimages::size does not exist or is not callable in this context (in /.../mtar/processwire/wire/core/Wire.php line 350) #0 /.../mtar/processwire/wire/core/WireArray.php(1637): Wire->___callUnknown('size', Array) #1 [internal function]: WireArray->___callUnknown('size', Array) #2 /.../mtar/processwire/wire/core/Wire.php(387): call_user_func_array(Array, Array) #3 /.../mtar/processwire/wire/core/Wire.php(325): Wire->runHooks('callUnknown', Array) #4 /.../mtar/processwire/wire/core/Wire.php(329): Wire->__call('callUnknown', Array) #5 /.../mtar/processwire/wire/core/Wire.php(329): Pageimages->callUnknown('size', Array) #6 /.../mtar/processwire/site/templates/include/navbar.inc(66): Wire->__call('size', Array) #7 /...mtar/processwire/site/templates/include/navbar.inc(66): Pageimages->size(30, 30) #8 /.../mtar/processwire/site/templates/include/main.inc in /.../mtar/processwire/index.php on line 253 EDIT: I use the Debug Code from adrian with the $user->avatar->url and this is the result: Time User Page Value vor 3 Minuten 2015-08-13 23:52:35 kreativmonkey /blog/altonarite/ /site/assets/files/41/picture-1-1384808667.jpg vor 4 Minuten 2015-08-13 23:51:53 kreativmonkey /blog/gossipibom/ /site/assets/files/41/ first is a page that i have created and the second is created by another user. EDIT: $user->of() is true on pages that i have created and false on pages from other users but i do nothing in the templates that can explain this behavior. -
Hi, i will display the user profile image while the user is logged in. The image field is a single item and limited by 1. My code to Display: if(count($user->avatar)){ echo "<a class='dropdown-toggle' href='#' data-toggle='dropdown' id='navUserImg'><img class='img-circle' src='".wire('user')->avatar->size(30,30)->url."'></img></a>"; } else { echo "<a class='dropdown-toggle' href='#' data-toggle='dropdown' id='navUserFa'><i class='navUserFa fa fa-user fa-lg'></i></a>"; } Now when i'm on a page that i have created i will see my image. But when i load a page from another author so i get the following issue: Expection: Method Pageimages::size does not exist or is not callable in this context when i now change my code to this if(count($user->avatar)){ echo "<a class='dropdown-toggle' href='#' data-toggle='dropdown' id='navUserImg'><img class='img-circle' src='".wire('user')->avatar->first()->size(30,30)->url."'></img></a>"; } else { echo "<a class='dropdown-toggle' href='#' data-toggle='dropdown' id='navUserFa'><i class='navUserFa fa fa-user fa-lg'></i></a>"; } It will work on the pages of other authors, but when i go back to pages that i have created so i get another issue: Exception: Method Pageimage::first does not exist or is not callable in this context For the moment i have set the output formatting as array so i can call ->first() and it works on all pages but that is not the right solution. Can anyone help me? what do i make wrong.
-
oh sorry, after a lot of time i found the issue by my self... i have change the template name in the template settings but the have create a template with the name of the template not the changed name.... sorry for that!
-
hi, i have Imported some pages with a self written script to import posts and comments. The Import works fine, now i will display the content on the frontend page and make the template.php i have a list of the pages in en templates.php and a link point to the page. But when i open the link i get a 404 page. In the backend the page is there and the url thats saved to the post is the same as the link on the frontend. What can i do?
-
Thanks, the first issue are solved! The next Problem is to set the User i get following issue: Notice: Object of class User could not be converted to int i but the output of $authorID is a int ... 1370 or something else. for testing i use this code: $authorNameSanitiz = $sanitizer->name($authorName); $authorID = $users->get($authorNameSanitiz); if($authorID instanceof NullPage && $authorNameSanitiz != 'guest'){ # Creat new User echo 'creat User: '. $authorName .'<br>'; } elseif($authorNameSanitiz != 'guest') { echo "Existiert: " . $users->get($authorID)->name . " id= " . $authorID . "<br>"; } else { echo "Gast <br>"; }
-
Hi, i want to import stuff from Drupal to Processwire and have create an importscript but some things doesn't work. I import a list of questions from users and i will manipulate the page created date (thats work fine) and change the User to the right one. If the User dosn't exist, i will creat a new one. But this is the first problem i have, no user will be change or create... The second problem is to find out if the page does alrady exist or not. If the Page exist i will only modify some fields, otherwise i will create a new page..... To find out if the Page exist and whats the Page ID do i also need to import the Comments..... readCSV.php: // Read the CSV file and get an array of rows function readCSV($file){ $lines = array(); foreach(file($file, FILE_IGNORE_NEW_LINES) as $line){ $lines[] = str_getcsv($line); } return $lines; } import.php: while($i < $countArray){ // Initzalisierung der Variablen $title = $data[$i][0]; $date = $data[$i][6]; #$summary = ''; $body = $data[$i][1]; $categorys = $data[$i][4]; $tags = $data[$i][3]; #$images = ''; $authorName = $data[$i][5]; $sanitizTitle = $sanitizer->pageName($title); $post = $pages->get("template=$template, name=$sanitizTitle"); if(empty($post)){ $p = new Page(); // create new page object $p->template= $template; //set template post $p->parent = wire('pages')->get('/$parent/'); //set the parent $p->name = $sanitizTitle; // SANITIZE!!!! $p->title = $title; // added by Ryan: save page in preparation for adding files (#1) $p->save(); $p->created = $date; // Timestamp!!! $p->save(array('quiet' => true)); // To save the created Date $p->body = $body; // $p->summary = $summary; // Looking for the inizialisation $p->tags = $tags; $p->categories = $categorys; $p->save(); echo 'Created Page: '. $title .'<br>'; $authorNameSanitiz = $sanitizer->name($authorName); if($users->get($authorNameSanitiz)){ $authorID = $users->get($authorNameSanitiz); $p->createdUser->name = $authorID; } else { $u = new User(); $u->name = $authorNameSanitiz; $u->addRole("author"); $u->addRole("guest"); $u->save(); echo 'creat User: '. $authorName .'<br>'; $authorID = $users->get($authorNameSanitiz); $p->createdUser = $authorID; } $p->save(); #} // populate fields //$p->images->add('path/to/image1.jpg'); // add multiple to images field $i++; } The CSV: "Titel","Inhalt","E-Mail","Schlagworte","Thema","Benutzername","Beitragsdatum" "digitale Filme in der Strahlentherapie","Hi,<br>zur Zeit suchen wir in unserer Abteilung für Strahlentherapie in Regensburg eine digitales Filmsystem.<br>Welche Firmen bieten den solche Systeme für die Strahlentherapie an?<br>MfG<br>Jan<br>","janmee@web.de","","Strahlentherapie","pete","1437587189" "Gehalt MTA R","Hallo,<br>ich interessiere mich für den Beruf. Wo kann ich erfahren, was ich ausgelernt verdiene? Gibt es einen Tarifvertrag? In welchem ist man da wie eingruppiert? Vielen Dank<br> <br> <br> <br> <br> <br>","sweetmic@web.de","Gehalt","Radiologie","guest","1437303471" what am i doing wrong?
-
Hi, i need to create a page in a page with multible values or load an existing page. Thera are the page field, but this supports only the page name and i must edit this page after adding. My Situation: i have an list of events and the event is started from a company. The companys are listed in an company list. With the page select field type i can select the company ore add a new one. But the Company needs more information than the name, i will get the number, url and address from this pages ore add this value to the new one. How can i do this?
-
How to qery the state of an option at option fieldtype?
kreativmonkey replied to kreativmonkey's topic in General Support
Thank you LostKobrakai, that is what i want! It works fine! Thanks a lot! -
How to qery the state of an option at option fieldtype?
kreativmonkey replied to kreativmonkey's topic in General Support
Hi Webrocker, thanks four your answere. This field handels the display of an article, not only for the image in the article. So wenn the Hide option is checked the article image doesn't show, when the featured option is checked, the post will shown on the first position on an article list.... i can make an checkbox for each option but i think the optienfield with radio button is for this the better solution. I want to find out if the option 0 = hide is checked or not! -
Hi, i have an option field with display options with an set of options: Hid article image Feature article some more.... now i will make the logic in my template for the article image. If the Option is checked the image will be hid. $artikelIMG=''; if(count($page->images)){ if(!$page->article_opiton == 1) { $image = $page->images->first(); $output = "<div class='article-image'>"; $output .= "<a href='{$image->url}' data-lightbox='titleimage'><img class='img-responsive img-rounded' src='{$image->size(900,350)->url}' alt=''></a>". "<span class='quelle'>Quelle des Bildes</span> </img>". "</div>"; $artikelIMG = $output; } } But i don't know how i can ask if the option 1 is checked or option 3 is checked .... Thanks alot for helping me, Sebastian
-
Thanks for your answer, i read about meta viewport few weeks ago, but i forgot it!