I need to limit the max number of relationships per user. Example: I have one to many relationship: grupo->obra. All user can create 1 group and I want restrict the number of obras each user can create. Thanks
Users "universidad" can submit the form to create a pending CPT "obra". Then the group to which the CPT Obra belongs can approve it (to publish the cpt) using another form. The form where I have to control the number of relations depending on the user who sends it is the following.
The option to display the form depending on whether the conditions are met or not is not useful for me, since in this way the user could open several browser tabs (the condition is met) and then send all of them. The check would have to be done after the form is submitted and before it is added to the database.
This is the form which is submitted by user "universidad" to request a cpt "obra" related to cpt "grupo" that belongs to a user with author role :
or even before displaying the form we can check how many connections available for current author and based on that we can show/hide the form.
If you can tell how how exactly you would like to go and share problem URL where you added the form as well as admin access details I'm happy to help.
Please share admin as well as author user account details for frontend user.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
When I try to login it says its incorrect login access details.
Can you please send me working admin access details as well as please share frontend user "author" role user access details.
In addition to that I noticed that you are using the legacy way to get the parent but you must use the latest post relationship method. I will check once I get the admin access details and frontend user access details.
I have set the next reply to private which means only you and I have access to it.
It must depend on the number of relationship of the user logged in (role universidad) and the numbers of the relationships of the user thats belong the cpt obra where the form is displayed (role author)
Can you please share example based on that I will be able to offer you the solution as without that information I will not be able to guide you in the right direction.
You can setup test example and tell me on what action you want to hide based on what role and how many posts.
I need to limit the number of cpt contrataciones depending on each user. The form ID where users universidad can create CPT contrataciones is 523. Before submit the form I need check the number of CPT contrataciones of the users related (user universidad who submits the form and user author who is related the CPT obra where the form is displayed).
I understand that you want to limit the number of posts but at what count and for what post type and for what user role.
How many posts you want to allow the author user to create?
Can you please share more details with both user role author and universidad and tell me the steps I will have to follow and at what point what user will do what action and what posts for what post type you want to restrict with what count.