I am not sure if job requests are allowed in this forum, but I’ll give it a try.
I need a custom function to integrate the Patreon plugin in Oxygen, so I can use Oxygen conditions to show/hide elements based on the Patreon user tier.
I already ask Patron PRO dev, but he’s too busy, unfortunately.
Yep, but I solved this differently.
Turns out using Oxygen conditions was not doable in my case.
I just asked a dev to developa piece of custom code and then I used a custom code block in Oxygen.
The custom code hide/show elements of the page depending on several conditions in my case.
Here it is, you will have to tweak it but is a good starting point.
The shortcode [code_snippet id=38 php=true shortcodes=true]
is what is showed to users that have not access to the content, you can change this with the custom Patron PRO banner plugin if you want.
Thanks Kyrian i was able to solve it in the weekend. I created a custom pfp function that returns true and false if a user is a member of a tier ornot according to tier id. Actually i was gonna send it to you but you also solved it…
I just only can add to your reply is the key is:
Class that is being created with patreon plugin.
Thanks for sending the code
and heres what i did…
function patreon( $desired_tier_id ) {
$current_user = wp_get_current_user();
$patreon_user = Patreon_Wordpress::getPatreonUser($current_user);
// Check if the user is a member of a specific tier
//$desired_tier_id = '9665673'; // replace with the ID of the tier you want to check
$is_member_of_tier = false;
if(isset($patreon_user['included'])) {
foreach ($patreon_user['included'] as $included_item) {
if ($included_item['type'] === 'pledge') {
if (isset($included_item['relationships']['currently_entitled_tiers']['data'])) {
foreach ($included_item['relationships']['currently_entitled_tiers']['data'] as $tier) {
if ($tier['id'] === $desired_tier_id) {
$is_member_of_tier = true;
break 2;
}
}
}
}
}
}
if($is_member_of_tier) {
$ret=true;
} else {
$ret=false;
}
return $ret;
}