Call add_worker() and add_service() functions in Appointments+

Disclaimer: I’m not a developer, but I can read/troubleshoot code.

Plugins: Buddypress & Appointments+

Desired Functionality: I’d like BP users to be able to schedule appointments with each other, but only if they’re “friends.”

What I think needs to happen (working backwards): To schedule an appointment with each other, all users need to also become service providers. To this end, I would like new users to become service providers at registration (or more specifically after activation of their account).

To accomplish this, on the bp-members-functions.php file (where the registration/activation content lives), I’ve added a line to include the appointments.php file. When a new user’s account is activated, this file sends an email to the site admin to notify them of the new registration. After this line, I’ve added two more lines:

add_worker( true, $user_id );

add_service( true, 1 );

I’ve passed 1 as the second parameter for add_service() because I only have one service.

Unfortunately, after I click the link in the registration email to activate my test account, I get an internal server error. When I log in with my admin account, the test user is a registered user, but they don’t become a service provider in the Appointments+ Service Provider list as I’d hoped.

(Note: I’ve also tried $this->add_worker( true, $user_id ); and $this->add_service (true, 1 ); with no luck).

Can anyone show me the error of my ways? I’d be very grateful.