Integrating phpList 2 with WordPress

3 min read

Prerequisites for this WordPress tutorial

For this tutorial, we’ll make the following assumptions:

  • We already have a working instance of WordPress (version 3.x)
  • Our phpList site is accessible through HTTP / HTTPS from our WordPress site

Installing and configuring the phpList Integration plugin

Download the latest version of Jesse Heap’s phpList Integration plugin from http://wordpress.org/extend/plugins/phplist-form-integration/, unpack it, and upload the contents to your wp-content/plugins/ directory in WordPress.

Activate the plugin from within your WordPress dashboard:

Under the Settings menu, click on the new PHPlist link to configure the plugin:

General Settings

Under the General Settings heading, enter the URL to your phpList installation, as well as an admin username/password combination. Enter the ID and name of at least one list that you want to allow your WordPress users to subscribe to:

Why does the plugin require my admin login and password?
The admin login and password are used to bypass the confirmation e-mail that would normally be sent to a subscriber. Effectively, the plugin “logs into” phpList as the administrator and then subscribes the user, bypassing confirmation.
If you don’t want to bypass confirmation e-mails, then you don’t need to enter your username and password.

Form Settings

The plugin will work with this section unmodified. However, let’s imagine that we also want to capture the subscriber’s name. We already have an attribute in phpList called first name, so change the first field label to First Name and the Text Field ID to first name (the same as our phpList attribute name):

Adding a phpList Integration page

The plugin will replace the HTML comment <!–phplist form–> with the generated phpList form.

Let’s say we wanted our phpList form to show up at http://ourblog.com/signup.

Create a new WordPress page called Signup, add the content you want to be displayed, and then click on the HTML tab to edit the HTML source:

You will see the HTML source of your page displayed. Insert the text “<!–phplist form–>” where you want the form to be displayed and save the page:

HTML comments
The “<!–some text–>” syntax designates an HTML comment, which is not displayed when the HTML is processed by the browser / viewer. This means that you won’t see your comment when you view your page in Visual mode.

Once the page has been updated, click on the View page link to display the page in WordPress:

The subscribe form will be inserted in the page at the location where you added the comment:

Adding a phpList Integration widget

Instead of a dedicated page to sign up new subscribers, you may want to use a sidebar widget instead, so that the subscription options can show up on multiple pages on your WordPress site.

To add the phpList integration widget, go to your WordPress site’s Appearance option and go to the Widgets page:

Drag the PHPList Integration widget to your preferred widget location. (These vary depending on your theme):

You can change the Title of the widget before you click on Close to finish:

Now that you’ve added the PHPList Integration widget to the widget area, your sign up form will be displayed on all WordPress pages, which include that widget area:

 


Further resources on this subject:

Packt

Share
Published by
Packt

Recent Posts

Top life hacks for prepping for your IT certification exam

I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…

3 years ago

Learn Transformers for Natural Language Processing with Denis Rothman

Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…

3 years ago

Learning Essential Linux Commands for Navigating the Shell Effectively

Once we learn how to deploy an Ubuntu server, how to manage users, and how…

3 years ago

Clean Coding in Python with Mariano Anaya

Key-takeaways:   Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…

3 years ago

Exploring Forms in Angular – types, benefits and differences   

While developing a web application, or setting dynamic pages and meta tags we need to deal with…

3 years ago

Gain Practical Expertise with the Latest Edition of Software Architecture with C# 9 and .NET 5

Software architecture is one of the most discussed topics in the software industry today, and…

3 years ago