Jump to content

KarlvonKarton

Members
  • Posts

    118
  • Joined

  • Last visited

Everything posted by KarlvonKarton

  1. Well, at least I made a nifty (but not really useful) module @adrian About the screenshot: I did not know that I had to click on "add new" before I could see the "Install predefined system permissions" dropdown. (or should I say 'hidden panel')
  2. So it all comes down to knowing what predefined perms exist... really.
  3. @adrian Where can I find these 'extra' permissions to install? Or better: how can I install these extra perms?
  4. I thought it might be interesting to share this progress of mine... The following module redirects users that want to edit pages that are not theirs (but only for the role 'clients'). <?php class RedirectClient extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Redirect Client To Admin Home', 'summary' => 'Ensure that client role only edits own pages', 'author' => 'Karton', 'version' => 001, 'singular' => true, 'autoload' => true, ); } public function init(){ if ($this->user->hasRole('clients')) { $this->addHookAfter('ProcessPageEdit::execute', $this, 'checkIfEditPageIsFromThisUser'); } } public function checkIfEditPageIsFromThisUser($event) { $p = $this->modules->ProcessPageEdit->getPage(); if ($p->created_users_id != $this->user->id) { $this->session->redirect($this->pages->get($this->config->urls->admin)->url); } } } Any suggestions/remarks of the experts here?
  5. I've tested this in the multi-language profile , but I got an error: "Warning: Illegal offset type" caused by $page->title. That is because 'title' is not a string, but an object in the multi-language profile. With following modification it works (if you want to see the default lang): $pg->title->getLanguageValue('default') => $this->config->urls->admin."page/edit/?id=".$pg->id,
  6. When I set the family of a template not to be used for a new page, then I can not add/create a new page with that template. All good. But when I edit the template of an existing page, then I can select and save that ('disabled') template... So I can still have more than one page with a ('disabled') template that only can have one or not at all ... How is that possible?
  7. OK OK, I have been a bit lazy... I found this one. (for the other lazy people)
  8. @mr-fan "no like in my example "Reply to Dashboard (Redux)" you could add "action" buttons to your table of estates like:" But for a "normal PW PageEdit Form" to be used, the user should have the permissions "page-edit"? What leads me to another question: how to hide the pagetree and pages tab?
  9. One question though: If I want a form in the custom Admin Pages (to store an estate), I will have to make it hard coded with the API?
  10. @mr-fan Very interesting links, indeed. Thank you for that. Sometimes someone showing the path is enough ;-) Remark about the $$: In my professional life I work a lot for that business, but up until now only frontend development. Things like synchronizing and replicating data from a database source (connecting with e.g. soap) and stroring it into a web database. But there is a little niche I know of where the software is provided by only one company (well, in my country) and most people that use it are complaining about... @Robin S Like Mr-Fan said: every client needs to have his own branch and the branch is only hidden on a role basis and not on a user basis. (if I'm correct).
  11. @mr-fan 1. yes, 2. no just an integer field, 3. I have installed an admin dashboard for the users with role 'clients'. (listerpro is not an option now) To be honest, I've been reading and reading, but only found people that were discouraged to alter the pagetree like this... So in the meanwhile I think I will have to stick with the idea of making my own admin pages, as you say too. Showing data on that custom user admin is one thing, but adding new estates or editing estates will be a bit harder, I guess? What route do you have to take to make a page for adding an estate (e.g.)? Do you have to make the form myself or is there a nifty way of using an existing add form/page (like the one I made in the superuser admin)? ps: I've read all the posts you referred to ;-) but I'm still trying to grasp the concepts of PW... (sorry for that)
  12. Hello (again), I was wondering if the following can be done (or has been done already): I have some pages (with a template 'estate') that have a field 'estate_user_id'. I also have a role 'clients' that only show the pages with template 'estate' in the user backend. What I would like to create, that is a module that only show the pages where the 'estate_user_id' is equal to the ID of the user viewing the pages in the backend. - Do I need a process module for that? Or - if not - what other kind of module? - What Hook do I need that only hooks when the page tree is viewed in the user backend? - How do I refine/filter on the field 'estate_user_id' ?
  13. @adrian I've tried this: $page = $event->arguments[0]->id But it gave an error on this: $page->get($field->name);
  14. Could you elaborate a little more if you want? (I don't understand how it relates...)
  15. @Pete In PW 3.0.33 the users with permission 'dashboard' are not redirected to the dashboard after log in. In my case I got stuck with a white screen (url /processwire/dashboard/ was working) EDIT: This code did the trick for me (for now): if ($this->page->id == 2) { // Before // $this->session->redirect($this->page->child->url); // NOW $this->session->redirect($this->pages->get(1028)->url); }
  16. I have now, but that was not a success. (my eyes are still hurting - very red screen )
  17. This is the code which gives the error: $page = $this->modules->ProcessPageEdit->getPage(); It gives an error because in my case the users in role 'clients' have only permission to 'profile-edit' and not to 'page-edit'. Superuser has all the permissions, so that's why the module works as admin, but not as user. So I tried with following code: $page = $this->modules->ProcessProfile->getPage(); With the latter the user can edit the email field, but then the superuser gave errors. (I don't understand why) So, for now I have this workaround (which I don't really like): if ($this->user->hasRole('clients')) { $page = $this->modules->ProcessProfile->getPage(); }else{ $page = $this->modules->ProcessPageEdit->getPage(); } Feel free to comment. I'm sure there must be a better way.
  18. A question: When I'm admin my modified module works great, but when a user tries to edit his/her email address, then I get: You do not have permission to execute this module - ProcessPageEdit Any ideas? ps: the user is in a role that allows profile-edit.
  19. @kongondo or anybody else: If I want to check only the email address of users on duplicates, would it then be safe to say that the template must be "user" Thus not: $existEmail = $this->wire('pages')->get("id!=$page->id, template=basic-page, mail=$newEmail, mail!=''"); But: $existEmail = $this->wire('pages')->get("id!=$page->id, template=user, mail=$newEmail, mail!=''"); NEVER MIND, I found it myself. EDIT: but with one more issue (see below) <?php namespace ProcessWire; class ValidateEmail extends WireData implements Module { /** * Return information about this module (required). * * @access public * @return array module info * */ public static function getModuleInfo() { return array( 'title' => 'Validate Email module', 'summary' => 'Ensure Uniqueness of Emails across site', 'author' => 'Kongondo, Soma', 'version' => 001, 'singular' => true, 'autoload' => true, ); } public function init(){ $this->addHookAfter("InputfieldEmail::processInput", $this, "validEmail"); } public function validEmail($event){ $field = $event->object; if($field->name == 'email'){ // edited to my field $page = $this->modules->ProcessPageEdit->getPage(); $oldEmail = $page->get($field->name); $newEmail = $field->value; #$this->message("old value: $oldEmail"); #$this->message("new value: $newEmail"); $existEmail = $this->wire('pages')->get("id!=$page->id, template=user, email=$newEmail, email!=''"); // edited to my field if($existEmail && $existEmail->id > 0) { $field->value = $oldEmail; $field->error($this->_("That email $newEmail is already taken mate; go fishing! :-)")); } } } }
  20. @mr-fan 1. Yes, I want to use PW Admin for the users as administration of their portfolio. 2. I know about the Page Field Type (I already used it for tags and categories in another project), but I'm still a little bit in the dark here ;-) Do you mean that when a user adds a new estate that the pagefield would store the user itself?
  21. @mr-fan: I see that Vladar had a (almost) similar question: "restricted access to some sensitive informations (like landlords contact details, clients info and so on)". What I want to accomplish is that users log in to the application and only see their portfolio of estates. The users are concurrence of each other and not agents that work on the same portfolio.
  22. Hello everyone, I want to make an application for storing Real Estate data. Since I am fairly new (translate: Noob) to PW, I get stuck a lot of times just trying to understand what’s the best way to find a “solution” for a certain “problem”. So, if you people don’t mind, I will use this topic for asking questions occasionally / regularly. I will start now with my first set of questions: In the application there would be one superadmin (me) and a unknown amount of users (clients). The users should be able to use the same template for adding estates (make sense to me, but maybe I’m wrong), but the users may not see the data (estates) of the other users. 1. Is there a built-in system in PW to do that? 2. Should I work with e.g. a branch per user? (user1 -> estatesTemplate, user2 -> estatesTemplate)
  23. Good point, Can. Everything in immo.php would be communicating with the db, more specifically with the real estate tables.
×
×
  • Create New...