-
Notifications
You must be signed in to change notification settings - Fork 97
Enhancement - Shortcode Display Member Error Instead of Blank/Nothing #3
Comments
It shouldn't use |
I don't think they are that unrelated, slightly different but not unrelated - as its displaying an error message to users who can't view that post content instead of just nothing. Even your comments for the 'members_get_post_error_message' function say "Gets the error message to display for users who do not have access to view the given post." You've also got the handy 'members_post_error_message' filter there as well. Perhaps a separate function would be useful to distinguish but it probably could be quite similar and/or take a shortcode parameter as well as you say. |
Actually, they are very much unrelated. Technically, Nevertheless, Just as an example of using one of the shortcodes in a theme
I hope that helps explain it a bit. |
Gotcha - I see where you are going with it - especially in that particular use case - but If I'm someone that is able to edit the template (and understand the intricacies of how to do that) why would I use that shortcode (tied to the plugin) to hide the content? I could just use something like: http://codex.wordpress.org/Function_Reference/is_user_logged_in I would have assumed the shortcode would be most useful in a post/page situation? Anyhoo, not a big issue just thought I'd post a question as it's something I found of use on a few sites as people typically want to show that they are hiding something. Thanks for the discussion! |
I'm not saying the user would edit a template. The above is showing how shortcodes are used outside the post content. A theme could have a shortcode-ready area, for example, and allow the user to add data to it via a theme option. With my own themes, this is a common thing. Anyway, the feature you're asking about is definitely on the radar. I'm still thinking about using a shortcode parameter. But, I'm not sure about formatting the data passed through that parameter. |
Gonna dig this one out. Any chance you will add custom error messages which can be triiggered by shortcode parameter near future? |
Here's some problems that must be overcome and tested. Inline vs. block-levelThe following is two example posts. As you can see, one usage is inline and the other is block-level. Post #1:
Post #2:
Content vs. parameterYou can add pretty much anything as the content of the shortcode, even HTML. However, you can't add anything to a parameter. Allowed:
Not Allowed:
|
One idea might be to introduce an additional parameter, such as The other option might simply be to let users go for two separate shortcodes (one for each of the two groups of users). That seems easier to do. |
Since Gutenberg is going to be the future editor, we should probably roll this into a custom access block. See: #198 |
Given the issues I outlined above with the shortcode system and that this feature will be available in the Block Permissions add-on (see early screenshot below), I'm closing this ticket. Ultimately, the block editor is the way forward and provides the necessary flexiblity for properly handling this. |
Hi Justin,
Question / Enhancement - Do you think it would be worth displaying non members an error or message when viewing content hidden by one of the members shortcodes?
So for example if I use [is_user_logged_in] to wrap (and hide) some member only content - instead of just displaying nothing it might be nice to show one of the member error messages. Like so -> findingsimple@ef8b295
Perhaps for a nicer implementation the output could just be wrapped with a filter so that it can be hooked into within a theme or another plugin?
The text was updated successfully, but these errors were encountered: