Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

81 Excellent

About webhoes

  • Rank
    Sr. Member

Profile Information

  • Gender
  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. @MarkE, Thanks! This is a total different I was looking at and mine doesn't work. I will play with this and see if I can get it to work in my setup.
  2. Interesting. Are you willing to share you module? I have not been able to get a secure setup myself. The pageload in my case is my security setup. I check for referenced users from a parent page or parent parent page. This is really time consuming.
  3. I made a similar something, but it increased the pageload by 3 seconds. This is too much. Do you give the user temporarily page-edits upon granted request of that page?
  4. @MarkE, did you get this working without giving user page-edit rights?
  5. Hello, I am working on a site where multiple users have one ore more pages (studbook). These pages can contain children (animal) and animal can have a child (transfer). I created an admin before the PW admin. Here users can see their the pages the have their users_created_id. I use the feel module for editing. But if someone right clicks the edit button, they end up in the PW admin and can see everything (not allowed). So I created a module to redirect everybody but superuser from the admin templates (except if page id == 10, the edit template). This sort of makes is secure, but if a user knows the id of the page they can still type /processwire/page/edit/?id=xxxx and see that page. I have been working some days around this, but no solid solution came up. I do have the formbuilder module available if this can help. I also thought of making a role for every studbook. That would mean 35 roles and 35 studbook templates. Also animal and transfer templates need to be duplicated per studbook otherwise a user will still be able to see others. What other options are there to make it so people can only see their studbook and their child pages? Nice to have would be that to or more selected users can see and or edit that studbook. Preferbly all without page-edit rights so I can block everyone from the PW admin.
  6. @renobird, have you re-considered releasing the code for your ticket system or partly. Basicly the part that creates new tickets from emails and sends updates is the most important and difficult.
  7. Thanks @jmartsch and @bernhard I have updated the module with your improvements. Works very smooth...
  8. Damnnn... Or you name your module properly instead of having .php as extension. I could not find it among the modules, but I was confused with some other hooks that are not modules (like in ready.php) that just do their thing. Luckily, it works now.
  9. Could not get something working with those changes. After some more searches I came up with this, close to the examples but also still not working. public function init() { // add a hook after the $pages->save, to issue a notice every time a page is saved $this->pages->addHookBefore('save', $this, 'updateProduct'); } /** * Example1 hooks into the pages->save method and displays a notice every time a page is saved * * @param HookEvent $event * */ public function updateProduct($event) { /** @var Page $page */ $page = $event->object; //$page = $event->arguments('page'); if($page->template != 'product') return; $fields = $page->fields; $price = $fields->get('pad_price'); $rrp = $fields->get('pad_rrp'); $discount = $rrp - $price; $percentage = $discount/$rrp * 100; $page->of(false); $page->set('pad_discount', $percentage); $this->message('test'); }
  10. Hello, I have made a module, but I can't get it to work. I have 2 fields with price (price and rrp). On save I want to calculate the difference in percentage and save it to the discount field. It does not update the field. What am I doing wrong? class UpdateDiscount extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Custom discount updater', 'version' => 1, 'summary' => 'Auto update percentage based on prices.', 'singular' => true, 'autoload' => true, 'icon' => 'money', ); } public function init() { // add a hook after the $pages->save, to issue a notice every time a page is saved $this->pages->addHookAfter('save', $this, 'updateProduct'); } /** * Example1 hooks into the pages->save method and displays a notice every time a page is saved * * @param HookEvent $event * */ public function updateProduct($event) { /** @var Page $page*/ $page = $event->arguments[0]; if($page->template != 'product') return; $price = $page->pad_price; $rrp = $page->pad_rrp; $discount = $rrp - $price; $percentage = $discount/$rrp * 100; $page->setAndSave('pad_discount', $percentage); } }
  11. I tried this for a site, but the new button is still visible. The template studbook can have a child with template animal. I have resticted a per page right edit rights for the studbook. On that page you can use the tab to add a new animal. But all people can see the tree and now with every studbook there is a option for new. If this is not visible, only people with the right page rights you can add a child from the page... I am using the current dev version of pw. $this->addHookAfter('ProcessPageListActions::getActions', null, function(HookEvent $event) { $p = $event->arguments[0]; $actions = $event->return; if($p->template->name == 'studbook') { unset($actions['new']); } $event->return = $actions; });
  12. I did test this some time ago. To make this work I would have to make a user specific branch upon registering and dynamicaly give that user rights to that particular branch. that branch would contain all data for that user different child pages. I think that would be difficult to achieve and maintain.
  13. Interesting stuff... But what is defined as one branch? Is that one of the first childs of Home? If so, how would you deal with multiple branches that should all be treated equally? User may only see and edit childs of those branches he created himself? And to make it a little more complicated, some of those pages also contain child pages to which only the creating user should have access.
  14. For this site seeing pages of others in the tree is not an option. Specially with the new GPDR law.
  15. @bernhard if there is another safe way to give user edit rights and still make sure they can't see or edite pages of others I don't mind changing letting them in the backend and create processmodule pages. Current pseudo backend looks like this. Everything a user adds is private and may not be seen by another or changed by another. The only exception is the classifieds section which is to be seen in the frontend (but also in the backend only for the user who made it). I see in your article that you also use forms. But then I would need to apply the same logic as I do now (or lacking to have done now). What would I need to do If don't want anyone to see the standard pw backend (including the tree). And only have them see somthing like image above, but if they click on 'edit' they can use the pw backend for adding/changing text and images (with use of all the backend security present) of that particular page. Or use the page tree and make sure everything they did not make is hidden (except for the parent templates). Turtles is parent for turtle. They did not create the Turtles page but it groups all turtles from all users. That would be something like this Turtles turtle 2 Grourps group 1 Classifieds classified 4 classified 7 Another user would see different pages. I did tried something like this before, but could not get this running correctly. ohjah, the site is multilangual and with the api the title and name are synchronized on save. Also the name is based on userid and a timestamp so no user can have the same name. Title can be the same as this does not creates issues. I know a lot of questions, but I am quite proud of how far I cam so far, but are still far from being a programmer and understanding how it all works.
  • Create New...