Closed nasajoey closed 4 years ago
Note I didn't have ability to label this appropriately... it automatically called it a "bug"
@nasajoey sorry, I just updated the template for the feature request. Could you provide your user case in detail?
Like what information and format of the data that you want to show?
We have a fairly simple subscription model. Once a user is subscribed, I give them the correct claim in Firebase. A subscription gives them access to full length articles on our WP site (amongst other things). So, in WP, I'd want to hold back a block of a post if a user is not logged in with the correct claim. something like (sorry don't have the names of your current shortcodes handy, but you'll see the point):
Here's the start of our cool post.
[firebase_logged_in has_claim="CUSTOM_CLAIM_FROM_FIREBASE"]
here's the special content for our subscribers[/firebase_logged_in]
Happy to clarify further.
@nasajoey Nice. And which types of content are they? Plain text, HTML with tags, data from firestore / realtime...?
sorry... i'm not a WP expert...
it is only content that the writers for the site create using the "New Post" option in Wordpress. So it is text, links, perhaps in-Post images. There may be some other shortcodes from other plugins that get used as well.
Does this help? Again, not a WP expert... just feeling my way through!
@nasajoey yes, that's good enough. I will make some tests this weekend.
Hi @nasajoey, the plugin is updated to v0.5.6. Please give it a try.
Here is the guide for display custom data with shortcode: https://firebase-wordpress-docs.readthedocs.io/en/latest/work-with-firebase-custom-claims.html
[firebase_show_with_claims
class='your-class-name'
claims='admin'
message='Custom message'
]
HTML Data With Tags
[/firebase_show_with_claims]
Hi @dalenguyen ... I gave it a try out of the box. I'm unclear if I am supposed to modify code as shown in your guide or if the guide is showing what you already have implemented?
The short code isn't doing what I expected/hoped. I was hoping that I could put an arbitrary claim into the "claims" key of your shortcode and then the text between the begin and end codes would be shown. But I am gathering that I need to write custom code that includes the claim I am interested in. Is that correct? I see your guide... and I can unzip the plugin and I can see that the includes folder has php code that seems to guide this functionality. Also I see some of the custom claims stuff in the js folder. Am I to modify the php or js code, re-zip, then deploy to get this to work?
Any guidance appreciated. js, php, wp are all a bit out of my wheelhouse so I'll take all the help I can get.
Hi @nasajoey, nice to hear from you again.
The shortcode is already implemented. With the right claims, users will see the content inside the shortcode. Otherwise, they will see the message.
Is there any error when you try this shortcode?
I think I have it working now. I may have a bug report later on a related issue, but I think I'm good on this ticket. Thanks for getting back to me!
You're welcome @nasajoey. Please do report another bug or request a new feature. If you have time, please help to rate the free version of this plugin. Thanks,
Feature request for a new shortcode that shows/hides content for the current logged in user based on custom claims that user has/doesn't have.
Note on the bottom of this page:
https://firebase-wordpress-docs.readthedocs.io/en/latest/work-with-firebase-custom-claims.html
You tease us with this feature.
Just opening a ticket as a little reminder. Thanks again for all the effort on this plugin... I think with this feature, all of my primary use cases are handled.