• Resolved Biyans

    (@biyanpasau)


    I’m using this plugin to retrieve data from member. The problem is when adding the shortcode [swpm_show_member_info column="expiry_date"], I couldn’t save the post/page. it says “Updating failed” with red bar at the top of the editor. When I close the editor and open the page again, I get this critical error: “There has been a critical error on this website.“.

    For record, I’m using the latest version of both Simple Membership (Version 4.1.2) and SWPM Show Member Info (Version 1.9) plugins.

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

    (@mbrsolution)

    Hi, I just finished carrying out a test in my dev site and it is working well for me.

    The following is a list of the current specs in my dev site.

    List:

    Thread Starter Biyans

    (@biyanpasau)

    Already done that. I disabled all plugin and switch the theme back to default, but the problem persisted. Any chance this might be caused by the PHP version? I’m using 8.0.17.

    Plugin Support mbrsolution

    (@mbrsolution)

    Thank you for sharing more information. I have submitted a message to the developers to investigate further your findings.

    Kind regards.

    Plugin Author wp.insider

    (@wpinsider-1)

    When you get a critical error, WP should send you an email with more details of what the exact error is (it usually refers to some files, functions and lines of code). Also, that will be added to your server’s error_log file. Can you post the error message so I have some reference to check in the code?

    Thread Starter Biyans

    (@biyanpasau)

    This is the error I get

    Warning: Attempt to read property "membership_level" on null in /bitnami/wordpress/wp-content/plugins/simple-membership/classes/class.swpm-utils.php on line 78
    
    Fatal error: Uncaught Exception: subcript_period parameter must be integer in SwpmUtils::calculate_subscription_period_days method in /bitnami/wordpress/wp-content/plugins/simple-membership/classes/class.swpm-utils.php:59 Stack trace: #0 /bitnami/wordpress/wp-content/plugins/simple-membership/classes/class.swpm-utils.php(82): SwpmUtils::calculate_subscription_period_days() #1 /bitnami/wordpress/wp-content/plugins/simple-membership/classes/class.swpm-utils-member.php(98): SwpmUtils::get_expiration_timestamp() #2 /bitnami/wordpress/wp-content/plugins/swpm-show-member-info/swpm-show-member-info.php(63): SwpmMemberUtils::get_expiry_date_timestamp_by_user_id() #3 /bitnami/wordpress/wp-content/plugins/swpm-show-member-info/swpm-show-member-info.php(38): swpm_smi_get_member_info_by_id() #4 /opt/bitnami/wordpress/wp-includes/shortcodes.php(356): swpm_smi_show_member_info() #5 [internal function]: do_shortcode_tag() #6 /opt/bitnami/wordpress/wp-includes/shortcodes.php(228): preg_replace_callback() #7 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(307): do_shortcode() #8 /opt/bitnami/wordpress/wp-includes/plugin.php(191): WP_Hook->apply_filters() #9 /opt/bitnami/wordpress/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(1811): apply_filters() #10 /opt/bitnami/wordpress/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(560): WP_REST_Posts_Controller->prepare_item_for_response() #11 /opt/bitnami/wordpress/wp-includes/rest-api/class-wp-rest-server.php(1143): WP_REST_Posts_Controller->get_item() #12 /opt/bitnami/wordpress/wp-includes/rest-api/class-wp-rest-server.php(990): WP_REST_Server->respond_to_request() #13 /opt/bitnami/wordpress/wp-includes/rest-api.php(519): WP_REST_Server->dispatch() #14 /opt/bitnami/wordpress/wp-includes/rest-api.php(2868): rest_do_request() #15 [internal function]: rest_preload_api_request() #16 /opt/bitnami/wordpress/wp-includes/block-editor.php(601): array_reduce() #17 /opt/bitnami/wordpress/wp-admin/edit-form-blocks.php(75): block_editor_rest_api_preload() #18 /opt/bitnami/wordpress/wp-admin/post.php(187): require('...') #19 {main} thrown in /bitnami/wordpress/wp-content/plugins/simple-membership/classes/class.swpm-utils.php on line 59
    
    There has been a critical error on this website. Please check your site admin email inbox for instructions.
    Plugin Author wp.insider

    (@wpinsider-1)

    Looks like the “subcript_period” field doesn’t have a valid value for this member (that you are testing with or viewing the page with.

    Check the membership level of the member/user account that you are viewing the page with. most likely the admin user. Then edit that membership level and view the subscription duration value that you have set for that level. Does it have a valid value? What value is set for the “Access Duration” field for that membership level?

    Thread Starter Biyans

    (@biyanpasau)

    The error isn’t on the user front-end, but on the page editor of the admin dashboard. Despite the update appeared to be failed, the value of the [expiry_date] is still displayed correctly for all user on the front-end. It’s just that when I try to edit the page again, the fatal error that I sent before will appear.

    Screenshot: https://i.postimg.cc/MZbDnX7p/Capture.jpg

    Perhaps this problem is on the instance I was using when installing WP, not the plugin. Thank you for helping anyway

    Plugin Author wp.insider

    (@wpinsider-1)

    Thank you. I understood that the error is when you update the post in the admin end. When you are updating post with a shortcode in it, there are some themes or plugins (example: page builder type plugins) that execute the shortcode still. So if your WP user that is editing the post also is connected to a member record (meaning you imported that wp user to our membership plugin), then it can throw that error if the membership level’s configuration is not as expected. It’s just one of the possibilities so I thought it’s best to check that.

    Thread Starter Biyans

    (@biyanpasau)

    I got it now, but still weird tho ??

    My account is the only admin and the only editor. I don’t have this account registered as a member in the plugin. Also, my theme is really basic, just like skeleton template and no builder plugin installed — really sure I don’t have any function that can execute this shortcode on admin end. I’m not experiencing this issues on the classic editor but only on Gutenberg.

    Since the shortcode is working just fine on member end, would be any update that instead of showing error and disable the post editor, it will execute a fallback like an empty value?

    Plugin Author wp.insider

    (@wpinsider-1)

    Just want to test one theory, can you please download a new copy of the addon (v2) from here and let me know if that one works better or not?
    https://simple-membership-plugin.com/simple-membership-addon-show-member-info/

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Can’t Save post When Adding [Expiry Date] Shortcode’ is closed to new replies.