Skip to content

Instantly share code, notes, and snippets.

@shamsbd71
Created October 21, 2020 06:42
Show Gist options
  • Save shamsbd71/2b7b837c729eff68b7d10477d7508559 to your computer and use it in GitHub Desktop.
Save shamsbd71/2b7b837c729eff68b7d10477d7508559 to your computer and use it in GitHub Desktop.
Paid extensions auto release & update with authentication for Joomla with Digicom

Joomla Extensions Selling and Validating Guide with Digicom Release System

Step 1:

Add update server info to your extensions installation mainfest xml.

Change name="Notifly Update Site", ##YOUR_PRODUCT_ID## with your info

Step 2

Check the config.xml and add the license part in your component or plugin. in this example we have shown the component system.

Step 3

check the file plg_system.php. this is your joomla system plugin, you can do it anyhow. But what you have to do is: add your license info to _update_sites table. follow the code, it shows how you need to store it on db.

Thank you

<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset
name="common"
label="License"
description="Fill the form to validate your purchase and get auto update."
>
<field
name="username"
type="text"
default=""
size="30"
label="Username"
description ="Your username at our site."
/>
<field
name="key"
type="text"
default=""
size="30"
class="input-large"
label="Key"
description ="Your key at our site. Get it from your Dashboard of our site after login."
/>
</fieldset>
<fieldset
name="permissions"
label="JCONFIG_PERMISSIONS_LABEL"
description="JCONFIG_PERMISSIONS_DESC"
>
<field
name="rules"
type="rules"
label="JCONFIG_PERMISSIONS_LABEL"
validate="rules"
filter="rules"
component="com_notifly"
section="component"
/>
</fieldset>
</config>
<updateservers>
<!-- Note: No spaces or linebreaks allowed between the server tags -->
<server type="extension" priority="1" name="Notifly Update Site"><![CDATA[https://www.yoursite.com/index.php?option=com_digicom&task=responses&source=release&format=xml&provider=joomla&pid=##YOUR_PRODUCT_ID##]]></server>
</updateservers>
<?php
/**
* @package Digicom Release Auth Integration
* @subpackage System.plugin.joomla
*
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
public function onExtensionAfterSave($option, $data) {
if ( ($option == 'com_config.component') && ( $data->element == 'com_notifly' ) ) {
$params = new JRegistry;
$params->loadString($data->params);
$username = $params->get('username');
$key = $params->get('key');
if(!empty($username) and !empty($key) )
{
$extra_query = 'username=' . urlencode($username);
$extra_query .='&amp;key=' . urlencode($key);
$db = JFactory::getDbo();
$fields = array(
$db->quoteName('extra_query') . '=' . $db->quote($extra_query),
$db->quoteName('last_check_timestamp') . '=0'
);
// Update site
$query = $db->getQuery(true)
->update($db->quoteName('#__update_sites'))
->set($fields)
->where($db->quoteName('name').'='.$db->quote('Notifly Update Site'));
$db->setQuery($query);
$db->execute();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment