Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Wordpress Web Application  Development
Wordpress Web Application  Development

Wordpress Web Application Development: Building robust web apps easily and efficiently , Third Edition

eBook
€8.99 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Wordpress Web Application Development

Implementing Membership Roles, Permissions, and Features

The success of any web application or website depends heavily on its user base. There are plenty of great web applications that go unnoticed by many people due to the lack of user interaction. As developers, it's our responsibility to build a simple and interactive user management process, as visitors decide whether to stay on or leave a website by looking at the complexity of initial tasks such as registration and login.

In this chapter, we will be mainly concentrating on adapting existing user management functionalities into typical web applications. In order to accomplish our goal, we will execute some tasks outside the box to bring user management features from the WordPress core to WordPress themes.

While striving to build a better user experience, we will also take a look at some advanced aspects of web application development, such as routing,...

Introduction to user management

Usually, popular PHP development frameworks such as Zend, CakePHP, CodeIgniter, and Laravel don't provide a built-in user module. Developers tend to build their own user management modules and use them across many projects of the same framework. WordPress offers a built-in user management system to cater to common user management tasks found in web applications. Such things include the following:

  • Managing user roles and capabilities
  • A built-in user registration functionality
  • A built-in user login functionality
  • A built-in forgot password functionality

Developers are likely to encounter these tasks in almost all web applications. In most cases, these features and functions can be effectively used without significant changes in the code. However, web applications are much more advanced and hence we might need various customizations on these existing features. It's important...

Getting started with user roles

In simple terms, user roles define the types of users in a system. WordPress offers built-in functions for working with every aspect of user roles. In this section, we will look at how we can manage these tasks by implementing the user roles for our application. We can create a new user role by calling the add_role function. The following code illustrates the basic form of user role creation:

    $result = add_role( 'role_name', 'Display Name', array( 
'read' => true,
'edit_posts' => true,
'delete_posts' => false
) );

The first parameter takes the role name, which is a unique key to identify the role. The second parameter will be the display name, which will be shown in the admin area. The final parameter will take the necessary capabilities of the user role. You can find out more about existing...

Understanding user capabilities

Capabilities can be considered as tasks which users are permitted to perform inside the application. A single user role can perform many capabilities, while a single capability can be performed by many user roles. Typically, we use the term "access control" for handling capabilities in web applications. Let's see how capabilities work inside WordPress.

Creating your first capability

Capabilities are always associated with user roles and hence we cannot create new capabilities without providing a user role. Let's look at the following code for associating custom capabilities with our member user roles created earlier in the Creating application user roles section:

    public function add_application_user_capabilities...

Registering application users

An administration panel is built into the WordPress framework, allowing us to log in through the admin screen. Therefore, we have a registration area which can be used to add new users by providing a username and e-mail. In web applications, registration can become complex, compared to the simple registration process in WordPress. Let's consider some typical requirements of the web application registration process in comparison with WordPress:

  • User-friendly interface: An application can have different types of user roles. Until registration is completed, everyone is treated as a normal application user with the ability to view public content. Typically, users are used to seeing fancy registration forms inside the main site rather than a completely different login area such as with WordPress. Therefore, we need to explore the possibilities of adding WordPress registration to the...

Implementing frontend registration

Fortunately, we can make use of the existing functionalities to implement registration from the frontend. We can use a regular HTTP request or AJAX-based technique to implement this feature. In this book, I will focus on using normal HTTP POST requests instead of using AJAX. Our first task is to create the registration form in the frontend.

There are various ways to implement such forms in the frontend. Let's look at some of the possibilities as described in the following section:

  • Shortcode implementation
  • Page template implementation
  • Custom template implementation

Now, let's look at the implementation of each of these techniques.

Shortcode implementation

Shortcodes are the quickest way to add dynamic content to your...

Creating a login form in the frontend

The frontend login can be found in many WordPress websites, including small blogs. Usually, we place the login form in the sidebar of the website. In web applications, user interfaces are more complex and different compared to normal websites. Hence, we will implement a full-page login screen as we did with registration. First, we need to update our controller with another case for login, as shown in the following code:

    switch ( $control_action ) { 
// Other cases
case 'login':
do_action( 'wpwaf_before_login_form' );
$wpwaf->login->display_login_form();
break;
}

We have used a new class called login to call this function. So we need to create a new class called WPWAF_Login inside the classes folder and do the object creation and file inclusion inside the WPWAF_Forum class as we did in previous...

Essential user management features for web applications

As discussed throughout this chapter, user management is one of the most important tasks in web application development. Only limited types of applications can be built without needing user management. So we discussed some of the core user management features available in WordPress and we will be exploring more built-in user features in upcoming chapters.

The built-in user management features of WordPress focus more on the administrative side. There are very limited user management features for the user in the frontend of the application. Therefore, often we need to develop additional user management features for the frontend or use custom plugins that provide such features. In this section, we will be discussing some of the most important and commonly used user management features, as follows:

  • Frontend login and registration
  • Custom profile fields
  • Private...

Implementing user management features with popular plugins

In the previous section, we discussed the need for custom user-related functionality in managing large web applications. We can use our own code to create all of the mentioned features to suit web applications. However, implementing these features from scratch is a highly time-consuming task requiring perfect planning. So we need to consider the type of application and the requirements before deciding to implement these features from scratch.

Usually, it's a wise decision to use an existing plugin-based solution in such scenarios, unless user management is the core feature of your application and existing solutions are not capable of handling your application requirements. We can find dozens of free and premium user management plugins by professional developers to manage the user-related tasks of your application. In the next section, we will be looking...

