Jump to content

Help needed to improve a website's functionalities/features


Christophe
 Share

Recommended Posts

Hello,

I hope you are all doing (as) well (as possible)!

There is a website (currently powered by ProcessWire 2.8.35, but I'm going to try to update it to ProcessWire 2.8.62).

The client's project is not really "live" for the moment, even though it has been online for a few years.
From time to time, he contacts me and asks me to add functionalities (at least once a year). He travels a lot and has (too) many projects.

On this website there is a conditional form made with Form Builder (topic(s) in the module's Forum).
With the first field (radio button), you can choose Model (default) or Other artist. 
Depending on the choice, some fields are added and some removed. Some other fields are the same.

The form being a conditional one, every form sent is (also) being converted automatically to a(n) (unpublished) page, but under a temporary (directory) parent page.
It is added at the top in the list of children in the admin.
Using a template that has all the fields corresponding/equivalent to the Form Builder conditional/double form fields.
In a page under this temporary parent, the first field (Model or Other artist) is still editable. (1)a)) I guess I have to (find a way to) show it without it being editable by the client's user account (only the superuser should be able to edit it, but normally he wouldn't need to edit it also, just to see it - with or without seeing the other option). [DONE. Field -> "Field" tab -> "Visibility" -> "Presentation" -> Options]

He can review and validate it, and then publish it. Or he could do it after moving the page from the temporary parent.

Then the client moves the page under the Model or the Other artist parent. Their children have the temporary template available, and also their respective template.
So only 2 choices, and after having moved the page he switches to the adequate template, which removes the first (radio button) field and the fields that are not needed/used for the child under the chosen parent.

1)b) I am wondering if there is a way to automate the change of parent and template depending on the first field (radio button) once the page is created under the temporary parent, and/or if there can be a button added somewhere that the client can press/a way so that it is done automatically. And/or perhaps to do it for one, or several pages at once, with an "action' or automatically once a page (under the temporary parent) is validated/set to "published" by the client (perhaps this would be the best in this case).

2) In fact, I now have to think about all this because the client would like the model or other artist to be able to edit it's page later.
Starting from what exists (I'm not going to change all the "processes"/steps' order now), once the page is published and under the right parent, an account with an email (existing field) as the username (or the part before the "@"), for example, or another solution ("pseudo"/"alias" field value, etc.), and a default password (always the same, an automatically generated one...) would be automatically created (and sent manually or automatically to the person (?)).

3) The person shouldn't be able to see/edit the  "Parameter" tab (template, publish...).
I guess it would be better that he/she edits from the front-end, and sees only what he/she could need to edit.

So a "lot of things". Starting from 1) normally.

Thank you in advance for helping me find solutions and know what's possible and not.

I can add screenshots if needed.

NB:  please moderators, feel free to move this topic to a more adequate sub-forum. I was not sure where to put it.
Not sure how to name this topic.... Feel free to modify the name.

PS: this message has taken me so long to write, check and publish... like often.

Link to comment
Share on other sites

If these models/artists need to be able to edit their information then they must be created as PW users so they can log in. You can use an "Approved" checkbox field in the user template, or alternatively create an "Approved" role that may be added to the user, to determine which users are approved.

The Login Register module could help with this project. See the blog post that introduced it.

You'll probably want to customise Login Register (with hooks or whatever) for things like:

1. Show different fields in the register form depending on if Model or Artist is selected.

2. Maybe apply different role to new user depending on if Model or Artist is selected.

3. Show different fields in profile edit form depending on if Model or Artist is selected.

If you get stuck on any of these things I'm sure you'll find help here in the forums. I haven't used Login Register myself.

If information from the user profile is shown publicly on the front-end you could explore the possibility of using a different parent for users. Or you could use a single page for all profiles, pulling in the data for the relevant user via a Url Segment. I'd probably go for the latter myself. 

If all the users are stored under the Admin > Access > Users (as they are by default) then your client will be approving/activating Models and Artists via the Users lister. You can add a filter to the lister to make it easy to find unapproved users. Or maybe use Lister Pro to create a custom users lister showing unapproved users.

  • Like 3
Link to comment
Share on other sites

Hello,

And thanks for your message.
[ Edit: I'll look at this "Login Register" module. But, the website uses ProcessWire 2.8.62 (I've updated it). I'm "afraid" of upgrading it to version 3. I have to check again what to change for the update. But I just have the following modules installed: Form Builder 0.3.0, Social Share Buttons, Database Backups, and Upgrades (the "Upgrades" module not working like before since the last ProcessWire update). ]

First, when the data entered in the inscription form [ https://goo.gl/LF57a3 ] is sent via Form Builder, apart from currently sending an email with the information, a processwire page is also created under a (common) temporary parent/"directory" (with its own template), whatever the choice is (Model or Other artist) for the radio button field.

I've made the change to the (radio button) field so that it cannot be edited.

What I would first need now, before anything else, is, for example, an automated way, as soon as the client validates the page by publishing it, to move it under its non-temporary/real parent page (depending on if the page is set to Model or Other artist) and after to change its template (depending also on the same).

There is "Annuaire des books", the real "directory" (the "Grandparent"), and under it, the "Mannequins/Modèles" parent and the "Autres Artistes" parent (each one having its own template available. So, as I said earlier, currently, the parent change then the template change have to be done manually, and changing the template from the temporary one to the new adequate one removes the unnecessary fields after confirmation. And, of course, their children have their own unique template.).

So, there are 6 templates:

  • directory_listing_autres_artistes
  • directory_listing_mm
  • directory_listing_temporary
  • directory_page_autre_artiste
  • directory_page_mm
  • directory_page_temporary

(By the way, URL Segments are used for the Models or Others artists on the front-end.)

I don't know what would be the best option in order to automate these two things and how to do it.

With a hook(s) in ready.php or elsewhere, and which one(s)/how?
Or with the "Admin Actions" module, and how?

I'm going to keep in mind (at least) the following modules, for when I have the first automation solution already working and I can continue:

Some of these modules seem to solve part of the automation processes.

I'll have to see/know what is(/are) the best and most secure way(s) to create users, how they can be created automatically, from the existing email (complete or the part before "@") or "pseudo"/"alias" field (without duplicates possible), for example.
Or perhaps it would be better to "generate" a(n) (manual or automatic) "action" from time to time (with the "Admin Actions" module or another one/way) in order to create the users when new pages are created and the users for these pages haven't been created yet. 

Also, I'll have to find how to use the front-end editing for these users.

So many (new) things/steps.

Capture du 2018-02-21 21-17-17.png

I guess Models and Other artists users could have the same role.

[ Post moved to https://processwire.com/talk/topic/18523-how-to-automatically-change-a-pages-parent-and-template-once-the-page-is-published/ ]

 

Edited by Christophe
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...