RyanJ
Members-
Posts
208 -
Joined
-
Last visited
Everything posted by RyanJ
-
Hello, I have a page field type (Multiple pages(PageArray)) with the input field type as AsmSelect. The admin users can select one or more pages from a list in the admin area. Some of those pages have children and if a checkbox is selected and the parent page has been added to the list, then I want to add the child pages as well on page save. So in admin.php I am trying to set those id's, but I can't get them to save. Hopefully the code clears up what I am trying to do. I appreciate any assistance. $pages->addHookAfter('save', function($event) { $pages = $event->object; $page = $event->arguments(0); //check if on template if($page->template == 'item') { //is the checkbox checked to add children if ($page->add_children == 1) { //get the values in the page field type field foreach ($page->page_assignment as $child) { //if selected pages have childen if ($child->numChildren > 0) { //loop through those children foreach ($child->children as $grandchild) { //set values. //$page->set('page_assignment', array($grandchild->id)) $page->page_assignment = array($grandchild->id); //we got the id of the page we need to s $pages->error($grandchild->id); } } } } }
- 1 reply
-
- page field type
- asmselect
-
(and 1 more)
Tagged with:
-
I am trying to get this to work with Kongondo's Media Manager Module. Unfortunately I can't get the url/description to return. I have modified the plugin with no luck, It still returns null. Anyone had any luck with these two?
-
Hi Kongo, Does the capability exist that allows the admin user to select from the media manager if the standard file/image field types are being used elsewhere? So for clarification, I am using a file and image field type and would like the ability for the user to select from both the default or the media manager gallery. This will allow me to use the existing fields without losing any of the images that already live in the assets folder.
-
So I figured it out and here is my complete code if it would help anyone else. //get the pages you want $items = $pages->findMany("template=item"); wire()->addHookAfter('Pages2JSON::getValue', function($event) { //get the host $host = wire('config')->httpHost; $value = $event->arguments(0); if(!is_object($value)) return; //check if field is an image, images or file type if($value->className == 'Pageimage' || $value->className == 'Pagefile') { //append the host to those values $urls = array("url" => $host . $value->url, "description" => $value->description); $event->return = $urls; } }); header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); echo $items->toJSON(); exit(); Thanks again for the great plugin.
-
Great module! It came in handy and saved me a lot of work from building my own JSON. Thanks! I do need to modify the output and I am struggling to understand how to do so. By default, the http host is not appended to any url and I need that for this particular project. I figured this would be a simple fix, but can't find where to alter that particular value. If you reference the json below, you will see the file node with the url displayed. There are two other nodes that I need to alter the same. Images and video. Any tips are appreciated. //original code $items = $pages->findMany("template=item"); echo $items->toJSON(); { "pages": [ { "id": 1033, "title": "Page 1" }, { "id": 1116, "title": "Page 2" } ], "categories": [ { "id": 1031, "title": "Brochures" }, { "id": 1036, "title": "Photos" } ], "file": { "description": "File 1", "url": "/site/assets/files/1039/file1.pdf" }, "id": 1039, "images": [], "modified": 1490728945, "title": "Test Document 1", "type": { "name": "file" } },
-
It may not be in the latest version, but if so, I am assuming it would be in the same place in the modules settings page at the bottom under Spam. By default there are 5 spam fields. From your list, you are missing a few (again, this may have changed in the latest version of the module). Glancing at the latest documentation, it looks like you are missing " scf-website " field. Also, check the names on your input fields in your markup. A typo could throw the error too I believe.
-
Look at your anitSpamCountAdditionalInputs. I have not played with the version that is compatible for PW 3.0, but I run into this message often and usually its just an oversite of fields. Also in your markup, make sure you name fields match those in the template or else you will get that message.
-
And are you trying to map to those fields? Also, if you are trying to set the page id and url, then this is not going to work. PW creates its own page id and url once when you do the import. You can update the url, but not out of the box using this module unless something has changed since last time I used it.
-
Hi LostKobrakai, I will be glad to write up any specific details you would like to hear about, but thought this may be a better general overview. If this does not answer your question, please let me know and I will try to be more detailed, but I am still learning how the entire migration process works myself. Since they support WordPress, it works out the box, but I don't see any reason why it would not work with PW.
- 30 replies
-
- 1
-
- deployment
- tools
-
(and 1 more)
Tagged with:
-
I recently had the experience to spin up a WordPress website using pantheon web service. I got to say that I am truly impressed with the workflow it provides out of the box for WordPress and even Drupal. You get three environments to work in, Development, Stage and Production. The fact that you can pull back the production database into your development environment is such a useful tool. Would love to see PW as an option for them.
- 30 replies
-
- 2
-
- deployment
- tools
-
(and 1 more)
Tagged with:
-
You could and most browsers would submit to itself. However your code will not validate and its suggested you define the action. Not really sure why you would not want to. Here is a good answer http://stackoverflow.com/questions/9401521/is-action-really-required-on-forms
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
RyanJ replied to Nico Knoll's topic in Modules/Plugins
Just a follow up here. The module works perfectly fine with the method above if you make sure you add the template to its settings DUH!! -
MarkupSEO - The all-in-one SEO solution for ProcessWire.
RyanJ replied to Nico Knoll's topic in Modules/Plugins
Hello, I want to follow up with this post here as I am having the same issue. In my case, I am converting a wp blog over and need to keep consistent urls by (removing /blog/) from url. I am following Ryan's methodology here.. All works great, but if I automatically include the meta in the modules settings, on my post template, all of the meta is showing up twice. If I manually try to echo the seo meta, then I get the undefined index that was mentioned in the first link I referenced. Anyone else experienced such? SEE BELOW -
Do all your fields match up on your form to what the module has generated? Check your template field names against what is in the module settings. Make sure you save the module if you have updated or changed any fields. Also check the antiSpamCountAdditonalInputs in the module settings and make sure those fields exist in your template.
-
Hi benbyf, Check the error log. You are likely not passing validation and getting spammed out. Check this forum on how to address it. I can't find the post right now, but will link to it when I do.
-
Thanks Wanze, the output headers was one of my issues indeed. I am back at it again with some issues getting custom fonts to load. In this case I have read a few topics in the forum as well as the manual here. I am attempting to include an Open Sans font. The steps I have taken are so. Added ttf file to modules/Pages2Pdf/mdf/ttfonts modified config_fonts.php $this->fontdata = array( "dejavusanscondensed" => array( 'R' => "DejaVuSansCondensed.ttf", 'B' => "DejaVuSansCondensed-Bold.ttf", 'I' => "DejaVuSansCondensed-Oblique.ttf", 'BI' => "DejaVuSansCondensed-BoldOblique.ttf", ), "opensans" => array( 'R' => "OpenSans.ttf", 'B' => "OpenSansB-Bold.ttf", 'I' => "OpenSansI-Italic.ttf", ), Changed Mode in the module settings to "s" Updated the Default Font in the Module Settings to "OpenSans" Anything stand out that I am missing?
-
Hi Wanze, That did the trick. I commented out the saving of the file and all appears to be working now (Virtual Hug). Am I write that the file call's the module needs to be included before any other files? I am assuming this has to do wit the header that has to be sent.
-
Hi Wanze, Thanks for pointing out the examples. I was hoping I could just append an id, but I have went the route you suggested. The problem I am having is actually getting the document to display. (I am getting a Failed to load PDF document message). I have a get variable set as ?pdf=1 and the pdf is being written to the folder using. $pdf->save($page->filesManager->path . $file_name); $pdf->download($file_name); When I download the pdf, it is perfect, but viewing it in the browser is the issue. Thanks for your assistance. Updates:: forcing a download also has the same issue $pdf->download($file_name, 'D'); Update:: This issue was where I was calling the module. It should go before the header file is included. This may or may not be the right solution, but it did to the trick for me. Although, there is some issues now with images not showing up.
-
I am not sure the best approach for this, but suggestions are appreciated. I have created a members portal that allow each member to select some "nodes" (pages) and stores them in a page field type that I have assigned to the user template which is an admin template. They can then download the pdf containing the pages that they have selected. The issue is that I need to store the pdf's under each users page instead of the selected page. Is this possible? I would also really like to be able to use $user->name in the naming convention as well. I guess this would be possible using the hook you described here. I think just appending the user's id to the file name would do the trick for now. Awesome module by the way. Thanks for sharing it.
-
Login using e-mail rather than username (and general login issues)
RyanJ replied to mindplay.dk's topic in Modules/Plugins
This seems to work, although I am not sure it is the best solution. if($input->post->email && $input->post->pass) { $email = $sanitizer->email($input->post->email); $pass = $input->post->pass; //get user name $who = $users->get("email=$email")->name; if ($who) { //start a session if they exist $user = $session->login($who, $pass); } // if they are a logged in, it must match if ($user) { echo "it matches" . "<br />"; } else { echo "it does not" . "<br />"; } } -
Login using e-mail rather than username (and general login issues)
RyanJ replied to mindplay.dk's topic in Modules/Plugins
Bringing an old post back alive. I cannot get the user to authenticate and start a session for whatever reason in a custom login form. This form is for frontend users. I am hoping someone can see what I am missing. I am getting the user->name for the particular user though. if($input->post->email && $input->post->pass) { $email = $sanitizer->email($input->post->email); $pass = $input->post->pass; //allow for email login $us = $users->find("email=$email"); foreach($us as $u) { echo $u->name . "<br />"; if($u->pass === $pass) { echo "it matches" . "<br />"; $u = $session->login($u->name, $pass); } else { echo "it does not" . "<br />"; } } } -
Auto Generate page name, title and update field on page creation.
RyanJ replied to RyanJ's topic in Module/Plugin Development
Hi Netcarver, I look forward to your solution and thanks for your assistance. -
Hello, I have modified a module that I found in this topic. To sum it up, I have created a unique field on the root page that is called counter and is set at a unique number. when a new page is created, the module auto populates the page name and page title using this counter. The two functions renderName and CreateTitle work fine. What I am struggling with is how to update the counter field after the new page is created. Any suggestions or tips are appreciated class invoiceGenerator extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ private $id; public static function getModuleInfo() { return array( 'title' => 'Generates Invoice Number', 'version' => 100, 'summary' => 'Set the title field & page name to predefined value', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookBefore("Inputfield::render", $this, "renderName"); $this->pages->addHookBefore('save', $this, 'createTitle'); $this->addHookAfter('Pages::saved', $this, 'counterUpdate'); } //create the page name public function renderName(HookEvent $event) { // get the current field $field = $event->object; if(($field->name == 'title' || $field->name == '_pw_page_name') && $field->value == '' ) { $counter = wire('pages')->get(1)->invoice_counter; $id = "WR-" . date("Y") . "-" . ($counter+1); $field->set('value', $id); //$this->log("this is page name" . $this->id); } } //create the page title public function createTitle(HookEvent $event) { $page = $event->arguments[0]; if ($page->template == 'order') { $counter = wire('pages')->get(1)->invoice_counter; $id = "WR-" . date("Y") . "-" . ($counter+1); $page->title = $id; //$this->log("this is page name" . $this->id); } } //update the counter field public function counterUpdate(HookEvent $event) { $page = $event->arguments[0]; $root = wire('pages')->get(1); $counter = $root->invoice_counter; $root->invoice_counter = $counter++; $root->save("invoice_counter"); //save the page } }
-
Great module, thanks for sharing. I was interesting in adding the new Google Recaptcha in addition to the honeypot. Has anyone had any luck doing so and if so any suggestions on the best approach to add it? Thanks
-
That does make sense Dave, thanks. However maybe I am misunderstanding how this fields settings works. Under the input tab on this fields settings, If I modify the "Date Input Format" to none and then modify the "Date Input Format Code" to "Y" per PHP Date then an acceptable format for this field should be the full year ie "2012". Is this not correct? When doing so the value reverts back to 1969 and the value stored in the DB is 1969-12-31 19:33:32