Users can post in the name of a company

This topic contains 22 reply and 2 voices, and was last updated by noomia 11 years, 5 months ago
Viewing 15 Posts - 1 through 15 (of 22 total)
Author Posts
April 24, 2013 at 2:56 pm 2837
noomia 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 :
  1. Companies
  2. News
  3. Projects
  4. Events
  5. Jobs
  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
noomia noomia

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
noomia noomia

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
Tareq Hasan Tareq Hasan

Hi Noomia,

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
noomia noomia

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.

Thanks

April 26, 2013 at 8:26 am 2897
Tareq Hasan Tareq Hasan

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
noomia noomia

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
Tareq Hasan Tareq Hasan

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
noomia noomia

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
Tareq Hasan Tareq Hasan

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
noomia noomia

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
Tareq Hasan Tareq Hasan

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
noomia noomia

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_parent to 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 ?

Thanks

May 28, 2013 at 8:20 am 4267
noomia noomia

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
Tareq Hasan Tareq Hasan

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?

May 28, 2013 at 12:34 pm 4275
noomia noomia

Hi Tarek !

I choose to do it with custom field. It’s a hidden one so I create it with action hook in WPUF.

So in Front-end, I have my hidden field in the source page. But I don’t have it in the wp-admin in the WPUF form meta box. How can I have it there ?

Viewing 15 Posts - 1 through 15 (of 22 total)