Skip to:
Content
Pages
Categories
Search
Top
Bottom

Desactive / Remove last_activity metadata on user_meta


  • Maniou
    Participant

    @maniou

    Hello,

    Can you tell me if there is a simple way to prevent the mirroring of last_activity on user_meta table ?

    Thank you 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • I don’t know about “simple”. The function in BP is bp_update_user_last_activity() and that calls WordPress’ user meta functions. I am positive there are filters within that stack you could use to override the value or prevent the writes, but you’ll need to look into that code yourself.


    @boonebgorges
    Do you think we can stop this mirroring yet? And keep _bp_get_user_meta_last_activity_warning in place. Basically, preventing DB writes.


    Boone Gorges
    Keymaster

    @boonebgorges

    The simplest way to disable, at the moment, is to squelch the update_user_meta() call. Untested, but something like this should work:

    
    add_filter( 'update_user_metadata', function( $should_update, $object_id, $meta_key ) {
        if ( 'last_activity' === $meta_key ) {
            return false;
        }
    
        return $should_update;
    }, 10, 3 );
    

    I’ve opened a ticket to discuss disabling the backward compatibility feature in BP. https://buddypress.trac.wordpress.org/ticket/7882#ticket


    Maniou
    Participant

    @maniou

    Thank you very much 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar