I have a custom component on my site that emails users when a new post is created but I'm seeing a flaw in the design now that we are wanting to start using some other functionality. I created a group tonight and posted on the group and it hit my hook below which was surprising to me as I thought the wall only meant the main wall on the news feed, not any wall. So my question is,how can I add a "filters" to this hook or make it configurable to say hook the news feed wall post created vs. hook the groups wall post created.
function post_email() {
ossn_register_callback("wall", "post:created", "postEmailHandler");
}
Thanks,
Bryce
Similar
<?php
function post_email() {
ossn_register_callback("wall", "post:created", "postEmailHandler");
}
function postEmailHandler($callback, $type, $params) {
$wall = ossn_get_object($params['object_guid']);
if($wall && $wall->type == 'user'){
//will trigger for wall posts for homepage/userprofile etc not for groups
Do some junk here
}
if($wall && $wall->type == 'group' && function_exists('ossn_get_group_by_guid')){
$group = ossn_get_group_by_guid($wall->owner_guid);
if($group && $group->membership == OSSN_PUBLIC){
//something for group
}
}
}
So I had mixed results. When the group was set to closed I got no email, when the group was set to public I still got an email using the following code, any thoughts?
function post_email() {
ossn_register_callback("wall", "post:created", "postEmailHandler");
}
function postEmailHandler($callback, $type, $params) {
$wall = ossn_get_object($params['object_guid']);
if($wall && $wall->type == 'user'){
//will trigger for wall posts for homepage/userprofile etc not for groups
Do some junk here
}
}
you may do in your postEmailHandler
$wall = ossn_get_object($params['object_guid']);
if($wall && $wall->type == 'user'){
//will trigger for wall posts for homepage/userprofile etc not for groups
}
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)