Scheduler › Forums › BirchPress Scheduler › Hook/Filter post_get_birs_location
This topic contains 9 replies, has 3 voices, and was last updated by Luke 9 years, 3 months ago.
-
AuthorPosts
-
December 16, 2014 at 10:50 am #11211
Hi there,
I want to change the function which sets the Location for an appointment and use some custom fields instead. Can you please tell me, how to change the following function in includes/model/imp.php line 289
static function post_get_birs_location( $location ) { birch_assert( is_array( $location ) && isset( $location['post_type'] ) ); if ( isset( $location['post_title'] ) ) { $location['_birs_location_name'] = $location['post_title']; } return $location; }
I’m not able to handle the functions inside classes.
It’s pretty urgent so it would be great to get a answer ASAP.
Thanks,
Philipp
December 17, 2014 at 3:20 pm #11234Hi Philipp,
The location cannot be set with a value of custom field. Could you tell me what exactly you want to achieve?
December 18, 2014 at 5:23 am #11241Hi Luke,
I’m hiding the Custom Post Type “Location” as for my usage the customers have to choose the service first and then the provider. So instead of the CPT I’m using custom fields for “service” to save the information where to find it.
Everything is fine except the {location_name} tag, as it uses the title of the CPT “Location”. All I want to do is to modify how the {location_tag} is generated to let it use the custom fields instead.Best regards,
Philipp
December 18, 2014 at 9:20 am #11246Hi again,
just because I’m wondering. is there a changelog for version 2.7.6.B? I get an update notice but I’ve no idea what changed.Best regards,
Philipp
December 18, 2014 at 10:54 am #11248Hi Philip,
You could go to the Settings -> Form Builder page and edit the ‘Appointment Info’ block to modify the label of the Location field.
Regarding the changlog of version 2.7.6, we will post it as soon as possible.
December 18, 2014 at 1:38 pm #11249Hi Philipp,
Some bugs are fixed in V2.7.6. No new features are introduced.
December 30, 2014 at 2:57 am #11409Hi Luke & Jennifer,
thanks a lot for your replies. Unfortunately they don’t provide much information. I haven’t asked many questions but non of them got a useful answer. As I had to customize some functions inside the plugin files (there was no way to customize them with filters or hooks) I’m not sure whether it’s necessary for me to update to the latest version. Usually a short look to a changeling helps the users to see what files are changed and which bugs are fixed.
What I wanted to do is: I’m completely hiding the “location” and just added one default one. Then I added custom fields to the services with the information, where to find them. In eMails and ICS-Files, I want to show those custom fields instead of {location_name}. So now I did the following to adjust the output:
static function post_get_birs_location( $location ) { birch_assert( is_array( $location ) && isset( $location['post_type'] ) ); if ( isset( $location['post_title'] ) ) { $location['_birs_location_name'] = $location['post_title']; } /* |------------------------------------------------------------------------------------ | HWW EDIT START |------------------------------------------------------------------------------------ */ global $staff_destination; $destination_id = $_POST['birs_appointment_service']; if(!$destination_id){ $destination_id = $_GET['dest_id']; } if(!$destination_id && $staff_destination){ $destination_id = $staff_destination; } $hall = get_field('itb_hall', $destination_id); $hall_no = substr($hall, 0, strpos($hall, ' (')); $booth_no = get_field('itb_booth', $destination_id); $location['_birs_location_name'] = 'Hall '.$hall_no.', Booth '.$booth_no; /* |------------------------------------------------------------------------------------ | HWW EDIT END |------------------------------------------------------------------------------------ */ return $location; }
It works in most cases, but it would be great to just get the
$service_id
in this function. I hadn’t success to achieve this.Best regards,
Philipp
December 30, 2014 at 4:51 pm #11441Hi Philipp,
Please hook to the ‘birchschedule_model_mergefields_get_appointment1on1_merge_values’ filter to change the values of merge tags. The code should be like this.
add_filter('birchschedule_model_mergefields_get_appointment1on1_merge_values', 'your_function', 20, 2);
function your_function($appointment1on1, $appointment1on1_id) {
//$appointment1on1 is an array with all info of an appointment.
//modify $appointment1on1 here.
return $appointment1on1;
}
January 22, 2015 at 3:00 am #11890Thank’s Luke. That was very helpful. It would be great to get a list of filter and hooks. Otherwise we’re forced to spend and waste a lot of time into searching and asking for them. BirchPress is a solid base for more complex appointment solutions, but for that we urgently need the list of filters and hooks.
Cheers,
Philipp
January 22, 2015 at 12:57 pm #11893Please check out this topic for how to find hooks.
http://www.birchpress.com/forums/topic/capturing-appointment-info
-
AuthorPosts
The forum ‘BirchPress Scheduler’ is closed to new topics and replies.