Support » Plugin: Groups » Use class method as action hook

  • I want to trigger a custom function when the “groups_file_served” gets called. This happens when a user downloads file on our site.

    Essentially something like add_action( array( “Groups_File_Access”, “groups_file_served” ), “my_custom_function” ) );

    How can I use the class method from this plugin as an action hook?

Viewing 1 replies (of 1 total)
  • Hi @anvi7924,
    I suppose you’re using Groups File Access. Please have a look at the documentation page.
    You can do something like this:

    add_action( 'groups_file_served', 'your_custom_groups_file_served', 10, 2 );
    function your_custom_groups_file_served( $file_id, $user_id ) {
      // Do something ....
    }

    Kind Regards,
    Antonio B.

Viewing 1 replies (of 1 total)
  • The topic ‘Use class method as action hook’ is closed to new replies.