bamadesigner / rock-the-slackbot

A WordPress plugin that helps you stay on top of changes by sending notifications straight to you and your team inside your Slack account.
https://wordpress.org/plugins/rock-the-slackbot/
GNU General Public License v2.0
55 stars 13 forks source link

Incorrect plugin and theme update notifications #8

Open ntwb opened 8 years ago

ntwb commented 8 years ago

After a plugin has been updated this is what is seen: • The following WordPress plugin has been updated by admin on the sp.dev website at http://sp.dev.The following WordPress theme has been updated by admin on the sp.dev website at http://sp.dev.

When a plugin update is available works as expected, though no notification is seen for a theme update being available. Per the screenshot below I would have expected to see a similar notification for the theme similar to the plugin notification, I also expect that both the plugin and theme updated notifications should be more verbose.

screen shot 2016-02-26 at 6 24 40 pm

Note: I tested both a plugin and theme my manually lowering the version number in the plugin/theme manually and then updating via the normal WordPress process

briandeconinck commented 7 years ago

@bamadesigner Have you had a chance to look at this at all?

texinick commented 7 years ago

@briandeconinck Until an update is available, I resolved this issue on my WP installation by changing the following in wp-content/plugins/rock-the-slackbot/includes/hooks.php:

On line 821, change:

if ( 'core' != $upgrade_type ) {

to

if ( 'core' == $upgrade_type ) {

The above forces Rock the Slackbot into the correct part of the code, but will then cause a problem when updating a theme, so in order to at least make it work, I did the following:

On line 866, I changed:

$previous_version = ( 'plugin' == $upgrade_type) ? ( ! empty( $item_pre_upgrade_info['Version'] ) ? $item_pre_upgrade_info['Version'] : false ) : $item_pre_upgrade_info->get( 'Version' );

to

$previous_version = ( 'plugin' == $upgrade_type || 'theme' == $upgrade_type) ? ( ! empty( $item_pre_upgrade_info['Version'] ) ? $item_pre_upgrade_info['Version'] : false ) : $item_pre_upgrade_info->get( 'Version' );

Now the plugin and theme update notifications work.