| Example |
<?php
/*
* smpush_events_newpost_message : @params($message, $postid)
* smpush_events_newpost_payload : @params($postid, $message)
* smpush_events_newpost_settings : @params($settings, $message, $postid)
* smpush_events_apprpost_message : @params($message, $postid)
* smpush_events_apprpost_payload : @params($postid, $message)
* smpush_events_apprpost_settings : @params($settings, $message, $postid)
* smpush_events_postupdated_message : @params($message, $postid)
* smpush_events_postupdated_payload : @params($postid, $message)
* smpush_events_postupdated_settings : @params($settings, $message, $postid)
* smpush_events_approvecomment_message : @params($message, $postid, $commentid)
* smpush_events_approvecomment_payload : @params($postid, $message, $commentid)
* smpush_events_approvecomment_settings : @params($settings, $message, $postid, $commentid)
* smpush_events_user_reply_touser_message : @params($message, $postid, $commentid)
* smpush_events_user_reply_touser_payload : @params($postid, $message, $commentid)
* smpush_events_user_reply_touser_settings : @params($settings, $message, $postid, $commentid)
* smpush_events_newcomment_message : @params($message, $postid, $commentid)
* smpush_events_newcomment_payload : @params($postid, $message, $commentid)
* smpush_events_newcomment_settings : @params($settings, $message, $postid, $commentid)
*/
add_filter('smpush_events_newpost_message', 'smpush_events_newpost_message', 10, 2);
add_filter('smpush_events_newpost_payload', 'smpush_events_newpost_payload', 11, 2);
add_filter('smpush_events_newpost_settings', 'smpush_events_newpost_settings', 12, 2);
function smpush_events_newpost_message($message, $postid){
$categories = get_the_category($postid);
$message = $message.' from category '.$categories[0]->cat_name;
return $message;
}
function smpush_events_newpost_payload($postid, $message){
$payload = array(
'post_id' => $postid,
'cat_id' => $categories[0]->cat_ID,
'cat_name' => $categories[0]->cat_name,
);
return $payload;
}
function smpush_events_newpost_settings($settings, $message, $postid){
$settings = array(
'message' => '',
'feedback' => 0,//bool: feedback service for iOS & Android
'expire' => 0,//message expire time in hours
'ios_slide' => '',//iOS slide phrase
'ios_badge' => 0,
'ios_sound' => 'default',
'ios_cavailable' => 0,
'ios_launchimg' => '',
'extra_type' => '',//normal or json
'extravalue' => '',//normal string or JSON string
'and_extra_type' => '',//normal or json
'and_extravalue' => ''//normal string or JSON string
);
return $settings;
}
?>
|