In lots of these recipes, you will see the instructions to add some bunch of code to the “active theme’s functions.php file” or “a custom plugin”. How do you go about creating a custom plugin? Like this.

You will need to be able to FTP into your website. If you don’t know how, ask your host or Google it.

  1. Create a folder called pmpro-customizations in the wp-content/plugins folder of your site.
  2. Create a file called pmpro-customizations.php in the folder you just created.
  3. Edit pmpro-customizations.php and paste this code into it:

    <?php
    /*
    Plugin Name: PMPro Customizations
    Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/
    Description: Customizations for Paid Memberships Pro
    Version: .1
    Author: Stranger Studios
    Author URI: http://www.strangerstudios.com
    */
  4. Add the code for the recipe you are doing at the bottom of pmpro-customizations.php.
  5. Save it.
  6. Go to Plugins in your WP Dashboard and active the PMPro Customizations plugin.

Tada!

27 Responses to Create a Plugin for PMPro Customizations

  1. Hide the PMPro "Require Membership" meta box from non-admins on add/edit post screen. - Paid Memberships Pro says:

    […] on the edit post screen. Here is some code to add to your activetheme’s functions.php or a custom plugin. /* Hide the PMPro "Require Membership" meta box from non-admins on add/edit post […]

  2. Keep Non-Members From Posting Comments | Paid Memberships Pro says:

    […] Below is a simple block of code you can place in your theme’s functions.php file or in a helper customizations plugin (ideal method) to restrict […]

  3. leihan says:

    this looks very doable. 3 questions.
    1. do custom plug ins slow down the speed of my site?
    2. do I need to do anything to the custom plugin when a new version of the PaidMembership pro updates?
    3. I want to use this new plugin you got but don’t want to require Last Name. Should I create a custom plug in and edit the code from https://github.com/strangerstudios/pmpro-add-name-to-checkout OR just download this one and edit the code in there directly to NOT require last name?

    thank you! love this help forum so far. great job!

    Lei

  4. Susie Koether says:

    can you have more than one customized plug-in at a time? or do you put them into this one instance?

    • Kimberly Coleman says:

      All customizations can go into the same pmpro-customizations file core plugin file (pmpro-customizations.php). We have some add ons that function as separate plugins but for code recipes and defining certain global variables in conjunction with add on plugins, you just need a single pmpro-customizations plugin.

      • Aimee says:

        In that case, how would you tell the plugin to apply itself (for instance, if I add “company” field to checkout for businesses, but not individuals) only to one membership level, not all?

        • Jason Coleman says:

          You can set a “level” property on Register Helper fields so they are only applied to specific levels. So e.g.

          `
          $fields[] = new PMProRH_Field(
          “company”, // input name, will also be used as meta key
          “text”, // type of field
          array(
          “size”=>40, // input size
          “class”=>”company”, // custom class
          “profile”=>true, // show in user profile
          “required”=>true, // make this field required
          “level”=>array(1,2,3) //only add this field to levels 1,2, and 3
          ));
          `

          • Aimee says:

            Hi, Jason, I was sure there had to be a way! Here’s how I incorporated it, but there is no effect on the fields. Thoughts on where I went wrong?

            //define the fields
            $fields = array();
            $fields[] = new PMProRH_Field(“Organization Name”, “text”, array(“size”=>40, “class”=>”Organization Name”, “profile”=>true, “required”=>true, “level”=>array(2)));
            $fields[] = new PMProRH_Field(“Organization Email”, “text”, array(“size”=>40, “class”=>”Organization Email”, “profile”=>true, “required”=>false, “level”=>array(2)));
            $fields[] = new PMProRH_Field(“Contact Name”, “text”, array(“size”=>40, “class”=>”Contact Name”, “profile”=>true, “required”=>true));
            $fields[] = new PMProRH_Field(“Contact Email”, “text”, array(“size”=>40, “class”=>”Contact Email”, “profile”=>true, “required”=>true));

  5. Jessica O on "[Plugin: Paid Memberships Pro] Display Single Level Checkout with Shortcode" | Wordpress Problems & Erros - How to fix says:

    […] 2. Define a default checkout level for PMPro to use with this code:define("PMPRO_DEFAULT_LEVEL", "1"); You will want to place that in your active theme’s functions.php file or a customizations plugin as described here: http://www.paidmembershipspro.com/2012/08/create-a-plugin-for-pmpro-customizations/ […]

  6. sandipoza says:

    after login i got logged-in. i dont want to got logged-in page what can i do?

  7. akismet-e5c4dbeda0b4a1ddd39095704cef6c95 says:

    Hate to beat a dead horse, but what IF I wanted to create seperate plugins for each of my customizations so I could control turning some of them on/off without affecting the others.. Can I do this?? If so HOW??

    • Jason Coleman says:

      You could do this. Just change the folder name, file name, and “Plugin Name” and “Plugin URI” to something unique for each plugin. Then they will show up as separate plugins in your dashboard. The plugin “Pluginception” is also an easy way to generate plugins in a WP install:

      https://wordpress.org/plugins/pluginception/

  8. bballah says:

    I installed PM Pro, the helper plugin and created the pmpro-customizations.php as instructed. The custom fields show up fine on checkout and profile BUT it doesn’t save to database. Did I miss a step? Thanks.

    • Jason Coleman says:

      This is not a known bug, you should post something to the member forums and we can help you out.

  9. messica on "[Plugin: Paid Memberships Pro] Blank Message for Non-member" | Wordpress Problems & Erros - How to fix says:

    […] The intended use of the shortcode is simply to give users the ability to hide and display different content depending on membership level. If you want, you can create your own [my_membership] shortcode by copying and modifying the functions to your own active theme’s functions.php file or customizations plugin. […]

  10. cedros says:

    Hi,

    I followed the instruction, used this code (https://gist.github.com/strangerstudios/6003272) for the plugin and uploaded it. But for some reason it doesn´t show up in the plugin sections. I checked three times now, if I did anything wrong, but it´s basically just copy and paste. Do you now any common mistake that I could have made? It´s named correctly and in the right place – I really have no clue, why it doesn´t show up!?

    • Jason Coleman says:

      You need to put the “header” information from the pmpro-customizations template above the code from that gist. So paste them together with the pmpro-customizations on top and make sure it’s in the /wp-content/plugins/ folder. If you need more help, post to our member forums and we’ll help you out.

      • cedros says:

        Hi Jason,

        Thank you for your reply. After checking everything a few more times and not finding any mistake, I just created folder and file again from scratch and for some reason now it works!?!?
        I also sent an e-mail to your support over your contact form. Since the problem is already solved, please just ignore it.

        Thank you!

  11. cruzalde says:

    Hi, I am currently using the PMPro Customization and I am very happy with this plugin. The only item I am figuring out at the moment is how to inject javascript into the pmpro customization, because I am looking at having a datepicker for my date fields.

  12. trishacupra says:

    Hi Jason. Is there any reason why using Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) and adding each recipe as a snippet wouldn’t work? I have used it successfully to add functions before (it’s good because you can switch themes without worrying about your functions.php). It’s also handy because you can activate/deactivate functions (snippets) independently to aid troubleshooting.

    • Jason Coleman says:

      That looks really cool and I think that would be a good way to manage the code snippets we share on the site here. It is similar to what we suggest with the pmpro-customizations.php plugin, but you can add the code via the WP GUI instead of having to edit the plugin file directly.

      • trishacupra says:

        I’m glad I mentioned it, then. :-)

        • zalde says:

          Hi Trishacupra, I have created snippets in almost all of my codes to customize wordpress and to do things that existing plugins don’t have. so far, I don’t have any issue and quite satisfied with it. With code snippets, you can do almost everything you want. :)

  13. wsiebold says:

    I am launching a site for a 501(c)(3) non-profit. One of the constraints the Board has stipulated is that there can be no mention of the word “membership” in the membership section (I know – ironic right?). Instead everything has to be “patron” & donation. I have been able to accomodate so far by revising all front-facing instances of the word “membership” to “patron”, etc, EXCEPT for the Membership Levels page (for me – the Patron Levels page) which is generated when a prospective patron selects a patron level package (i.e. a Membership Level). I think I tracked it down to the PMPro functions.php file and the pmpro_getLevelCost() function called there. I tried creating a custom plugin – which initiated just fine – and pasted a modified copy of the pmpro_getLevelCost() function into it. Of course, it throws and error because I am asking the function to fire off twice. I have a couple ideas on how to proceed, but thought I would put it out there to you folks to see what you think – perhaps you can suggest something.

    The non-profit folks would also like me to modifiy the URL / permalinks to remove all instances of the word “membership” as well. This is a lower priority for me.

    Any contribution will be very much appreciated.

    Bill

Leave a Reply

Ready to Get Paid? Get Paid Memberships Pro Now

Or download the full Paid Memberships Pro plugin for free.

GPL v2