Woocommerce Membership Plugin – Hide Content Only

Posted in: Newspaper
Post count: 104

I am running Woocommerce with the newspaper as my theme and the Membership Plugin which allows restricted content, when I enable the “Hide Content Only” it will display the header and footer, but no formatting for the text, the source shows it seems to be pulling my template as I see article id=”template-id-76894..” but there is no formating, it is just raw text. Interesting on the AMP mobile version works great, so I know it is a template “thingy” not sure where to look and edit. I have the coding skills but not sure where to look or what to set up, I am sure this might be done with some child theme or maybe way off. Any help would be greatly appreciated.

Post count: 35449

Hi,

You are using cloud templates from tagDiv Cloud Library those has the id=”template-id-76894..” I think that one solution is to use a standard template (standard header and standard footer ) and not a cloud template. Please try like this and let me know!

Thank you!

Post count: 104

Hmm…Interesting, so I would have to change the default page for my entire site?

Post count: 35449

Hi, normal if you are using cloud templates, you need to change them with standard templates, but before you do this, please make a full backup, because if this is not working, you can revert to that backup.
Thank you!

Post count: 104

Is there a way to specify a template, like per tag or something?

Post count: 104

This site has done it: https://www.businessreport.com/business/entrepreneur-cameron-jackson they aren’t using woocommerce I don’t believe, but that is the end result.

Post count: 35449

Hi,

Your example does not include woocommerce elements, that is way has a different layout. Also there are no templates for the moment for woocommerce, these are using the standard template and also the shortcodes are use on pages not posts.
We hope that in coming update to implement some new features for WooCommerce.

Thank you for your understanding!

Post count: 104

Is it possible to get some custom work done? The mobile side works, here is a live example: https://fortworthbusiness.com/opinion/richard-connor-canceling-the-rodeo-is-painful-but-its-the-right-thing-to-do/ you can see the desktop renders incorrectly, and when I use the twenty WordPress theme it works, so I know it is an issue with the Cloud Template rendering, I have the code experience but not sure how to manually interrupt or correct this. I would be interested if I have to pay to have your team develop a solution I would appreciate as we are committed to the WooCommerce and Membership plugin so this will be a long term, and of course, we are not dumping the Newspaper theme anytime soon. Thanks!

Post count: 35449

Hi,
If I understand correctly, when you are using the plugin, the content for desktop is look different then the mobile one, and you’ll like to have the same layout. As I can see for mobile version you use a standard template and for desktop is a cloud template, therefore, there is something interpreting different on cloud template. The elements for cloud template are set on this folder -> wp-content/plugins/td-cloud-library/shortcodes/single
If you want one of our developers to check and fix this, it can be done only with custom services and these need to be pay -> https://tagdiv.com/web-development-services/
If is all about directions in our theme, then we can try to guide you to find the files you need.
Thank you!

Post count: 104

I don’t mind paying, but if the direction can be provided that would be great as I have the skills to fix when I know where to look. Thanks!

Post count: 104

Okay, looking into file /td-cloud-library/shortcodes/single/tdb_single_content.php I see this: function render($atts, $content = null), I think that is where my problem lies, WooCommererce Membership passes a truncated text in $post_content_data[‘post_content’] and it seems that the rest of the script stops render, though the footer is there, I see a lot of missing scripting. Wonder if the Render script is breaking or something. I at least have more hope then I have in the past.

Post count: 104

The function Render seems to work, but isn’t getting output correctly.

<div class=”td_block_wrap tdb_single_content tdi_99_54b td-pb-border-top td_block_template_1 td-post-content tagdiv-type” data-td-block-uid=”tdi_99_54b” >

That is the begging of what is in buffy from Render but is not displayed again on the page. Trying to locate which script calls Render and what happens with return data.

Post count: 35449

Hi,

I think that the code use to render the content -> https://i.imgur.com/YJMpA98.pngis somehow sort the code or does not recognize it.
Now I do not know exactly what can be the code target by the plugin that you use, sorry!

Thank you for your understanding!

Post count: 104

I found that the render part is working, it is something afterwards. What script calls the render function? I was looking in all the other plugin files and can’t find I guess the global script that renders the all the pages. Render function is outputting correctly but I don’t know what script calls it. I don’t know if it is part of Newspapers “master” program?

Post count: 35449

Hi,
If that is a JavaScript use for cloud templates it can be on one of these files from this folder -> wp-content/plugins/td-cloud-library/assets/js or general JavaScript -> wp-content/plugins/td-composer/assets/js
Thank you!

Post count: 104

Okay, maybe you might be able to isolate this issue for me, so I use the TD Cloud Library and I have Standard Pack disabled. When I use the Post Settings and select a “Custom Blank – Single Template” from Cloud Library and I removed the header/footer to just rule out code from that, I get the improper rendering as displayed here: https://fortworthbusiness.com/opinion/richard-connor-your-first-vote-is-a-vote-you-should-always-remember/ which again looks fine on the mobile version.

