How to use block editor on private pages

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Hi.
      I really like this awesome plugin, but I find classic editor a big waste of time to make a private page, it takes so long do to simple tasks and I want to get the most of my time while I’m working.
      So, my question is: how can i change to block editor instead of using classic editor?

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Hi,

      This is actually a great question, not yet documented on our new site.

      You need to add a code snippet (see documentation) to your site to disable our CSS resets, in order to allow third-party plugins integration into your area.

      The code snippet is the following:

      add_filter('cuar/private-content/view/disable-css-resets', 'custom_cuar_disable_css_reset');
      function custom_cuar_disable_css_reset() {
          return true;
      }

      Activate the plugin you just created, then install/activate any page builder (only tested using DIVI builder), and it should work.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      By the way, be warned that deactivating CSS resets may generate some graphic issues in the area. If you deactivate that, your theme CSS stylesheet will be able to affect the area. Those issues should be fixed with custom CSS fixes depending on your theme.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Hi. Thanks for you fast reply.
      I already have that plugin for removing some fields and edited it adding that filters. I deactivated and reactivated it but no luck.
      I use Beaver Builder and when I open that private page there is no option to edit with Beaver at the top wordpress bar. All other pages can start being edited by clicking at “Beaver Builder” or even with Gutenberg clicking on “Edit page”, but those options is not avaliable for WP Customer Area.
      Also if I go to Private pages by left side main WP menu, I only have te option to “Edit” which is allways with classic editor.
      Where am I wrong?

      Thanks in advance.

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Hi,

      Not sure I understood what you said about “that plugin for removing fields”.

      This plugin should look like this:

      /*
      Plugin Name: WPCA Custom Tweaks
      Plugin URI:
      Description: Just an example of a simple WP plugin that can be use to add code snippets for WP Customer Area
      Version:     1.0.0
      Author:      Thomas Lartaud
      Author URI:  https://wp-customerarea.com
      License:     GPL2
      License URI: https://www.gnu.org/licenses/gpl-2.0.html
      */
      
      defined('ABSPATH') or die('Nope, not accessing this');
      
      add_filter('cuar/private-content/view/disable-css-resets', 'custom_cuar_disable_css_reset');
      function custom_cuar_disable_css_reset() {
          return true;
      }

      If you already have a plugin for WPCA tweaks and snippets, just add the snippet at the end of the file.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Oh, sorry, that’s actually what you did, didn’t notice your screenshot.

      Could you create a temporary admin account where I can check this up, please?

      You can send me the credentials to thomas [at] wp-customerarea [do] com

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Hi,
      Yes, I added that code as you can see in that jpg I attached in the last comment.
      By the way,  I was refering to the plugin you sent me documentation. I already used that to not show some fields for users.
      That’s my file main content:

      function remove_some_profile_fields( $fields )
      {
      unset($fields[ ‘description’ ]);
      unset($fields[ ‘nickname’ ]);
      return $fields;
      }

      add_filter(‘cuar/core/user-profile/get_profile_fields’, ‘remove_some_profile_fields’);

      add_filter(‘cuar/private-content/view/disable-css-resets’, ‘custom_cuar_disable_css_reset’);
      function custom_cuar_disable_css_reset() {
      return true;
      }

       

      Thanks

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Ah, ok. I missed you last message because I was typing.
      I will create user and send you credentials.
      Thank you very much.

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Hi,

      Not sure I understood what you said about “that plugin for removing fields”.

      This plugin should look like this:

      /*
      Plugin Name: WPCA Custom Tweaks
      Plugin URI:
      Description: Just an example of a simple WP plugin that can be use to add code snippets for WP Customer Area
      Version:     1.0.0
      Author:      Thomas Lartaud
      Author URI:  https://wp-customerarea.com
      License:     GPL2
      License URI: https://www.gnu.org/licenses/gpl-2.0.html
      */
      
      defined('ABSPATH') or die('Nope, not accessing this');
      
      add_filter('cuar/private-content/view/disable-css-resets', 'custom_cuar_disable_css_reset');
      function custom_cuar_disable_css_reset() {
          return true;
      }

      If you already have a plugin for WPCA tweaks and snippets, just add the snippet at the end of the file.

      Regards.

      Hello.
      I’m not sure if you received my e-mail.
      Thanks for your time.

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Hi,

      I’ll take a look tomorrow.

      For now, I think you can take a look at the Beaver Builder settings in order to activate your editor for WPCA private post types.
      If the issue is that the button is missing on those pages, you should ask Beaver support instead and ask them how to add those buttons on Custom Post Types admin pages.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Also,

      The code I gave you is needed in order to let Beaver Builder components display correctly (if they use custom CSS stylesheets). This code will still be required once you find how to activate Beaver Builder on WPCA posts.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Thanks for your answer.

      I figured out in Beaver Settings that the were one type of post not checked to edit with Beaver, but enabling it didn’t work anyway. Also there was this note right before those configurations: “NOTE: Possibly not all custom post types may be supported”.
      Than I checked in docs and they say to what exactly I’ve done to make Custom Post Types editable.
      I also tried a trick I noted its possible to do: put “?fl_builder” after the url page; hitting Enter it opens Beaver builder for editing the page; works fine with all pages, but in this case it only refreshed the page and nothing happens. I start to think it can’t be edited by Beaver Builder.

      Regards.

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Hi,

      When you activate the cuar_private_file post type in Beaver settings, does a Beaver button appear when you go to admin -> private file -> edit screen? If not, I think that this issue should be addressed to Beaver support instead. Not much we can do on our side since this button comes from Beaver Builder.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Thanks for your answer.

      I figured out in Beaver Settings that the were one type of post not checked to edit with Beaver, but enabling it didn’t work anyway. Also there was this note right before those configurations: “NOTE: Possibly not all custom post types may be supported”.
      Than I checked in docs and they say to what exactly I’ve done to make Custom Post Types editable.
      I also tried a trick I noted its possible to do: put “?fl_builder” after the url page; hitting Enter it opens Beaver builder for editing the page; works fine with all pages, but in this case it only refreshed the page and nothing happens. I start to think it can’t be edited by Beaver Builder.

      Regards.

      Hi.
      Unfortunately there’s no such option on Beaver Settings, activating or not the plugin with that code. I prefer to edit it with Beaver, but I really don’t mind to edit with the Gutenberg, I have good skills with Gutenberg too. However, I  also don’t see any options to edit with Gutenberg. Every time I try to edit it goes automatically to the old text editor.
      I don’t have any edit options on the top bar as you can see on print, activating or not the option related to WP Customer CSS  on settings. Activating this option only breaks styles (see first window print), but nothing else happens. Also if I go to “Private pages” the only option I have is the regular “Edit” which leave me to text editor; no Beaver or Gutenberg edit option.

      PS.: My WordPress is in Brazilian Portuguese, so my print will have most content in portuguese. I also included an example of how to access editing a regular page by Gutenberg or Beaver Builder by the top menu pr the list of pages (right bottom example).

      What am I doing wrong?

      Thank you.

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Wait, I have an idea. I just solved an issue with another customer and your issue might be related.

      Can you try to apply this fix? I won’t be able to do it myself.

      Edit file: wp-plugins/customer-area/src/php/core-addons/customer-pages/customer-pages-addon.class.php
      Line 1047, replace the function define_main_content_filter with that:       
      public function define_main_content_filter($content)
      {
          $post_id = get_the_ID();
          if ((!$this->is_customer_area_page($post_id) && !cuar_is_customer_area_private_content($post_id)))
          {
              return $content;
          }
      
          return apply_filters('cuar/core/the_content', $content);
      }

      Then try again and let me know if it changed something. I’ll take a look more closely at your site this afternoon if it didn’t work.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Also,

      The actual problem is that our custom post types are not showing up in Beaver settings.

      The “pages” post type you selected is the standard “pages” post type, not our cuar_private_page post type.

      There should be something in our post-type declaration that prevents it to show up there.

      Could you try to edit file wp-plugins/customer-area/src/php/core-addons/private-page/private-page-addon.class.php, line 182, replace this:

      'public'             => false,

      with this:

      'public'             => true,

      Then check again on the Beaver Settings page if the post type is showing up.

      Regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Wait, I have an idea. I just solved an issue with another customer and your issue might be related.

      Can you try to apply this fix? I won’t be able to do it myself.

      Edit file: wp-plugins/customer-area/src/php/core-addons/customer-pages/customer-pages-addon.class.php
      Line 1047, replace the function define_main_content_filter with that:       
      public function define_main_content_filter($content)
      {
          $post_id = get_the_ID();
          if ((!$this->is_customer_area_page($post_id) && !cuar_is_customer_area_private_content($post_id)))
          {
              return $content;
          }
      
          return apply_filters('cuar/core/the_content', $content);
      }

      Then try again and let me know if it changed something. I’ll take a look more closely at your site this afternoon if it didn’t work.

      Regards.

      Hi.
      All I had to do was modify the line 182 changing it to true, no need to add those other lines and its now working.
      Thank you so much for your help. I am glad I can now edit it with Beaver, it will save me a lot of time.
      I really appreciate your help.

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Hi,

      Yes, sorry that I just add this idea.
      I actually realized that our custom post types were missing by going to your site.

      However, I actually told you, for testing purposes, to edit our plugin files, but this is not a final solution since you’ll lose those modifications when you’ll update our plugin.

      So, you should instead create a custom WP Plugin (see our code snippet documentation), and add this code snippet to it. It will change public to true for all our private content types.

      I’m actually not sure we’ll change this option to true in the next release, we need to review it first, so you should use the code snippet below to keep this fix working.

      function cuar_make_contents_accessibles($args)
      {
          $args['public'] = true;
          return $args;
      
      }
      add_filter('cuar/private-content/pages/register-post-type-args', 'cuar_make_contents_accessibles');
      add_filter('cuar/private-content/files/register-post-type-args', 'cuar_make_contents_accessibles');
      add_filter('cuar/private-content/conversations/register-post-type-args', 'cuar_make_contents_accessibles');
      add_filter('cuar/private-content/invoices/register-post-type-args', 'cuar_make_contents_accessibles');
      add_filter('cuar/private-content/task-lists/register-post-type-args', 'cuar_make_contents_accessibles');
      add_filter('cuar/content-container/projects/register-post-type-args', 'cuar_make_contents_accessibles');

      As you can see, there is one add_filter line per custom post type. So you can enable them for the post types you need.

      See WP Code for more information about this WP public option.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • Thomas
      Keymaster
      # 3 years, 5 months ago

      Hi @ivangneiding

      Just bumping up this topic because our forum notifications were not yet activated. So you probably didn’t see my last reply.
      Since you closed that topic, I’m just replying to let our forums notify you.

      Best regards.

      Want to help WP Customer Area? It only takes few seconds!
      Rate & review the plugin on WordPress.org 🙂

    • ivangneiding
      Participant
      # 3 years, 5 months ago

      Hi Thomas,
      Sorry for replying so late, but I could not do this before.

      Well, I made all you told me to do. I added that code into my wpca plugin and seems to be working properly. Now I can set cuar options into Beaver settings and I can edit those pages with Beaver Builder.

      I really appreciate your help and you time spent to help me out. Your knowledge was very useful to help me.

      Thank you very much!

       

Viewing 19 reply threads

The topic ‘How to use block editor on private pages’ is closed to new replies.