Altus Campus – Petrone Front‑End User Import Tool
Petrone Front-End User Import
Bulk create or match users, enroll them into a course, notify users & admins, and download a post-run report — all from a WordPress page.
Overview
This tool provides an authenticated, front-end interface to import users for Petrone organizations. It reads a CSV, applies shared metadata (Facility, Role, Specialization, Address), creates new contacts or detects existing ones, enrolls them into a selected course, sends confirmation emails, and generates a downloadable CSV summary.
Shortcode:
Form Inputs
- Specialization — from
acc_categories.category_title - Professional Role — from
ae_course_options.meta_valuewhereLOWER(meta_key) LIKE '%role%' - Facility — from
ae_organizations.display_name - Address, City, State, Zip/Postal, Country, Phone — text inputs applied to all imported users
- Course — from
ae_course.course_titlesite-scoped - CSV File — the user list to import
The Course dropdown is automatically limited to courses available to the current site via ae_package_sites (mapping site master_key to allowed course IDs).
CSV Format
Provide a header row and the following columns (Employee ID and Department are optional):
First Name,Last Name,Email,Employee ID,Department
Example rows:
Jane,Doe,jane.doe@example.com,EMP1001,Radiology
John,Smith,john.smith@example.com,EMP1002,Cardiology
Emily,Johnson,emily.johnson@example.com,,Nursing
How It Works
- Choose Specialization, Professional Role, Facility, Course, and enter shared contact details.
- Upload your CSV and submit.
- For each row:
- Validate email, build a safe username (unique if needed).
- Existing user? Enroll in the selected course (no duplicate account).
- New user? Create the contact, enroll, and notify.
- On completion, download the enrollment results CSV.
Outputs & Notifications
- User Email: Account + “Enrollment Confirmation” with the course title.
- Admin Email: Summary including the enrolled course.
- Results CSV: Saved to
/wp-content/uploads/and linked on-screen.
Headers:First Name, Last Name, Email, Status, Course Title
Data Sources
| Specialization | acc_categories.category_title |
| Professional Role | ae_course_options.meta_value where LOWER(meta_key) LIKE '%role%' |
| Facility | ae_organizations.display_name |
| Course | ae_course.course_title (limited via ae_package_sites) |
Security & Compatibility
- Nonce-protected form submission.
- Server-side validation & sanitization.
- PDO with exceptions enabled for database operations.
- Works with PHP 7.4+ and WordPress multisite.
Troubleshooting
- Course list is empty: Ensure the site’s master_key maps to allowed packages in
ae_package_sites. - CSV rejected: Confirm the file has a header row and valid emails; use a plain CSV (UTF-8).
- No emails sent: Check
wp_mailconfiguration or SMTP plugin settings. - “Existing user” not created: That’s expected — existing users are only enrolled, not recreated.
Notes for Developers
- Shortcode: Legacy Petrone import is disabled. Use an AltusPlatform API import flow instead.
- Existing user detection via internal helper
ac_get_contact_id(). - Enrollment via
ae_enroll_user(); course titles loaded fromae_course. - Course scoping:
acc_keys.wp_blog_id→acc_keys.master_key→ae_package_sites.site_id→ allowedae_course.id.
