• Resolved curlymop

    (@curlymop)


    Hi, I have the message from the template developer, please could you read and comment?

    The issue seems to be that the RSVP block is not working with custom post types. Our events use custom post types registered by our plugin. To see if this issue is limited to our custom post types or all custom post types in general, I installed the Custom Post Type UI (CTP UI in the menu). I added a custom post type called "Test", which you will also see in the menu. Using the RSVP block in the content of that post type fails in the same way that it does in our plugin's post types. I recommend sending this information to the maker of the RSVP block as it seems the problem is not limited to our plugin but all custom post types.

    I would really love to use the RSVP block in other posts, would this be something that would be on the list for resolving?

    Regards

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support masoodak

    (@masoodak)

    Hi @curlymop,

    Thanks for reaching out!

    I tried reproducing this issue on a test site of my own and was able to do so (https://i.imgur.com/56QoHFn.png). Thus, I am going to report this issue to our development team in a bug report.

    Many thanks for bringing this to our attention.

    Kind regards,
    Masood

    Thread Starter curlymop

    (@curlymop)

    Thank you, will keep an eye out for the answer in due course.

    Plugin Contributor Juan Aldasoro

    (@juanfra)

    Hi @curlymop,

    Thanks for reaching out to us. That problem has to do with the way the Custom Post Type was registered.

    As the Tickets and RSVP blocks use custom fields, you need to enable “custom-fields” support for your Custom Post type to avoid this issue.

    https://developer.www.ads-software.com/reference/functions/register_post_type/#supports

    Please let me know how it goes.

    Best,
    Juan.

    @juanfra Hello, @curlymop is using our Church Content plugin.

    Supporting custom-fields would let users add their own custom fields. That’s not something our users need so we do not enable it. It seems that since your plugin relies on it, it makes sense for your plugin to enable it for each custom post type enabled in your settings. Here is a possible approach:

    https://zerowp.com/modify-cpt-arguments-after-it-was-registered/

    Or, maybe there is a way the block can be designed to not rely on custom-fields being enabled?

    Thanks for your help.

    Plugin Contributor Juan Aldasoro

    (@juanfra)

    Hello @stevengliebe,

    Thanks for reaching out to us!

    Unfortunately we need the CPT to have custom fields, as it’s structural to how the RSVP and Tickets work. We use those to identify and save useful information.

    I understand that there can be a particular compatibility issue with your plugin. Maybe you can disable metadata for those users by default? Something like:

    update_metadata( 'user', $user_id, 'enable_custom_fields', false );

    You could also try to disable the custom fields by default:

    add_filter( 'block_editor_settings_all', 'tec_tickets_disable_custom_fields_cpt', 10, 2 );
    /**
     * Disable custom fields for CPT.
     *
     * @param array $editor_settings The editor settings.
     * @param WP_Post $post The post object.
     *
     * @return array
     */
    function tec_tickets_disable_custom_fields_cpt( $editor_settings, $block_editor_context ) {
    
    	if ( 'your_cpt' === $block_editor_context->post->post_type ) {
    		$editor_settings['enableCustomFields'] = false;
    	}
    
    	return $editor_settings;
    }

    The thing with this solution is that it’ll show the custom fields if the user has custom fields enabled. So I’d incline to use the first one, as the requirement that you shared is that you don’t want your users to manage custom fields.

    Best,
    Juan.

    Thank you for your suggestion and code. Unfortunately, it would need to be applied by numerous plugins to specifically support yours.

    It would be more practical for your plugin to modify all other plugins’ CPT registrations to add support for custom-fields since that is what your particular plugin requires. Many (probably most) plugins that register a CPT will utilize custom fields but not expose the core UI for users to manage their own fields, as the plugin will be providing its own input fields.

    Otherwise, you may want to not allow users to enable the block in your settings for a CPT that does not already have custom-fields enabled, since that will only result in an error and create confusion for the user. If you’re going to code that, though, it would make more sense to just add support for custom-fields to the existing CPT’s to achieve automatic compatibility with all plugins.

    Plugin Contributor Juan Aldasoro

    (@juanfra)

    Thanks for the follo2-up @stevengliebe!

    Appreciate the thoughts. For the time being, I’m gonna pass this to the team so that we can discuss it, as I’m not completely sure if Event Tickets should be the one modifying custom post types that are external to its structure. I understand your point, but I’m hesitant to mess up with data structures that are not from the plugin.

    In the meantime, I’ve created a snippet for you to try, with the approach that you suggested:

    https://gist.github.com/juanfra/136c514de294166243e9ab3246369376

    I hope this helps! ??

    Best,
    Juan

    Thank you, @juanfra. That’s very kind of you to put the code together. I’ll stick it in a plugin for @curlymop to install.

    Plugin Contributor Juan Aldasoro

    (@juanfra)

    My pleasure ??

    Thread Starter curlymop

    (@curlymop)

    Thank you very much to both of you,

    Looking forward to testing it out as soon as I get a free moment…

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘custom post types won’t load rsvp block’ is closed to new replies.