Integrating a template loader into the user manager

In Chapter 2, Implementing Membership Roles, Permissions, and Features, we used direct file inclusions to load the necessary templates. In Chapter 4, The Building Blocks of Web Applications, we improved the loading of templates by introducing a common templates loader. Now we can integrate the template loader into the user manager component to keep the code consistent. First, we'll look at the template-loading code used in the class-wpwa-user-manager.php file:

include dirname(__FILE__) . '/templates/info.php';
include dirname(__FILE__) . '/templates/login.php';
include dirname(__FILE__) . '/templates/register.php';

Now let's look at the modified code for template loading in the user manager component: ...

Get WordPress Web Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.