ThemeAvenue / Remote-Dashboard-Notifications

A plugin for WordPress developers who want to communicate with their users
http://themeavenue.github.io/Remote-Dashboard-Notifications
GNU General Public License v2.0
37 stars 10 forks source link

not showing any notifications #7

Closed codeagencybe closed 8 years ago

codeagencybe commented 8 years ago

Hi,

I have installed the plugin properly, but I'm not able to show any notifications on client site. I have added the few lines of code to my child theme functions.php but nothing shows up I'm also using the correct channel id's and keys. But there are also no errors, so I'm quite sure everything fine at client side but not about server side.

I have created 2 notifications, a few channels on the server site, no post type limitation so they should be visible.

In your documentation here on github, it says $notification = new TAV_Remote_Notification_Client(274,'0f0201703ea31bd6', 'http://url.com**?post_type=notification**');

On your own website is says same without ?post_type=notification in url $notification = new TAV_Remote_Notification_Client(274,'0f0201703ea31bd6', 'http://url.com');

So which one is correct or do I need to add something more to get this working?

Thanks!

julien731 commented 8 years ago

Good point. The docs should be updated. Using the domain name (without the ? part) is fine. If you've added the ? part though the script is backwards compatible.

Regarding the issue, can you confirm that you've added the client file class-remote-notification-client.php to your theme?

codeagencybe commented 8 years ago

OK, thanks for the feedback!

Yes, I have added that file into my child theme folder directly and main theme folder but not working. Unless it has to be somewhere else specific? /themes/includes/ ??

schermafdruk 2016-04-20 14 41 38
julien731 commented 8 years ago

As long as you load the file using include() or require() there is no specific location. You did load it right?

codeagencybe commented 8 years ago

Yes, I have following lines in my functions.php in child theme:

schermafdruk 2016-04-20 14 57 09

I'm running LEMP stack with varnish on VPS cloud server. Could varnish perhaps interfere?

julien731 commented 8 years ago

Ok. Sorry to ask the basic questions but I need to make sure the problem is somewhere else ;)

Could you please install Query Monitor on your site and inspect the HTTP queries (it will display in your admin bar).

codeagencybe commented 8 years ago

No problems with that. At least, this is the only thing I can find regarding remote-notifications

schermafdruk 2016-04-20 15 07 36

Yes it's 3x there because I pull notifications from 3 different channels (client specific, general updates, server maintenance). Unless there is a better way to handle this?

julien731 commented 8 years ago

This means the class is indeed in use. Could you please check the HTTP requests, though. See the image attached.

image

codeagencybe commented 8 years ago

Strange, that's completely empty at my side while the function is called from withing child theme :/

schermafdruk 2016-04-20 15 25 28
julien731 commented 8 years ago

That's ok. It just means that there are no HTTP requests done at this particular page load.

Next step, and sorry for yet another plugin, could you:

codeagencybe commented 8 years ago

Done, http requests are still empty. No records at all.

codeagencybe commented 8 years ago

This is what's running on server side:

schermafdruk 2016-04-20 15 49 54
codeagencybe commented 8 years ago

Hi Julien, Any idea about this? If you add that line with my details, do you get a http req response back or can you see the message in your dashboard?

Again, I'm using a LEMP stack server with varnish and memcached. Could be it that something from caching is blocking this from server side setup? I do have cleared cache to make sure I have latest info, but still nothing. I'm also using a security plugin (iThemes Security Pro) and I have blocked xml-rpc completely. Not sure if that is interfering, but any other API connection (like Woo iOS app) if working perfectly fine with xml-rpc turned off completely.

Thanks for your feedback!

codeagencybe commented 8 years ago

Hi Julien,

Any update so far?

julien731 commented 8 years ago

Hey Fabio. Sorry for not replying earlier. I am currently working on an update for RDN and I hope this will fix your issue. Sorry to have you wait but I hope to be finished next week.

julien731 commented 8 years ago

Hi Fabio. I just released a new version. Would you mind updating and trying with v1.3.0? https://github.com/ThemeAvenue/Remote-Dashboard-Notifications/releases/tag/1.3.0

codeagencybe commented 8 years ago

Hi Julien,

Yes, now the messages are showing but another issue arises. I have created 2 test messages to check if everything was working. Now I have deleted these 2 messages from server and created 1 new "official" message but all my client sites keep showing the 2 old messages and my new message is not showing. I already have clear cache (browser, server - varnish) but the 2 old messages don't go away. Also, clicking the "X" button at client side to close the message is not working.

julien731 commented 8 years ago

That is most likely due to the transient being used for caching things (and reducing the amount of HTTP requests).

In order to clear that, you can use WP Sweep on your client sites and use the "Clear Transients" (or something like that) option.

