Interating the template loader into a user manager
In Chapter 2, Implementing Membership Roles, Permissions, and Features, we used direct file inclusions to load the necessary templates. A few chapters later, we improved the loading of templates by introducing a common template loader. Now, we can integrate the template loader into the user management functionality to keep the code consistent. Also, we need to move the user-related functionality into its own class instead of keeping it inside the main plugin file. First, we'll move the user-related functionality to its own class.
Create a new model called WPWA_Model_User
inside the models
folder of our main plugin. Then, we can move all the user-related functions from the WPWA_Portfolio_Manager
class to the WPWA_Model_User
class. The following code shows the structure and function definitions of the WPWA_Model_User
class after the changes. The implementation of the functions will be the same and hence avoided in the code here in the WPWA_Model_User...