Workstation Ordering Application for WordPress
A GPL-2.0+ WordPress Plugin that provides a user-accessible interface for ordering workstations and accessories and a robust multi-role return / approve workflows and team-based settings. This application is developed, maintained, and operated by the Information Technology unit within the Dean's Office at the Texas A&M University College of Liberal Arts.
Features
- AJAX form submission using nonces which WordPress uses to authenticate the call, for security
- AJAX file uploads to the WordPress media library converted to attachment post types
- PDF rendering using the FPDF library
- A gated approval flow that renders an order’s “approval” template if the user viewing the order needs to perform an action at that point in time, and renders its “view” template if not
- Only allows users who submitted an order or who must approve an order to see it
- Has custom Dashboard widgets, which are nice to use sometimes to give users information
- Custom user roles and permissions
- Custom post types
- Uses Advanced Custom Fields for order fields and the Settings page
- Affiliated business staff can view orders, will be CC'd on emails sent to the business staff responsible for approving an order.
WordPress Requirements
- Single site install support only at this time.
- WordPress Genesis Framework
- WSOrder Genesis Child Theme
- Advanced Custom Fields Pro Plugin
WordPress Recommendations
- TAMU NetID Authentication Plugin of some kind
- Post SMTP Plugin - Send emails by SMTP with a logger and one-click resend button in case of failed delivery
- User Switching Plugin - For imitating user accounts in case that is desired functionality. The github.com repository is updated more frequently than the WordPress repository.
- Yoast Duplicate Post Plugin - Copy custom post types.
- Simple History Plugin - For debugging and user support.
To Do
- Implement Active Directory user authentication, onboarding, and offboarding using either the WordPress SAML SSO plugin from OneLogin, the TAMU directory REST API https://mqs.tamu.edu/rest/, or both and one or more WordPress Cron tasks or manual functions.
- Remove the following form fields from the
edit-user.php
administrative UI since they are not used: Visual Editor, Keyboard Shortcuts, Website, Biographical Info, Profile Picture, New Password, Password Reset.
Developer Notes
Features
This repository uses PHP CodeSniffer with WordPress Coding Standards checks, but is NOT fully compliant with that tool yet. A pre-commit hook file is included in this repository to enforce code commits to meet this standard. I have also configured Git and Visual Studio Code files in this repository to help improve compatibility between Mac (terminal) and Windows (powershell) environments.
It also uses the FPDF library https://packagist.org/packages/setasign/fpdf to provide secure and data-driven PDF documents on demand without storing them on the server.
It relies on Advanced Custom Fields Pro for ease of implementation, modification, and hooks for custom fields in custom post types.
It uses SASS for CSS preprocessing and Zurb Foundation 6 as a CSS framework.
Code Conventions
This repository applies code checks using the WordPress Coding Standards. Please refer to their documentation when you have questions about how to format your code to meet their guidelines.
Line endings are enforced as Linux-style LF "\n". This is what WordPress requires for its Subversion version control system, and Subversion is how developers submit WordPress plugins and themes to the official WordPress.org library.
Custom User Capability Slugs
- manage_acf_options: Determines who can see the Advanced Custom Fields options page.
- manage_wso_options: Determines who can see the Workstation Ordering App options page.
- All custom post types have each of their capabilities namespaced using their post type slug. Example:
create_wsorders
Command Line Tasks
$ npm start
- Used to initialize the repository; should only be run after downloading the repository for the first time.$ npm run configphpcs
- Configure the PHP Code Sniffer module to use WordPress Coding Standards.$ npm run checkwp
- Checks the repository's WordPress files against the WordPress Coding Standards and outputs a report into your terminal.$ npm run fixwp
- Automatically fixes syntax and whitespace issues with the repository's files according to WordPress Coding Standards.$ npm run windows-configphpcs
- The same as$ npm run configphpcs
but with Powershell-friendly syntax.$ npm run windows-start
- The same as$ npm start
but with Powershell-friendly syntax.$ npm run windows-checkwp
- The same as$ npm run checkwp
but with Powershell-friendly syntax.$ npm run windows-fixwp
- The same as$ npm run fixwp
but with Powershell-friendly syntax.$ grunt
- Compile SASS files into compressed, production-ready CSS files.$ grunt develop
- Compile SASS files into expanded, sourcemapped CSS files.$ grunt watch
- Continuously watch SASS files for changes and compile them into expanded, sourcemapped CSS files every time they are saved.
Git Tips
To add an executable file to git version control, do this: git add --chmod=+x hooks/pre-commit && git commit -m "Add pre-commit executable hook"
Legacy Support
Legacy support is and will continue to be an ever-present responsibility of Information Technology professionals and this subject should be discussed with respect and understanding. One approach to legacy support which I have attempted here is to have a dedicated PHP file for targeting code that is any combination of temporary, scheduled for deprecation, or external. Currently it only targets WordPress plugins that may be replaced with other solutions eventually. Temporary code will be removed at some known or unknown point in the future. Deprecated code is scheduled for removal in a future version by the party who maintains the code. External code is provided from a source outside of one's own organization. Such code may be other WordPress plugins or third party APIs. The legacy support file is located at src/class-legacy-support.php
.
Potential Installation Issues
Windows 10 application issue: "Local" by Flywheel (local virtual server)
https://localwp.com/help-docs/advanced/router-mode/ On two different models of Dell Windows 10 machines (Inspiron and Latitude) a Windows service was occupying Port 80 on IP 0.0.0.0:80. This interferes with the "Local" application's router functionality which uses the same port and is not configurable. It is possible that this becomes an issue as a direct result of a change made by the NodeJS *.exe file's installation process since I did not have this issue with the application until after installing NodeJS this way. ON MY PERSONAL COMPUTER I installed NodeJS using Chocolatey CLI and did not experience these conflicts with Port 80 and "Local". NOTE: SEE YOUR SYSTEM ADMINISTRATOR FOR POLICY GUIDANCE REGARDING THE INSTALLATION OF SOFTWARE ON TAMU SYSTEM DEVICES.
Credits
- This WordPress plugin was programmed by Zachary Watkins [email protected].
- The business process workflow and a portion of the UI specifications were designed by Pamela Luckenbill [email protected].
- The original application used very different technology, was programmed by Joseph Rafferty [email protected], and was authored by Joseph Rafferty and Pamela Luckenbill: https://github.tamu.edu/liberalarts-web/workstation-order.
- The majority of the workflow requirements for this version were preserved from the original application. However, the product, bundle, program, and department data creation and management interface is superseded by this application as it is provided by WordPress Core.
- The visual design at the start of the project was copied from the original application, and then the icons were replaced.