Skip to content

About

Sample WordPress Plugin for use at AspenCon 26. For use as a jumping off point for further development.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Aspen Discovery WordPress Plugin

The Aspen Discovery WordPress plugin helps your website connect to an Aspen Discovery instance and show live content from it inside WordPress.

It can be used to:

  • show public information such as lists, events, and library data
  • let patrons log in to their Aspen account
  • display patron-specific data after login
  • protect sections of content so only logged-in users can view them

What this plugin does

Once connected to your Aspen Discovery instance, the plugin can:

  • make authenticated or public API requests to Aspen
  • create login and logout links for patrons
  • handle the OAuth callback needed for login
  • display custom data using shortcodes
  • restrict content to logged-in patrons

Requirements

Before installing the plugin, make sure you have:

  • a WordPress site
  • an Aspen Discovery instance or API service
  • the correct OAuth client credentials from Aspen
  • permission to add plugins and manage WordPress settings

Install the plugin

  1. Upload the plugin ZIP file to WordPress.
  2. Activate the plugin from the WordPress admin Plugins page.
  3. Go to the plugin settings area in the WordPress admin.

If your site uses a development or staging environment, make sure the correct Aspen API URLs and credentials are configured there before using the plugin on production.

Configure Aspen settings

In the plugin settings screen, save the credentials for your Aspen Discovery OAuth clients.

You will typically set up two types of credentials:

  • Client Credentials: used for public or general data access
  • Authorization Code: used for patron login and patron-specific content

Client Credentials

Use these when you want to show public information that does not require a logged-in patron.

Examples:

  • public lists
  • events
  • library information
  • general Aspen Discovery content

Authorization Code

Use these when you want patrons to log in and access their own account information or restricted content.

Examples:

  • patron profile
  • account summary
  • private content behind login

Login flow for patrons

When Authorization Code credentials are saved, the plugin can generate the URLs needed to start login, complete the OAuth process, and log users out.

The plugin can provide public links such as:

  • login start URL
  • callback URL
  • logout URL

Typical examples:

  • login: /?aspen_discovery_oauth=login
  • callback: /?aspen_discovery_oauth=callback
  • logout: /?aspen_discovery_oauth=logout

These are useful in menus, buttons, custom links, or other WordPress content.

Restricting content to logged-in patrons

You can protect content so it only appears when a patron is logged in.

Example:

[aspen_discovery_protected]
Welcome back.
[aspen_discovery_demo api="User" method="getPatronProfile" client_type="authorization_code"]
[/aspen_discovery_protected]

What this does:

  • if the user is logged in, the protected content is shown
  • if the user is not logged in, a login prompt appears instead
  • the protected section can be used for account pages or member-only content

Using shortcodes

The plugin includes shortcodes that let you display Aspen data directly in WordPress pages and posts.

Public data shortcodes

These use the client credentials flow and do not require a patron login.

Use them for:

  • library information
  • lists
  • events
  • other public content from Aspen

Patron-specific shortcodes

These use the authorization code client and require the patron to be logged in.

Use them for:

  • patron profile
  • account summary
  • personalized items and data

If the user is not authenticated, the plugin can automatically prompt them to log in.

Recommended use cases

This plugin is most useful for websites that want to:

  • connect WordPress to an Aspen Discovery instance
  • show live library information in site pages
  • give patrons access to personal account details
  • keep some content visible only to logged-in users

Basic troubleshooting

If the plugin is not working as expected, check the following:

  • your Aspen OAuth client ID and secret are correct
  • the correct OAuth scopes are saved
  • the callback URL matches the one configured in Aspen
  • your site is using the correct Aspen environment (test or live)
  • your patron login flow has been tested in a browser

If a shortcode does not show data, verify whether it needs public credentials or patron credentials.

About

Sample WordPress Plugin for use at AspenCon 26. For use as a jumping off point for further development.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages