Daniel Iser
Forum Replies Created
-
@rogererkens – I would need the error messages to troubleshoot the logging issue. Could simply be that your host doesn’t offer direct file writing access. It shouldn’t throw errors though so we need to track that down.
As for pages not loading, we have debugged this a few times, and every time it comes down to some other plugin or them modifying the responses from the WP Rest API when querying for pages.
I’d try the health check & troubleshooting plugin. Run Troubleshooting mode on our plugin and see if the pages load correctly. If so then go back to plugins page and activate the other plugins a few at a time until it breaks again.
PS Troubleshooting mode should be done with a default WP theme installed. So install Twenty Twenty Two or Twenty Twenty-Three theme for example. This eliminates your theme as a possible conflict point as well.
Let us know.
@alaid – That is a level of complexity we simply haven’t considered if I’m being honest.
Just thinking out loud, I think we’d need a new set of rules for targeting posts based on author, authors roles etc.
From there you’d probably be able to work this out quickly.
I need to play with this one but its doable.If you want to submit a feature request we can try to get it on the board soon: https://contentcontrolplugin.com/feature-requests/
In the mean time you can create custom rules that would suffice: https://ww.wp.xz.cn/support/topic/content-control-for-a-specific-url/#post-17165251
@cbfriend – Ok in that case I’ve been working with WPML on remapping our targeting rules so they can be applied across translations properly. This is probably the correct solution for your needs as well, though its likely a bit off so we can help you craft a custom rule in the mean time.
Your callback would be something like
function custom_rule_callback() { return strpos( $_SERVER['REQUEST_URI'], '/url/you/want' ) !== false; }You would register it something like this:
add_action( 'content_control/rule_engine/register_rules', function ( $rules ) { $rules->register_rule( [ 'name' => 'custom_rule_1', 'label' => __( 'My Custom Rule', 'content-control' ), 'context' => [ 'content' ], 'callback' => 'custom_rule_callback', ] ); } );@cbfriend – URL targeting rules are planned in the Pro version already. There will also be rules for checking query args, referrer url (facebook etc) and more.
@smithjhsn – Many times this depends on the individual plugin/addon your dealing with.
If you want to tell me what plugin/content doesn’t have rules currently we can look into adding proper custom rules for that plugin.
For example, v2.1 (free) will include custom rules for WooCommerce shop & account pages/subpages. They are built based on actual WooCommerce APIs so if the urls change one day, you don’t have to correct things in every restriction/block, it will just continue to work.
If your interested in the Pro version, we are prepping v1 for launch, I’ll work to squeeze these rules in to the first release.
Final DIY based alternative, you can hack in your own custom rules: https://github.com/code-atlantic/content-control/blob/master/classes/RuleEngine/Rules.php#L200
Lots of example rules there to draw from, only thing you’d have to code yourself was the callback, which simply needs to be a function that returns true/false.
Hope that helps.
@havor99 – Not a problem. If your using the block editor there are controls on the sidebar to handle this for each block: https://contentcontrolplugin.com/docs/block-controls/how-to-add-a-restriction-to-a-block/
Otherwise you can use our [content_control] shortcode around the forms shortcode: https://contentcontrolplugin.com/docs/developer-docs/how-to-use-the-content-control-shortcode/
Hope that helps, if so please take a moment to rate & review the plugin and or support to spread the word.
- This reply was modified 2 years, 7 months ago by Daniel Iser.
@peter8nss – Not a problem. Appreciate the reports. With each one the plugin gets more and more reliable, so its all good.
@ashishkamaldhari – It should just work, if you don’t see your post type in the rule selection dropdowns, it likely means it is being registered way too late for our code to recognize it and generate rules for it.
Your CPT should be registered during
initaction, but if it is not by the timeadmin_enqueue_scriptshas run, you won’t get the extra rules.- https://developer.ww.wp.xz.cn/reference/functions/register_post_type/
- https://codex.ww.wp.xz.cn/Plugin_API/Action_Reference
Otherwise all functionality is built to just work with custom post types & taxnomies the same way it does for the built in ones.
Hope that helps.
@peter8nss – only difference being yours is condensed without extra var declaration correct? Just want to make sure, nothing else looked different.
Will get that patched this week.
Hmm, filter_the_content_if_restricted should theoretically be called from within
the_contentfilter, as such the global$postshould be set properly.I wonder if TEC is doing something different there calling the_content generically without setting global first.
You can do that in code, simply callingapply_filters( 'the_content', $content )doesn’t care about global states or doing it right.That would be my guess, they just apply generic content filters, instead of setting globals for per post filtering.
@peter8nss – Can you give me some sample code for what your trying, will work out a solution for you really quick.
@peter8nss – You might try the following:
function get_current_page_url() { global $wp; // Get base URL without the query string. $base_url = home_url( $wp->request ); // Check if it has a trailing slash, if not add one, unless there's a query string. if ( empty($_SERVER['QUERY_STRING']) && substr($base_url, -1) !== '/' ) { $base_url .= '/'; } return add_query_arg( $_SERVER['QUERY_STRING'], '', $base_url ); }Or this one
function get_current_page_url() { global $wp; // Get base URL without the query string. $base_url = home_url( $wp->request ); return add_query_arg( $_SERVER['QUERY_STRING'], '', trailingslashit( $base_url ) ); }- This reply was modified 2 years, 7 months ago by Daniel Iser.
@peter8nss – I feel like I need to just add you to team slack 😜.
The issue clearly lies here: https://github.com/code-atlantic/content-control/blob/c1a28bee7407a8d6332c9cd652654a2115f972a6/inc/functions/content.php#L119
I’ll have to come up with a more reliable way to get the url there.
Good catch.
@peter8nss – Hmm, first get_the_ID() should work, as we do this within the restriction checks there as well,
We can definitely add that, I though we had already done work to add that, remember doing so but don’t see the commit logs, so either I thought it through previously or even coded it but didn’t get it committed for some reason.
Currently I think you have another option too, make multiple restrictions, similar but different based on content, just update the rules on each based on which tag your filtering content on for example.
Future 3rd option, I’ve been working on v2.1 which will likely also allow using presaved block patterns, and since we have block controls that can selectively target based on post info as well, you could also build it that way.
Let me know about
get_the_ID().@minhong1 – Sorry to hear you had issues like that, been there, never fun to get that call..
Ok so top to bottom.
The first 2 indicate another plugin’s autoloader is trying to load files in our namespace, they likely shouldn’t be, so I’m not sure if we can fix that easily on our side or need to get the team at
offload-media-cloud-storageto put some checks on their autoloader method to not run for other namespaces than their own.Honestly it shoulnd’t be a problem, and you say it works fine for a while then breaks suddenly, that makes me think something is scanning the site and removing files it should be, which explains why it works for a bit then breaks: https://plugins.trac.ww.wp.xz.cn/browser/content-control/trunk/vendor-prefixed/trustedlogin/client/src/Form.php
If you can install it clean and it doesn’t throw those errors, that is where I’d start, looking for something that might be scanning/removing files.
Let me know.
Forum: Reviews
In reply to: [User Menus - Nav Menu Visibility] Refreshingly useful and unobtrusive@pmckane – By far the coolest & most accurate review we’ve got yet. Much appreciated feedback.
I think with this one we focused on making it blend like it belonged there naturally. It definitely seems we hit the mark based on your review.
I highly suggest you check out its companion plugin Content Control.
I will say though, and I hope its not to your disliking, but we do have some premium concepts for this in the early planning. Even so were committed to:
- Make the free version better and more capable, more reliable, more integrated, including support for the new block menus.
- Pro will add additional functionality that not everyone needs, but some will find super valuable, such as ecommerce integrations.
- Pro will not be blasting notices everywhere, probably some subtle (and filter removable) text links in the context of the editor where they actually make since. Such as “Need rules for WooCommerce purchase history, Try Pro ( ! ).” which would likely only appear if we detected WooCommerce was installed at that.
User Menus likely won’t need a full page for settings like other plugins, but your free to check out Content Control v2+ and see how we mention the upgrade paths only where appropriate.