What's new
Xen Factory

Register today to become a member! Once signed in, you'll be able to start purchasing our products, ask questions, request support and suggest new ideas!

  • We are aware that a no permission error was shown when you tried to purchase in the last 2 days, this is now fixed.

Support Conditional for template edit when checking if a user is a paid user when viewing resource templates?

john917

New Member
I'm currently using $resource.canDownload() to show/hide contents in a resource if user paid or not.

But it doesn't seem to work when a user purchases a service offer type.

What conditional statement is being used to show/hide xfrm discussion threads based on a user is paid or not?
 

john917

New Member
@Clement can you tell me if this is possible? Isn't this being used for the discussion tab for when the setting is turned on to hide it until a user buys a resource?
 

Clement

Freaky Coder
Staff member
Yeah but in there I am checking if there is a valid purchase.

So you could use the same condition.

I can’t give it to your right now as I don’t have access to a computer but I can lol during the weekend to guide you.
 

john917

New Member
Yeah but in there I am checking if there is a valid purchase.

So you could use the same condition.

I can’t give it to your right now as I don’t have access to a computer but I can lol during the weekend to guide you.
Thank you! I will look forward to it haha. I spent hours already trying to find it but no success.
 

john917

New Member
I think I found it $visitor.Purchase if you can double check for me just to be sure!
Nevermind. Doesn't quite work. I tried $resource.canPurchase() also and keep getting errors like [E_USER_WARNING] Method hasPurchased is not callable on the given object (SV\ElasticSearchEssentials\XFRM\Entity\ResourceItem) (src/XF/Template/Templater.php:1190)

Is it
xfa_rmmp_restrict_support
 
Last edited:

Clement

Freaky Coder
Staff member
That's not straightforward in fact.
All the code for checking that is the one you can find in src/addons/XFA/RMMarketplace/XF/Entity/Thread.php in the function canView.

As you can see it's not just a variable call.
 
Top