How to create addons for Wordpress Plugin

Hi. In Patreon portal I read: “Developers can build additional plugins that work together with the official Patreon WordPress plugin.”.

Can you please explain me where to start, if I want to build an additional plugin integrated with the official one?

Consider I’m not a super-expert in plugin building, but I have some Wordpress developing skills and I’m really motivated.

Thanks for your help.

Hi! thanks for your interest in Patreon WordPress.

The best approach for developing addons for PW would be to use its hooks and filters:

Using these, you can hook into the functions of PW and integrate it with your own code. Then these can be used to modify/enhance PW functions, or use PW functions as helpers to your own functions.

As an example, check out features of Patron Pro addon for PW, which has been out for a while, and is used in numerous sites next to Patreon WordPress:

It hooks into PW functions to enhance its content gating logic, provide customization options for gated post interface, provide additional functionality like sneak peeks for gated posts, provide gating by date, age and other useful features. All are done by using hooks or filters, and in rare case, overriding a PW feature when necessary.

Incidentally, you can also create addons for Patron Pro addon above! - All its functions can be hooked to / filtered, and you can use Patron Pro’s features.

Basically addon development is generally all about hooks and filters. It makes development a bit slower and a bit more complicated, but it keeps your addon compatible with the parent plugin through updates.

Thanks for your reply!

I didn’t find hook and filters in the official documentation for the plugin.

I take advantage of your kindness to ask one more thing: I suppose I can use hooks and filters also in my custom theme, is it right? I am much more skilled in theme development.

Thank you!

Of course - any hook or filter can be used from within any piece of code that runs inside WP. Be a theme, or plugin.

We have a special bit of code for people who need to lock a particular part of their theme - because the_content is not applied in header, footer or columns or anywhere else outside the post content. This code can be used to lock any part of any theme, or any part of a WP website:

Thank you for your reply, you are very kind and your documentation is so much useful.

Is there a directory or repository where I can find all the docs you are linking to me in Dropbox Paper, so that I don’t have to ask (and you don’t have to reply) for it one by one?

Thank you!

Unfortunately no, we dont have an organized proper documentation yet.

No problem, thank you anyway.

In case, I’ll ask again for your help. There is some other document that you think can be useful for my studies?

Thank you very much!

Well, in respect to PW, there isnt. beyond hooks and filters, the process is basically examining code and hooking into its processes.

If you mean user documentation for user functions and how the plugin works, we have a number of docs at paper for that.

Really thank you. I’ll ask you in the next days in case of need. Thanks!

1 Like

Hi Ozgur! As promised, I’m working with the Patreon Plugin and I’ve got some questions for you.

As premise, I tell you that would not be a problem to buy the Pro Plugin, but I think that it would not solve my problems.

Reading the very useful documentation you send me I’ve seen that you use classes as “Patreon_Wordpress::getUserPatronage()” (if I make mistakes explaining, sorry, as I said I’m learning). Is there a list for that classes and their use?

Let’s assume I have the following tiers on Patreon
A - 10$
B - 20$
C - 20$
D - 30$
E - 40$
(Note that B and C are both 20$).

Is it possible to make a part of a post visible only for B and E (not A, C, D)? How could I do that?

Thank you for your kindness.

You would need to use shortcodes for that, and check for particular tier ids.

Patron Pro does something similar, but only for levels. Using its shortcode, a part of a post can be locked for any level.

In your case, you would need to make your shortcode function to check for ids of your tiers. And if the tiers you want match, show, if not, hide.

Thank you. Shordtcodes was what I inteded to do.

How can I get a Patron’s tier’s ID? Is there a list for this “getters”?

Is there a list for classes as “Patreon_Wordpress::getUserPatronage()” ?

Thank you!

There isnt a function for getting a patron’s tier id at this moment, but

Patreon_Wordpress::getPatreonUser( $current_user );

should get you user’s info from the api which you can then interpret. Api docs would help for that since return comes from this endpoint accordingly:

Oooook! Thank you! :slight_smile:

Hi, sorry but I’ve tried for a lot of hours to get the patron’s tier id with

Patreon_Wordpress::getPatreonUser( $current_user );

but I didn’t get it done.

Would you be so kind to help me?
Really thank you!