Now, I used the settings above for a test article located here: https://fortworthbusiness.com/uncategorized/test-article/ and reproduce the same incorrect formating, if I change the Post Settings to “Default – Single Template” it renders properly.

I believe that is part you alluded to early with using the non-cloud library template, but how could I fix this in a cloud library template? I also for testing using the Blank Single Template Cloud with just the post content so something in the way processing that is content causing it not to render using a cloud template but works with the default single template? I know I had this same issue with MemberPress and their use of restrict content with excerpts. So my thinking is how plugins edit the Post Content is universal, but how Cloud Library renders is different than how it renders the “Default – Single Template” which I assume is a file template?

Not sure if this is in a JS call or PHP backend, my guess it is in the PHP somewhere for how the TD Cloud Library renders a final page.

Post count: 35449

Hi elvisfrog, unfortunately I’m do not have the proper skills to can explain exactly how this is working, but I will try to do it using my words.
All templates from standard pack and default are using individual php files for each one in part -> https://i.imgur.com/D87NhTh.png but for cloud template are individual php files for each element from single post template -> https://i.imgur.com/LS1s7hs.png -> wp-content/plugins/td-cloud-library/shortcodes/single
Now this is the best way that I can explain, hope this will help a little!
Thank you!

Post count: 104

Update: I have a workaround if someone else is having this same issue.
File: /woocommerce-memberships/includes/Restrictions/Posts.php.
Function: public function handle_restriction_modes() {
If Statement: if ( ‘hide’ !== $restriction_mode || $is_rest_api_request ) {

// ensure the restricted post content data is persisted even when third parties try to filter it
//add_filter( ‘the_content’, array( $this, ‘handle_restricted_post_content_filtering’ ), 999 );

Comment out the “add_filter” and then Woocommerce Membership plugin will display the restricted content properly with Cloud Libray Template.

I Will update when I have a proper solution. Looking to add this as a snippet so updates to files won’t affect this alteration.

Post count: 35449

Hi,
Thank you for sharing with us your results! I’m sure that there are other users that can use this.
Have a nice week!

Post count: 84

Hi “Elvisfrog”, Could you pass on your email so I can ask you how did you overcame this limitation?
We are having the same issue. If you dont mind it would be nice to exchange some info. Thanks

  • This reply was modified 5 years by mita.
Post count: 104

I have to update the fix with the latest update of Membership plugin, which incorporates the excerpt length, so though I still think further is needed to properly address this issue as I believe it is related to the unique way the TD Cloud Templates works.

The first one below has to comment out, for some reason when enabled you won’t see images.
File: /woocommerce-memberships/includes/Restrictions/Posts.php.
Function: public function handle_restriction_modes()
// ensure the restricted post content data is persisted even when third parties try to filter it
Comment out ->//add_filter( ‘the_content’, array( $this, ‘handle_restricted_post_content_filtering’ ), 999 );

With the update Membership you have to comment this as well:
File:/woocommerce-memberships/includes/class-wc-memberships-user-messages.php
Function: private static function trim_excerpt( $the_post ) {​​​​
if ( true === (bool) apply_filters( ‘wc_memberships_message_excerpt_apply_the_content_filter’, true ) ) {​​​​​​​​​​​
/** This filter is documented in wp-includes/post-template.php */
Comment Out ->//$excerpt = apply_filters( ‘the_content’, $excerpt );
}​​​​​​​​​​​

The last one seems to cause the server to an internal error, I have seen this with other plugins and TD Library files. Like I said I wish I can find a proper solution, but this does solve the issue and renders a page like this: https://fortworthbusiness.com/real-estate/om-housing-kennedale/

Hope this helps.

  • This reply was modified 5 years by elvisfrog.
  • This reply was modified 5 years by elvisfrog.
Post count: 84

Thanks.
You couldn’t make memberpress work with the theme, right?

Post count: 104

Not the way I wanted it to. It works great once I commented out those two lines. I hope to discover the root cause. This is only needed if you are using the “Hide Content Only” with “Show Excerpts” part of Membership, if you redirect or hide completely, there isn’t a problem. I love this theme and equally the membership plugin w/ woocommerce subscription great combination.

Post count: 42

I have a different membership plugin custom built.
I fixed it by making changing the filter priority to 1.

It used to be add_filter( ‘the_content’, ‘ra_filter_content’,10 );
Changed to
add_filter( ‘the_content’, ‘ra_filter_content’,1 );

don’t know why it works, but it does.

Viewing 24 posts - 1 through 24 (of 24 total)
The forum ‘Newspaper’ is closed to new topics and replies.