guides
Guide

How to Build a Collaborative Blog with WordPress and Magic

Magic Staff · September 23, 2021

So you want to build a blog where you can invite different authors to write? We know starting a WordPress blog is simple and easy to configure. But how do we invite different authors? How do we ensure we have a secure login option? If you want to learn how to use Magic to authenticate users into a WordPress-powered multi-authored blog, and assign user roles on sign up, read on!

In this guide, we will learn how to create a collaborative blog website that uses WordPress as CMS and Magic as the auth solution.

#Why WordPress?

Choosing the right blogging platform is very important when it comes to building a collaborative blog website. WordPress is the number one website platform used by many successful blogs. To put it into perspective, 42% of all websites on the internet use WordPress!

While there are a number of differences between WordPress.com and WordPress.org, you only need to know the following:

  • WordPress.org gives you the option to install the plugin, as it’s free and open source. And you would be the owner and maintainer of your website.
  • WordPress.com does not allow installing plugins unless you're on a Business or eCommerce plan.

#Why Magic?

Magic is a plug and play passwordless authentication solution that ensures the most simple and scalable way to onboard users. With Magic, all users need to sign up or log in is their email address.

A magic link is then sent to the user, which they can click on to securely and seamlessly authenticate into the application.

Magic also offers a variety of no code features that makes plugging an auth solution into one’s app a delightful experience. A few of them include:

To learn more about Magic, click here!

#Prerequisites

  • WordPress Version: 5.5.1 or higher
  • PHP Version: 7.3 or higher
  • Magic account
  • You have your WordPress installation configured and have a domain name associated with it.
  • Your domain name is SSL secured. Meaning your website should be on https://example.com and not on http://example.com.

#Write Your First Blog Post

To write a blog post, click on the Posts > Add New menu in your WordPress dashboard. You will see an editor area to write your first blog post.

WordPress uses a block-based (Gutenberg) editor where each element is a block. This allows you to create beautiful layouts for your blog posts.

Once you’re done writing, go ahead and click on the Publish button on the top-right corner of your screen to make your blog post publicly available.

#Add the Magic Plugin

Now that you have published your first blog post, it’s time to invite others to collaborate with your blog. This is considered an additional feature to your website, therefore you will need a plugin.

WordPress allows you to extend your website's functionality and add new features through WordPress plugins (without writing any code). To invite others to edit your blog, we’ll need to install the Login by Magic plugin created by Magic.

The easiest way of installing a WordPress plugin is to use the plugin search. Visit the Plugins > Add New page inside of your WordPress admin area.

You will see a screen like the one in the screenshot above. Find the plugin by typing “Login by Magic”. You should be able to see the list of plugins like the screenshot below:

Find the Login by Magic plugin by Magic and click the Install Now button.

WordPress will now download and install the plugin for you. Once it’s finished, the Install Now button will change into the Activate button.

You may have installed a WordPress plugin, but it will not work until you activate it. Ensure you click on the Activate button to start using the plugin on your WordPress site.

That’s all! You have successfully installed the “Login by Magic” plugin. The next step is to configure the plugin settings.

#Configure the Magic Plugin

#Magic configuration

First, you need to connect your WordPress site with your Magic account. To sign up for a Magic account, click here. Once you’ve created your account follow these steps:

  1. Create a new application from Magic dashboard.
  2. Select the Home view of the application. Please take note of the application’s PUBLISHABLE API KEY and SECRET KEY, you’ll need it in a bit. ⁠

#WordPress configuration

Now it’s time to configure the Login by Magic plugin settings.

  1. Visit the Settings > Login by Magic page inside of your WordPress admin area.

  2. Paste your PUBLISHABLE API KEY and SECRET KEY in the appropriate input fields.

  3. Select Author as the default User role. With this setting, anyone on the internet will be able to log into your website and get the Author role. We don’t want that behavior, so we will fix this with Magic’s Access Control feature in a bit.

    To read more about roles and capabilities, click here.

  4. Select the Admin login check box to replace the admin login form with Magic.

  5. Finally, click on Save Changes to save the changes you’ve made.

Let’s ensure that only the people you select are able to get the Author role. Magic’s Access Control feature allows you to control who is and isn't allowed to log into your app. Follow these steps to enable this feature:

Visit your application’s settings page on the Magic dashboard. Add the email addresses of the administrators, editors, and authors you’ll be collaborating with on your blog in the Allow list.

Now, only the listed individuals will be able to log into your website and get the Author role.

To learn more about how to configure Access Control, click here.

#The Login flow

After installing the plugin, the administrator login form is replaced with Magic’s login form as shown above. It accepts an email address. Upon entering the email address and clicking on the Send button. A pop up modal appears saying “Check your email”, similar to the screenshot below:

The user would be granted an Author user role as we have selected that as the default user role while configuring the plugin.

The below screenshot shows the how the dashboard looks like for Author and Editor user roles:

Since we have used Magic’s access control in this application. Entering an email address that is not in the allow list, will show the below message:

Your blog is now open for collaboration!

#Conclusion

As you saw, building a secured collaborative Blog website with WordPress is easy - it only took a few clicks to turn your single-author blog into a collaborative blog CMS that can be used by multiple authors.

Thanks for reading! If you have any questions or feedback, please raise them on the WordPress forum.

If you’d loved using our product, please consider leaving our plugin a review so that others can benefit from Magic too!

Let's make some magic!