• Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
  • Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
home/Knowledge Base/Code snippets/Automatically assign author as manager of a project

Automatically assign author as manager of a project

62 views 0 April 13, 2021 vprat

In some cases, it can be useful that an author of a project automatically becomes its manager. Here is an example of how you could achieve that.

/**
 * Automatically assign author as manager of a project
 * @param $project_id
 * @param $project
 */
function custom_cuar_assign_author_to_project($project_id, $project) {
    $current_user = wp_get_current_user();
    $project->add_actor_to_project($current_user->ID, 'manager');
}
add_action('cuar/private-content/projects/on-project-created', 'custom_cuar_assign_author_to_project', 10, 2);

Was this helpful?

Yes  No
Related Articles
  • Custom admin notification’s recipients
  • Disable CSS resets and allow integration of third party plugins
  • Automatically add a user to a group
  • Changing the default page shown by the Customer Area
  • Changing the page shown after logout
  • Sidebars: how to disable them
Knowledge base
  • Code snippets
  • Use cases
  • Community links
Documentations
  • Getting started
  • Using code snippets
  • The template system
  • Full documentation
FAQ
  • About licences
  • Pre-sales questions
  • After-sales questions
  • Plugin usage
  • Technical questions
  • Payments
Support
  • Pre-sales Enquiries
  • Main plugin support
  • Premium add-ons support
  • Feature Requests
  • Terms and conditions for sales
  • Refund policy
  • Privacy Policy
  • Legal notices
  • Copyright 2021 wp-customerarea.com. All Rights Reserved.