Developer Documentation for Plugin?

Am I missing some very obvious place where you would have actually named the function you added in the recent update or is that just not documented yet?

Even better would just be a place I could read documentation around all the functions, hooks, and filters available for use. Does this exist?

The changelog is here: Patreon WordPress – WordPress plugin | WordPress.org

1.4.4

  • Added a simple way for custom gating any part of a WP site using a single function. This will allow easier gating of any part of a site via theme files.
1 Like

The usage of this new function can be seen in the doc made for non-developer users.

Developer documentation currently exists only for hooks and filters, and they are at these paper docs:

1 Like

Ok, saw this from searching around. I have a problem then, and it’s likely related to me just being a PHP newbie, but I can’t seem to access that Class at all.

From what I can tell, this theme uses the Elementor plugin heavily, even in content-part documents to show posts.

It’s trying to namespace to the plugin I think? Is there a quick way to break out of the Elementor class from inside the template file?

Here’s the fatal error:

Fatal error:  Uncaught Error: Class 'Elementor\Patreon_Frontend' not found in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/progression-elements-skrn/elements/post-element.php:1181
Stack trace:
#0 /Applications/MAMP/htdocs/wordpress/wp-content/plugins/elementor/includes/base/widget-base.php(448): Elementor\Widget_ProgressionElementsVideoList->render()
#1 /Applications/MAMP/htdocs/wordpress/wp-content/plugins/elementor/includes/base/widget-base.php(578): Elementor\Widget_Base->render_content()
#2 /Applications/MAMP/htdocs/wordpress/wp-content/plugins/elementor/includes/base/element-base.php(637): Elementor\Widget_Base->_print_content()
#3 /Applications/MAMP/htdocs/wordpress/wp-content/plugins/elementor/includes/base/element-base.php(853): Elementor\Element_Base->print_element()
#4 /Applications/MAMP/htdocs/wordpress/wp-content/plugins/elementor/includes/base/element-base.php(637): Elementor\Element_Base->_print_content()
#5 /Applications/MAMP/htdocs/wordpress/wp-content/plugins/elementor/includes/base/element-base. in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/progression-elements-skrn/elements/post-element.php on line 1181

This is likely due to your setup there - you use MAMP. And there is something odd happening with the WP plugin that is in progression-elements-skrn folder in your plugins folder - whatever plugin that is.

The setup in your site seems to be causing Patreon WordPress’ classes to appear under the above plugin’s namespace. There is no Elementor\Patreon_Frontend class. PW doesnt even use a namespace so this must stem from your WP installation in local MAMP or another plugin.

If this is your local dev installation, try checking out the plugin in a normal/standard Linux host and see if this fixes the problem.

Ok, pretty sure this problem won’t change on a server, it’s definitely the theme setup (using the Elementor plugin everywhere for ease of editing).

I’ll try the normal server suggestion, but this feels specific to Elementor. On any other template not driven by this plugin, I can use this function without issue.

Elementor plugin by itself should not cause this on a standard linux host - its widely used. No such situation was reported to us with Patreon WordPress.

Trying your existing setup with a standard linux host can confirm the situation.

I actually just ended up circumventing it like this:

themes/<theme_name>/functions.php

function patronCheck($gate_level=7){
return Patreon_Frontend::gate_custom_content( $gate_level );

}

This instantly let me use the function in the elementor template:

<?php echo patronCheck(9) ?>

I do have a question though, because I’m trying to do a lot here on the theme side, and I just need 3 pieces of data I could not find in the WP_User object:

  1. Is the user a patreon subscriber
  2. At what level has that patron committed
  3. Are they current in their billing

Is there a way to just get these values so I can work with them more easily in my templates?

Patreon_Wordpress::getUserPatronage( $user ); where $user is WP user object. If WP user object is not given, it defaults to current user.

This should fulfill your need. It is static and it may work around your namespace issue. But you may encounter other problems with the integration due to the namespace issue persisting. You will have to try and see.

1 Like