memberful / memberful-wp

Better membership software for WordPress.
https://memberful.com
42 stars 15 forks source link
membership membership-management stripe wordpress wordpress-plugin

Information for Developers

Development environment

Setup instructions

You should be able to access the WP admin panel now: http://wordpress.localhost/wp-admin

The default username/password is admin/admin.

Once signed in you'll need to go to your local Memberful site, and setup a WordPress integration (Memberful Admin -> Website -> External Website -> Connect my WordPress site), then copy and paste the activation code into the WordPress admin panel (WP admin -> Settings -> Memberful). Submit the form and then WordPress should be connected to your local vm, ready for development!

Resetting the local environment

Run docker compose down to remove the Docker containers and follow the previous section to start them again.

Updating Docker images

If you need to update the Docker images, you can run docker compose pull to pull the latest images. Then you can run docker compose up to start the updated containers.

Using the WP-CLI

The command-line interface from WordPress can be useful in debugging plugin issues and reading/editing the database.

An easy way to work with the CLI from outside the container is to take the wp() bash function from the provision script:

wp() {
  docker run -it --rm \
    --volumes-from memberful-wp-wordpress-1 \
    --network container:memberful-wp-wordpress-1 \
    --env-file envfile \
    --user 33:33 \
    wordpress:cli wp $@
}

If your volume and container names match you can take the above function, copy/paste it into your command prompt, and then run wp commands as if WordPress was installed directly (outside a container).

For example, to see all the metadata for user 2 directly from the db: wp user meta list 2

Versioning

The plugin is versioned using Semantic Versioning.

The gist of it is as follows:

                                                                        
                    +---+ Increment this number on every normal release 
                    |     that adds features and is not intended to     
                    v     break/remove existing features.               
                 1.12.0                                                 
                 ^    ^                                                 
                 |    |                                                 
      +----------+    +----------+ Change this number if you need to    
      +                            release an update that ONLY includes 
  Increment this number            bug fixes.                           
  if you change compatibility                                           
  or stop supprting an old                                              
  version of WordPress.                                                 
                                                                        

It's worth noting that the version number is not a decimal number, and each segment is a separate number. i.e. 1.12.0 > 1.11.0.

Releasing a new version of the plugin

Prerequisites

Make sure you're added as a committer in WordPress.

The release script retrieves the WordPress committer username from the svn server config file.

To setup, enter ~/.subversion/servers and add a group with a URL match for WP's server URL, as well as your WP username, like so:

[groups]

memberful-wp = plugins.svn.wordpress.org

[memberful-wp]

username = YOUR_WP_COMMITTER_USERNAME

Any svn actions to plugins.svn.wordpress.org that require authentication will then use the username from the config file.

Release steps

Updating WordPress SVN without a new plugin version

From time to time we need to update WordPress SVN without releasing a new plugin version. For example we need to do this after updating "Tested up to" in readme.txt. To do this simply follow the release instructions above without updating the plugin version.

Updating assets for the WordPress plugin page

Very occasionally we may need to update the assets for the WordPress plugin. This includes the banner image, the icon, and the screenshots. To do this:

Rolling back