Jump to content

RyanJ

Members
  • Content Count

    190
  • Joined

  • Last visited

Community Reputation

78 Excellent

About RyanJ

  • Rank
    Sr. Member

Profile Information

  • Gender
    Not Telling
  • Location
    Virginia

Recent Profile Visitors

4,685 profile views
  1. This post has a perfect solution if anyone else need it. I will be glad to share my code if needed.
  2. I am looking for a clean way to remove the "Media Manager" pages from the top search in the admin for a certain user role. When searching, these pages are being returned and confusing the user that they can edit them instead of using the Media Manager tool. Attached is an image to help describe what I mean. Make note of the page types "Media Manager: ect" I was thinking a hook using ProcessPageSearch? Any thoughts or suggestions are appreciated. example
  3. Simple $var = $page->getUnformatted('field_name'); foreach ($var as $v) { //your markup //table column name $v->column_name }
  4. Hello! Looking for a bit of advice or suggestions here. I don't claim to be a nginx expert, but I have PW version 3.0.62 powering an app running on a cloud server with nginx. Everything operates fine for the most part, but from time to time I am getting a network error message when trying to navigate in the admin or just a plain ole 500 error. Specifically when logging in initially and trying to view the page tree. A pop up window appears with the network error message (I will grab a screen shot next time I see it). Also when navigating through the admin I get random 500 errors. php 5.6.x nginx cloud hosting service A couple of corresponding logs below. Error log in pw admin: Error: Cannot instantiate abstract class ProcessWire\ProcessPageListRender (line 331 of /xxx/xxx/xxx/wire/modules/Process/ProcessPageList/ProcessPageList.module) Nginx Error log: 017/05/12 10:11:47 [error] 7305#0: *14305329 readv() failed (104: Connection reset by peer) while reading upstream, client: xx.xxx.xxx.xxx, server: theserver, request: "GET /login/page/ HTTP/1.1", upstream: "fastcgi://unix:/xxxxx/dev/.php-fpm.socket:", host: "thehost", referrer: "http://domain/login/setup/logs/view/errors/" 017/06/21 14:15:29 [error] 29093#0: *106631997 readv() failed (104: Connection reset by peer) while reading upstream, client: xx.xxx.xxx.xxx, server: server, request: "GET /login/page/edit/?id=1489 HTTP/1.1", upstream: "fastcgi://unix:/xxxxx/dev/.php-fpm.socket:", host: "thehost", referrer: "http://domain/login/page/" Thanks for your time.
  5. Just used this module with pw version 3.0.62 and it works just fine.
  6. $pages->addHookAfter('saveReady', 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->page_assignment->add($grandchild); } } } } } I figured it out. Two things to change if anyone is looking to do the same. 1. Use the right hook. saveReady instead of save. 2. Add the page object. $page->page_assignment->add($grandchild);
  7. 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); } } } } }
  8. 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?
  9. 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.
  10. 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.
  11. 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" } },
  12. 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.
  13. 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.
  14. 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.
×
×
  • Create New...