modifiedcontent

Members
  • Content count

    142
  • Joined

  • Last visited

Community Reputation

23 Excellent

About modifiedcontent

  • Rank
    Sr. Member

Recent Profile Visitors

1,120 profile views
  1. Saving a complete user object also doesn't seem to work. When I try something like this, only the username gets saved, none of the other fields - except maybe addRole: $u = new User(); $u->of(false); $u->firstname = $sanitizer->text($input->post->firstname); $u->lastname = $sanitizer->text($input->post->lastname); $u->name = $sanitizer->text($input->post->name); $u->email = $sanitizer->email($input->post->email); $u->registrationDate = time(); $u->addRole(''); $mainsite->users->save($u); Or am I doing something wrong? This works: $newuser = $mainsite->users->add(); $u = $mainsite->users->get( $newuser->id ); $u->of(false); $u->firstname = $sanitizer->text($input->post->firstname); $u->lastname = $sanitizer->text($input->post->lastname); $u->fullname = $u->firstname.' '.$u->lastname; $u->name = $sanitizer->text($input->post->username); $u->email = $sanitizer->email($input->post->email); $u->registrationDate = time(); $u->addRole(''); $mainsite->users->save( $u );
  2. Oops, kongondo. $forum should have been $mainsite. Now corrected in the example. @ Sergio, I know that, but is there a way to make that work from a "sister site" with this method? $mainsite->user->isLoggedin(); doesn't work.
  3. I kinda use this forum to keep track of how-to's and things I need. Your response will probably be useful to others looking for the same kind of thing. Tested it. Very cool. Dumping this into a template of another PW installation on the same server works: <?php $mainsite = new ProcessWire('/home/serverpath/public_html/mainsite/site/', 'https://mainsite.com/'); if($input->post->createuser) { $item = $mainsite->users->add('fred'); echo 'hello ' . $item->name; } $skyscrapers = $mainsite->pages->find('parent=skyscrapers, limit=3'); foreach($skyscrapers as $skyscraper) { echo '<h4>' . $skyscraper->title . '</h4>'; } ?> <form method=post> <input type=submit name=createuser value='add Fred to the main site'> </form> Fred gets added as a user to the main site. Pulling in content from the main site is straightforward. Is there a way to check if a user is loggedin on the main site?
  4. Thanks horst, I vaguely remembered hearing something about this, but couldn't find it. This looks perfect for my use case. I'll try this and will report back...
  5. I have one central website, with membership registration and content etc., and then several related websites with their own URL/domains, each on Processwire, all on the same server. I would like to access the database of the central website from the sister websites. How would I do that? You can't bootstrap one PW installation into another. You can include template parts from one in the other by just using the server path, but whatever you try to get/post just comes/goes to the database of the site you are on. Could you switch databases by including the config.php from another PW installation somewhere? What is the correct, secure way to do this?
  6. It would be great if 'choose file' in the image field would be able to handle other input sources than only the client's OS file manager; Amazon S3/cloud storage, Dropbox, an image folder on an intranet, another folder on the same server where PW is installed, whatever. It would be super convenient if you could just upload images to a folder/directory in the templates folder or root, without any processing, and be able to access that as a source option in the image field. Any way to make that happen? I had started a thread about this here. BitPoet posted a very helpful partial solution specifically for Zenphoto, but it would be great if there was a more source agnostic solution built into Processwire. Letting Processwire download images from any external media gallery/repository would be a good alternative to having a full centralized Media Manager. Or am I missing something that would make this impossible/a bad idea? Edit: Robin S has a module that adds one alternative input option.
  7. Thank you BitPoet, that looks like a great starting point. I'll try this and report back... This recent experimental module by Robin S - add imgs via urls - could also be part of a solution.
  8. Thanks dragan, but those threads really focus on uploading to AWS. I am looking for a way to download from an external library, instead of the client machine. I don't mind if the images are then stored/uploaded in the regular PW way. How can I modify 'choose file' in the image field to open a file manager on a URL, instead of a client machine OS file manager?
  9. OLSA, thanks for your feedback. I personally like how Processwire handles images, but I have a client who wants a central media library. That is why I want to create an external media library - Zenphoto in my case - and have Processwire "upload" the images from there instead of from a client OS file manager. How can I modify 'choose file' in the image field to use other source options? Is it possible to have that open a web-based file manager of another script on the server or on a cloud service, AWS, whatever?
  10. Is there a way to change the input options for the images field? I am trying to figure out if it would make sense to use an external script like Zenphoto as a central media library/manager. How could I connect that with Processwire? 'Choose File' in the images field would have to be able to open that 3rd party media library or a directory on the server or some cloud service instead of (only) the client file manager. Could justb3a's field type module Image Extra be part of the solution? I will try that and report back. Other field types/modules? I know there is a pro module Media Manager that does look very slick, but would prefer to make this work with a mature, tested 3rd party script if a central media gallery is never going to be a core Processwire feature.
  11. Either or both! A JSON field would probably be most useful. I am watching some of those other threads. Simplepie takes input as a list of comma-separated links, not key => value - does that type of array have a name? I managed to make it work with a repeater field.
  12. Another dumb question: Is there a field type for a text-based array? In my case I need to store an array of RSS feeds for SimplePie. Storing that list of links in a textarea - text formatted to look like an array - doesn't work with the script. It works with one link. The images field is an array. I assumed there would be an equivalent for URLs or text in general. Or is there another approach for these cases? Edit: I guess using the optional (module) Repeater field type is the best solution in this case? I have now a working solution based on that. Still curious about other ideas.
  13. Seriously, you don't want to know. Awful mess. I disagree with my client, but have to try to meet him halfway. See edit in my comment above for more details. Again, I am not asking for a solution for my particular issue. This discussion is probably closer to what I am looking for.
  14. Is this all still valid? Setting permission in the ProcessModule for the custom admin seems to be the cleanest way to make that admin available to a specific role. But yes, how do you then hide the main page tree for that role? My custom admin will be an alternative to the main page tree edit interface. Is AdminRestrictPageTree still the (only) way to achieve that? That module is still alpha, getting kinda old, not explicitly compatible with 3.0 Here is another thread about the same issue; how to hide the tree when there is a custom admin for a specific role. That thread fizzled out in 2015. If you want to create an admin that looks completely different from the standard admin, is it a better approach to use a custom myadmin template?
  15. Yes, of course it is. Unfortunately I actually have a client who thinks Processwire's admin area is confusing and wants an admin area that looks exactly like the horrible system he is trying to replace. I have to restructure/reorder all the standard admin functionality/edit screens into something he recognizes to gradually lure him over to the PW dark side. But apart from that, I am looking for the most basic proof of concept. Basic stuff that the default admin already does, stuff that everybody understands; how would you replicate that in a custom admin area? I am looking for a guide for the basic principles. Most modules seem to come in a folder/dir with other file types like js and css, not a single text file. How that works is basic module writing of course, but I was hoping to see some pointers in your tutorial how to structure that for a custom admin area. Your hello-page2 example still goes in the same single text file? Edit: Let's say you want to create a wizard style interface for adding/editing content, that starts with a title + body + images form, followed by steps or dropdowns to put the content in the right page. Instead of the page tree. More content-centric instead of structure-centric. I prefer the Processwire approach, but my client is used to that content-centric approach. But it doesn't matter what exactly I am trying to achieve in this case. I am looking for a general basic recipe how to create an alternative custom admin area or how to completely restructure the admin. Bernhard's tutorial is more about adding advanced features to the existing admin.