April 24, 2013 at 2:56 pm #2837
Hi Tareq !
I've been thinking a lot about my project today. I need to do something very specific.
So people can register as “Worker”. No problem with that, I have created my custom “Worker” role, created the edit profile page etc…
Than, I have 5 custom post types :
What I need to do is that :
A worker can create 0 or n companies. For each company, he can create news, projects, events or jobs. These 3 custom post types have to the right company, as they will be displayed in relation with this company, not the author.
I also want that if we change the company's author in the backend, the new company's author can manage the news/projects/jobs/events related to that company. The old author can't more !
How would you do that if you were me ?
Here is a scheme of what I'm talking about : http://cl.ly/image/0Q3T1L171q1i
Thanks a lot for your time 🙂 !April 25, 2013 at 8:58 am #2856
I definitely need this 🙂 ! It's the best the user experience 😉 !
So maybe I have to add custom field ‘company_id' for jobs/news/projects/events' custom post type ? But then how do I attach it to the project (for example) when I hit the “create a project” link ?April 26, 2013 at 6:57 am #2892
Hi Tareq !
Could you help me achieving that ? I assume I have to create a field in my project form (for example) to handle the company's ID. But how could I pass the company's ID depending on which link I have clicked on ?April 26, 2013 at 7:59 am #2895
I don't want to be sound harsh, but I think it goes beyond the level of plugin support. May be you should figure out yourself about your project.April 26, 2013 at 8:05 am #2896
Ok. I understand.
So I just need to know if it's possible to pass argument (like post id) to the new form created with WPUF ? So by this way, a field in the form is filled depending on that args.
ThanksApril 26, 2013 at 8:26 am #2897
there are some actions available in the top and bottom of the form. So you can insert hidden fields there based on form id and form settings and handle them with `wpuf_add_post_after_insert` action. Thats what you can do right now.April 26, 2013 at 8:39 am #2898
I mean that I have for example a link to “create a project” form, but in 3 different places. In that form, I need to have an hidden field which handle the id (for example) of the link I clicked on, so I know where do the user come from. So I have to pass some args when the link is clicked… But how ?April 26, 2013 at 9:34 am #2902
As I see your schema, you can append a parameter on URL, may be the company ID. Then based on that parameter and with the help of the action hook, you can put a hidden field on the form. Then based on the form type (news/project/event), you can set the post parent as the company post type.April 26, 2013 at 9:52 am #2903
Ok I think I got it, thanks 🙂
But when you say that
you can set the post parent as the company post type
What do you mean ?April 26, 2013 at 9:57 am #2904
If I would do it, I would set the event/news/project ‘s `post_parent` to the related company ID, instead of saving the company ID in a custom field. But doesn't matter, you can solve a problem in many ways.April 26, 2013 at 10:01 am #2905
Nice, you'r right 🙂 !
With the dashboard page, is it possible to display posts that are child of the company, instead of all the post by the user ?April 26, 2013 at 10:05 am #2906
If your version has `wpuf_dashboard_query` filter in dashboard, you could filter the query. If the filter isn't there, then dashboard query filter needs to be added/adjusted.
[php]$dashboard_query = new WP_Query( apply_filters( ‘wpuf_dashboard_query', $args ) );[/php]May 28, 2013 at 7:11 am #4265
Hi Tarek !
I've worked a lot here in our project and we face a little problem.
Like you said, we set the event/news/project ‘s
post_parentto the related company ID. But now if we want to change this related company ID in the wp-admin, we can't ! How could we change the post_parent ID in the wp-admin ?
ThanksMay 28, 2013 at 8:20 am #4267
Maybe it's easier to have the field in the admin if it's a custom field. So I have tried to store the company ID in a custom field with the help of an action hook. The field is displayed only in front-end, not in the admin side because the custom field is generated by the action hook… Could you help ?May 28, 2013 at 12:30 pm #4274
There is no way you can change the post_parent in the admin area unless you build your custom solution. May be add a new meta box and handle it?
The topic ‘Users can post in the name of a company’ is closed to new replies.