Regarding the notices, not closing, can you confirm that you updated the client class class-remote-notification-client.php on your client sites?

codeagencybe commented 8 years ago

Hi Julien,

I did clear all the transients (I'm using a different premium plugin but it does the same result). Even when I add a NEW client to pull messages from server, it still keeps loading the old messages. There can not be any transients for that site, and yet it pulls old data.

Yes, I have updated also the client class at client website. I have overwritten the file in child theme and clear all cache client side and server side.

julien731 commented 8 years ago

I'll have to check if there is a problem with the posts order on the server side then. That could explain the fact that you're getting old posts.

For the notice dismissal it is quite weird though. I did test it earlier and it was working. FYI, the dismissal is per user if it makes any difference.

codeagencybe commented 8 years ago

I'm going to reboot my VPS server, just to make sure there is no server side caching issue. Another thing I noticed, the message does not respect my markup at server side.

I made a few paragraphs, but it just adds everything after eachother. Screenshots:

schermafdruk 2016-04-27 15 58 42 schermafdruk 2016-04-27 15 58 35
codeagencybe commented 8 years ago

Hi Julien, Now the messages are showing up on some client sites. Not all yet, but perhaps it could be due to cache sync at background. I'm using Varnish + memcached at all my vps servers, so it could be the cause for longer displaying the old information. Can you tell me if there any specific files that I should never cache? I can make some exclusion rules so new info can popup immediately.

Thanks!

julien731 commented 8 years ago

Well, the new version makes everything go through an Ajax process so there shouldn't be caching issues. I'm not sure there is something specific to setup here.

Regarding the layout it doesn't look great indeed. I'll have a look at it. Might need to pass the content through wpautop().

codeagencybe commented 8 years ago

Hi Julien,

I have setup a new and seperate "notification server" on a test environment and created a very small client-side plugin to make it more easy to deploy to several client websites via iThemes Sync or mainWP.

The only thing that is still not OK, is the output. It doesn't respect the formatting from serverside editor. Also, the title is not visible at client side. Somewhere it's forgotten. It starts immediately with the content.

Side note: can your plugin also handle rich content/media? E.g., let's assume I put some Youtube video code at server server to show a simple tutorial to explain a new feature, will it also be available at client side? What about a contact7 form? If I put in the shortcode at server side to ask e.g. a survey about customer satisfaction, will the form be working nicely at client side? This could bring a lot more possibilities like showing a download URL to some PDF file (from server side), showing an image(s), ...

codeagencybe commented 8 years ago

Hello Julien,

Is it possible to get the channel ID and key via the client automatically based on the domain name? I'll explain why:

I have 3 channels: 2 channels are "global" for all client sites (to show general scheduled maintenance and server maintenance) and 1 is client specific to show messages only for that client.

At server side I'm using the domainname as channel name like: client1domainname.com client2domainname.com etc...

It would be interesting to send a a req with domain name from client site and do something like this in the client side plugin:

//Get rid of www $client_domain_name = preg_replace('/^www./','',$_SERVER['SERVER_NAME']);

require( 'class-remote-notification-client.php' ); if ( function_exists( 'rdnc_add_notification' ) ) { //code here to collect channel ID and key for $client_domain_name $client_channel_ID = ???? $client_channel_key = ????? rdnc_add_notification( $client_channel_ID, $client_channel_key, 'http://myupdateserver.com' ); }

What do you think?

julien731 commented 8 years ago

Regarding formatting, I created #10

Regarding rich content, this is not something we will implement. This plugin was only designed to give short notifications to a client site without altering the client's experience. We believe that adding rich content would start to degrade the experience.

Finally, regarding the channel ID & key, this will not be possible either. The channel ID is the one constant that allows fetching the channel, and the key is a (simple) authentication key, which means that it shouldn't be given by the server or it loses all its purpose.

Even if we were to automatically fetch the channel ID only, it wouldn't be safe enough because a channel name can be changed. We absolutely need a constant here, and only the channel ID is a constant in this scenario.

codeagencybe commented 8 years ago

Hi Julien,

Thanks! Looking forward for the solution so the formatting is right.

Yes, regarding rich content you are right. It's off-track from the original idea/purpose for this plugin. But I like the idea though for such plugin than can distribute content directly into client website dashboard. It could also serve as some kind of education/tutorial system for new clients rolling into WP. Perhaps this can be a foundation for a new idea/plugin in the future. For now, I focus on the simple notifications to alert clients about upcoming maintenance and updates.

About channel ID & key, you are right too. I didn't think of the security hole for that. I'm going to try to create an admin page for my client plugin to manage the channels via WP backend instead of modifying the plugin file. 2 channels will be default always included hard coded, the other one (or even extra's) can be added via backend management page by filling in a 2 field form for channel ID and key and stored in DB.