Open YiorgosTheo opened 10 years ago
Could you maybe give a reference to where in the code this issue is located @YiorgosTheo ?
/ includes / class-remote-notification-client.php line 212
I see. By changing $pt = get_post_type();
, the method won't be able to take the notice limitation into account. This means that if you set a limitation by post type in your notification server if will be bypassed on the client.
What exactly is not working with the original version? Do you get a PHP error message? And what about the transient? This is not related to the transients. Or did I miss something?
When a Notification is created on the server, it is not displayed on the client dashboard. Lookind at the db, I see that the notification has been received and is stored in the options table on the client db as shown here: http://postimg.org/image/5slq61qfx/
But $pt = get_post_type();
returns empty, I did a var_dump() and shows NULL
Using $pt = ( $content->type[0] );
fetches the notification type and allows it to pass the conditional on line 219 and proceed to display the notification in the dashboard
The strange part is that this check shouldn't be ran at all. The type
of your notification is empty and this check only runs if there are types set in the object. Could you try to var_dump( $content->type )
and see what the output is? It should normally show an empty string.
var_dump( $content->type )
returns array(1) { [0]=> string(12) "notification" }
and var_dump( $content->type[0] )
returns string(12) "notification"
as expected
So you did add a post type limitation on the notification server with the value notification
for this specific notification right?
correct, and is stored as it should on the client-side db as shown in the image I uploaded above, it's just that the type is not fetched with $pt = get_post_type();
So you do have a post type notification
on the client site right? Sorry if it sounds like a dumb question but I need to understand your environment ;)
yes, see my edited answer above
Alright then I should probably run a few tests to see what's not working with the post type limitation. It could be due to the fact that there is no $post
object defined where you are. Actually using get_post_type()
might not be the best idea.
this is a nice tool, saves me the trouble of emailing customers every time there's an update and emails getting lost, trapped in spam folders, etc...
I was having a problem on the client side with WP4.0, wouldn't get the transient from the db using:
$pt = get_post_type();
Changed it to:
$pt = ( $content->type[0] );
and works fine.The db entry looks like this:
O:8:"stdClass":6:{s:5:"title";s:19:"Notification Test 1";s:7:"message";s:27:"This is a test notification";s:4:"slug";s:19:"notification-test-1";s:6:"expiry";s:0:"";s:4:"type";a:1:{i:0;s:12:"notification";}s:5:"style";s:7:"updated";}