I want to show posts/businesses/events on a map. I would like to ask users entering posts etc to be able to position them on a map. This could either replace the Location field or be associated with it.
Do I have to recognise new entities and objects to ask user? Ideally, I want to replace the Mapbox links, but that seems to involve a few small changes to the code.
Great! Appreciate your comments so far.
I aim to use these callbacks to manage the locations of these items shown on maps.
Peter,
in doubt just have a look into the class file. And you'll find that in OssnEntities.php
the callback gets triggered as
ossn_trigger_callback('delete', 'entity', $vars);
And that's why the registration accordingly has to be
ossn_register_callback('delete', 'entity', 'mycomponentcb');
, and not the other way round.
That is correct callback there is no error. Each callback have own type of parameters so putting them in one function is a mistake like i showered you below unless you know what you wanted to do.
I just don't understand what these have to do with your initial question about locations?
I note that the documentation for Entity after delete shows a callback ossn_register_callback('delete', 'entity', 'my_component_cb');
This is different to all the others in that the action 'delete' appears in a different order to other similar calls! Should it not be ossn_register_callback('entity', 'delete', 'my_component_cb');
?
Sorry Arsalan and thank you for your patience. I took things on too quickly.
But I note that the following don't have an ossn_register_callback function.
It does have a callback and yes you can combine it into one callback.
Example
<?php
function my_component_init(){
ossn_register_callback('object', 'created', 'my_component_cb');
ossn_register_callback('object', 'delete', 'my_component_cb');
}
function my_component_cb($callback, $type, $args){
if($type == 'delete'){
//
}
if($type == 'created'){
//
}
}
I will need to use the callbacks noted in the documentation, but I note that the following don't have an ossnregistercallback function.
A callback triggered after object is created
Callback of object after deletation
Callback triggerd when entity is created
A callback triggered after object is created
Is this correct?
Also, please let me know if I may combine some of these calls into one script?
Thank you. Naturally, I wish to avoid editing existing code and want to minimise that.
Yes you can use new location facility instead of mapbox. You don't need to recognize old entries. For the new location module you need to bind it to location field and handle the client side. Everything will involve a change either new or edit.
Due to the many requests in the past for additonal features and components we have decided to develope a premium version. Features like Hashtags, Videos, Polls, Events, Stories, Link Preview, etc included in it.
$199 (Life Time)