Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] bp_activity_posted_update hook not working


  • megin
    Participant

    @megin

    function add_meta_to_activity( $content, $user_id, $activity_id ) {
    
        bp_activity_update_meta( $activity_id, 'option1', $_POST['option1'] );
    
    }
    add_action( 'bp_activity_posted_update', 'add_meta_to_activity', 10, 3 );

    bp_activity_posted_update hook is not working in my site. I wrote this function inside wp-content/bp-custom.php file. Anyone please give the solution for this

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

  • danbp
    Moderator

    @danbp

    Hi @megin,

    please use the code button when you publish code !

    Do you really use wp-content/bp-custom.php ? If YES, it’s wrong.
    bp-custom.php should be in wp-content/plugins/bp-custom.php

    But no idea about your function, sorry.


    megin
    Participant

    @megin

    Hi @danbp,

    Thank you for your reply.
    I wrote bp-custom.php inside the folder( wp-content/plugins/).

    I would link to add extra field inside the file( buddypress/bp-themes/bp-default/activity/post-form.php) and need to insert that value on the table (wp_bp_activity_meta). I wrote the function for this purpose. Unfortunately its not working. please help.

    function add_meta_to_activity( $content, $user_id, $activity_id ) {
    
        bp_activity_update_meta( $activity_id, 'option1', $_POST['option1'] );
    
    }
    add_action( 'bp_activity_posted_update', 'add_meta_to_activity', 10, 3 );

    megin
    Participant

    @megin

    Got the solution.

    using bp_groups_posted_update instead of bp_activity_posted_update.

    function add_meta_to_activity( $content, $user_id, $activity_id ) {
    
    bp_activity_update_meta( $activity_id, ‘option1’, $_POST[‘option1’] );
    
    }
    add_action( ‘bp_groups_posted_update’, ‘add_meta_to_activity’, 10, 4 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar