• Resolved chloelew

    (@chloelew)


    Hello,

    You are using the three following hooks: add_post_metadata, delete_post_metadata, updated_post_meta in one of your sensors.

    The last one is an add_action which has different parameters from the two others. Moreover, in the two add_filter you never return anything, meaning that the value returned will always be null.
    The issue is located in this file: https://github.com/WPWhiteSecurity/wp-activity-log/blob/7c90d2a13f97db00a6f2d5a6f5c6061d7eb2bce6/classes/Sensors/Content.php#L103

    The method: https://github.com/WPWhiteSecurity/wp-activity-log/blob/7c90d2a13f97db00a6f2d5a6f5c6061d7eb2bce6/classes/Sensors/Content.php#L665

    Could you please make a fix?

    add_filter( 'add_post_metadata', array( $this, 'check_created_deleted_meta' ), 10, 5 );
    		add_filter( 'check_created_deleted_meta', array( $this, 'check_changed_meta' ), 10, 5 );
    		add_action( 'updated_post_meta', array( $this, 'check_changed_meta' ), 10, 4 );
    
    /**
    	 * Check Page Template Update.
    	 *
             * @param bool|null $delete    Whether to allow metadata deletion of the given type.
    	 * @param int    $meta_id    ID of updated metadata entry.
    	 * @param int    $post_id    Post ID.
    	 * @param string $meta_key   Meta key.
    	 * @param mixed  $meta_value Meta value.
    	 */
    	public function check_created_deleted_meta( $delete, $meta_id, $post_id, $meta_key, $meta_value ) {
    		if ( ! $post_id ) {
    			return $delete;
    		}
    
    		switch ( $meta_key ) {
    			case '_wp_page_template':
    				$this->check_template_change( $post_id, $meta_value );
    				break;
    			case '_thumbnail_id':
    				$this->check_featured_image_change( $post_id, $meta_value );
    				break;
    			default:
    				// no other meta keys supported here.
    		} 
    return $delete; 
    
    	}
    
    /**
    	 * Check Page Template Update.
    	 *
    	 * @param int    $meta_id    ID of updated metadata entry.
    	 * @param int    $post_id    Post ID.
    	 * @param string $meta_key   Meta key.
    	 * @param mixed  $meta_value Meta value.
    	 */
    	public function check_changed_meta( $meta_id, $post_id, $meta_key, $meta_value ) {
    		if ( ! $post_id ) {
    			return;
    		}
    
    		switch ( $meta_key ) {
    			case '_wp_page_template':
    				$this->check_template_change( $post_id, $meta_value );
    				break;
    			case '_thumbnail_id':
    				$this->check_featured_image_change( $post_id, $meta_value );
    				break;
    			default:
    				// no other meta keys supported here.
    		}
    	}<code></code>
    
    

    Thanks!
    Best regards,
    Chloé

    • This topic was modified 4 years, 9 months ago by chloelew.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Danny Jones

    (@distinctivepixels)

    Hello @chloelew

    Thanks for getting in touch.

    We will be happy to add some returns here and iv made a note of this on our development log.

    If anything else pops up in the meantime do be sure to let us know.

    Kind regards, Daniel @ WP White Security

    Thread Starter chloelew

    (@chloelew)

    Hello @distinctivepixels ,
    Thanks a lot for your reply. Sounds great!
    Could you please notify me whenever a release with this fix is available ?
    Thanks again 🙂

    Best regards,
    Chloé

    Plugin Support robertabela

    (@robert681)

    Hello @chloelew

    When we release a new update of the plugin, if you have it installed on your website you will be notified of the updated. Otherwise, if you would like to know when a new update of the plugin is available, please follow our blog or subscribe to our newsletter.

    Thank you again for using our plugin. Should there be anything else we can help you with, please do not hesitate to ask.

    Have a great day.

    Hello,

    This ticket was not processed in the last release.
    The bug is still present.
    Could you please notify me whenever a release with this fix is available ?
    Thanks again 🙂

    Best,
    Alexandre

    Plugin Support robertabela

    (@robert681)

    Hello @asadowski10

    Thank you for your ticket.

    We have not released an update since this ticket was posted. So as we’ve told other users, you will be notified of the update on your website. You can also check the WP Activity Log plugin change log for a complete list of what is new, updated and fixed with every release update.

    Have a good day and thank you for using our plugin.

    • This reply was modified 4 years, 7 months ago by robertabela.
    Thread Starter chloelew

    (@chloelew)

    Hello @distinctivepixels @robert681

    If I am not mistaken I saw that you made some of the changes we suggested but unfortunately there is still one problem remaining. As mentioned above updated_post_meta is not a filter but an action, that has different parameters from the other hooks calling the same function check_changed_meta. Do you plan to fix this in the next release?
    Before updating our plugin we’d like to make sure this change was made.

    Thanks for your help

    Best regards,
    Chloé

    Danny Jones

    (@distinctivepixels)

    Hi @chloelew

    Thanks for letting us know – ill have this taken care of in the next release.

    Kind regards, Daniel @ WP White Security

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Issue with hook name and param callback’ is closed to new replies.