Time to practice

In this chapter, we have implemented a simple registration and login functionality from the frontend. Before we have a complete user creation and authentication system, there are plenty of other tasks to be completed. So, I would recommend you try out the following tasks in order to be comfortable with implementing such functionalities for web applications:

  • Create a frontend functionality for lost passwords
  • Block the default WordPress login page and redirect it to our custom page
  • Include extra fields in the registration form

Summary

In this chapter, we have explored the basics of user roles and capabilities related to web application development. We were able to choose the user roles for our application considering the various possibilities provided by WordPress.

Next, we learned how to create custom routes in order to achieve an MVC-like process using the frontend controller and custom template system.

Finally, we looked at how we can customize the built-in registration and login process in the frontend to cater to advanced requirements in web application development.

By now, you should be capable of defining user roles and capabilities to match your application, creating custom routers for common modules, implementing custom controllers with custom template systems, and customizing the existing user registration and authentication process.

In the next chapter, we will look at how we can adapt the existing database of WordPress into...

Left arrow icon Right arrow icon

Description

WordPress is one of the most rapidly expanding markets on the Web. Learning how to build complex and scalable web applications will give you the ability and knowledge to step into the future of WordPress. WordPress 4.7 introduces some exciting new improvements and several bug fixes, which further improve the entire development process.This book is a practical, scenario-based guide to expanding the power of the WordPress core modules to develop modular and maintainable real-world applications from scratch. This book consistently emphasizes adapting WordPress features into web applications. It will walk you through the advanced usages of existing features such as access controlling; database handling; custom post types; pluggable plugins; content restrictions; routing; translation; caching; and many more, while you build the backend of a forum management application. This book begins by explaining how to plan the development of a web application using WordPress' core features. Once the core features are explained, you will learn how to build an application by extending them through custom plugin development. Finally, you will explore advanced non-functional features and application integration. After reading this book, you will have the ability to develop powerful web applications rapidly within limited time frames.

What you will learn

  • Develop extendable plugins with the use of WordPress features in core modules
  • Develop pluggable modules to extend the core features of WordPress as independent modules
  • Manage permissions for a wide range of content types in web applications based on different user types
  • Follow WordPress coding standards to develop reusable and maintainable code
  • Build and customize themes beyond conventional web layouts
  • Explore the power of core database tables and understand the limitations when designing database tables for large applications
  • Integrate open source modules into WordPress applications to keep up with the latest open source technologies
  • Customize the WordPress admin section and themes to create the look and feel of a typical web application

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 30, 2017
Length: 536 pages
Edition : 3rd
Language : English
ISBN-13 : 9781787124752
Vendor :
WordPress Foundation
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 30, 2017
Length: 536 pages
Edition : 3rd
Language : English
ISBN-13 : 9781787124752
Vendor :
WordPress Foundation
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 106.97
WordPress Plugin Development Cookbook
€32.99
WordPress Complete, Sixth Edition
€36.99
Wordpress Web Application  Development
€36.99
Total 106.97 Stars icon
Banner background image

Table of Contents

13 Chapters
WordPress as a Web Application Framework Chevron down icon Chevron up icon
Implementing Membership Roles, Permissions, and Features Chevron down icon Chevron up icon
Planning and Customizing the Core Database Chevron down icon Chevron up icon
Building Blocks of Web Applications Chevron down icon Chevron up icon
Implementing Application Content Restrictions Chevron down icon Chevron up icon
Developing Pluggable Modules Chevron down icon Chevron up icon
Customizing the Dashboard for Powerful Backends Chevron down icon Chevron up icon
Adjusting Theme for Amazing Frontends Chevron down icon Chevron up icon
Enhancing the Power of Open Source Libraries and Plugins Chevron down icon Chevron up icon
Listening to Third-Party Applications Chevron down icon Chevron up icon
Integrating and Finalizing the Forum Management Application Chevron down icon Chevron up icon
Supplementary Modules for Web Development Chevron down icon Chevron up icon
Configurations, Tools, and Resources Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Half star icon Empty star icon Empty star icon Empty star icon 1.3
(3 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 33.3%
1 star 66.7%
Harry Hill at ecoPen Systems (UK) Dec 17, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
The books overall approach to using WordPress' features and capabilities beyond just out-of-the-box deployments is excellent, It opens up a whole new level of WP usability.A deal-breaker is the grammar and language, full of annoying mistakes and idiocies, looks like they hadn't been able to afford an editor (after using an Indian author apparently not having very good command of English and throwing around all the usual India-style mistakes, at that)! If you're okay with that rubbish, fine -- go ahead and enjoy an otherwise good book. If you're like me though, you'll likely take offence and ask yourself why you pay for such a poorly-edited and not-so-well-written book...
Amazon Verified review Amazon
Israel Sepulveda Jun 16, 2019
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
I tried this book from Packt Publishing. I read the first chapter and followed the first tutorial which was making a question and best answer app. Got through it with no problem. I actually learned a lot from the first chapter.Got to the end of the second chapter, and there seemed to be a bug in the code, so I tried out the final plugin from the source code to see if there was a bug in the Author's code. I got the same bug plus some new ones. I didn't continue with the book because I don't want to waste my time.
Amazon Verified review Amazon
pschboy Aug 20, 2019
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Is it the cool new thing to NOT number the chapters? When I have a test on chapters 11-12, I have to count down the little side carrots to the eleventh one. NUMBER THE CHAPTERS PLEASE.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.