Home Forums Plugin Support WP User Frontend Pro Users can post in the name of a company

This topic is: resolved

This topic contains 22 replies, has 2 voices, and was last updated by  noomia 6 years ago.

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #2837

    noomia
    Participant
    Post count: 115

    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 ๐Ÿ™‚ !

    #2856

    noomia
    Participant
    Post count: 115

    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 ?

    #2892

    noomia
    Participant
    Post count: 115

    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 ?

    #2895

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2896

    noomia
    Participant
    Post count: 115

    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

    #2897

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2898

    noomia
    Participant
    Post count: 115

    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 ?

    #2902

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2903

    noomia
    Participant
    Post count: 115

    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 ?

     

    #2904

    Tareq Hasan
    Keymaster
    Post count: 2831

    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.

    #2905

    noomia
    Participant
    Post count: 115

    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 ?

     

    #2906

    Tareq Hasan
    Keymaster
    Post count: 2831

    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]

    #4265

    noomia
    Participant
    Post count: 115

    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

    #4267

    noomia
    Participant
    Post count: 115

    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 ?

    #4274

    Tareq Hasan
    Keymaster
    Post count: 2831

    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?

Viewing 15 posts - 1 through 15 (of 23 total)

The topic ‘Users can post in the name of a company’ is closed to new replies.