0

By default, WordPress uses the version information provided in ../civicrm/civicrm.php. However, the batch number is missing here:

<?php
/*
Plugin Name: CiviCRM
Description: CiviCRM - Growing and Sustaining Relationships
Version: 4.7
Author: CiviCRM LLC
Author URI: http://civicrm.org/
Plugin URI: http://wiki.civicrm.org/confluence/display/CRMDOC/WordPress+Installation+Guide+for+CiviCRM+4.7
License: AGPL3
Text Domain: civicrm
Domain Path: /languages
*/

WordPress uses the following code to extract the version information from a plugin:

$data = get_plugin_data("~/civicrm/civicrm.php");
$version = $data['Version'];

I am using this functionality to automate keeping track of my fixes until CiviCRM and other plugins make the necessary corrections in the next release.

Would it be possible to update civicrm.php to add the batch number? So, it will return 4.7.12 instead of 4.7.

1

You can get the more granular CiviCRM version data with:

$version_file = CIVICRM_PLUGIN_DIR . 'civicrm/civicrm-version.php';
if ( file_exists( $version_file ) ) {
    require_once $version_file;
    $civicrm_version = civicrmVersion();
}
11
  • This does not fix the fact that WordPress is looking for the version information in the header when it displays it on the plugin page.
    – Codedogs
    Dec 5 '16 at 14:03
  • True, but what problem does that solve that the code above does not? Dec 6 '16 at 14:41
  • Having the WordPress plugin page display the entire version number is the problem I would like solved. Then I can give CiviCRM code that can be adapted to allow WordPress to update CiviCRM via the plugin page. No more coping and extracting of zip files. Wouldn't that be an improvement.
    – Codedogs
    Dec 7 '16 at 17:28
  • It would. I'd be very interested to hear your strategy for doing this. Dec 9 '16 at 23:26
  • My strategy is based on the following article: article link. It consists of one class that needs to be added to the plugin and a web page to respond to the WordPress requests. The code involves implementing 2 filters pre_set_site_transient_update_plugins and plugins_api. I'd be happy to answer any questions you have.
    – Codedogs
    Dec 10 '16 at 23:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.