Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add few refactoring changes. split to two plugins

  • Loading branch information...
commit 2510bf01bb13b277d304026c200b0ce2dbfc22b0 1 parent 5b5b84a
Marek Handze authored
Showing with 241 additions and 79 deletions.
  1. 0  administrator/components/com_jomsocialgroupsync/access.xml
  2. 0  administrator/components/com_jomsocialgroupsync/config.xml
  3. +1 −1  administrator/components/com_jomsocialgroupsync/controller.php
  4. 0  administrator/components/com_jomsocialgroupsync/controllers/index.html
  5. +1 −1  administrator/components/com_jomsocialgroupsync/controllers/synchronizationrule.php
  6. +1 −1  administrator/components/com_jomsocialgroupsync/controllers/synchronizationrules.php
  7. 0  administrator/components/com_jomsocialgroupsync/helpers/index.html
  8. +6 −6 administrator/components/com_jomsocialgroupsync/helpers/jomsocialgroupsync.php
  9. 0  administrator/components/com_jomsocialgroupsync/index.html
  10. +1 −1  administrator/components/com_jomsocialgroupsync/jomsocialgroupsync.php
  11. +56 −0 administrator/components/com_jomsocialgroupsync/jomsocialgroupsync.xml
  12. +1 −1  administrator/components/com_jomsocialgroupsync/models/fields/custom_field.php
  13. 0  administrator/components/com_jomsocialgroupsync/models/fields/index.html
  14. 0  administrator/components/com_jomsocialgroupsync/models/forms/index.html
  15. +6 −6 administrator/components/com_jomsocialgroupsync/models/forms/synchronizationrule.xml
  16. 0  administrator/components/com_jomsocialgroupsync/models/index.html
  17. +1 −1  administrator/components/com_jomsocialgroupsync/models/synchronizationrule.php
  18. +1 −1  administrator/components/com_jomsocialgroupsync/models/synchronizationrules.php
  19. +53 −0 administrator/components/com_jomsocialgroupsync/script.php
  20. +1 −1  administrator/components/com_jomsocialgroupsync/sql/install.mysql.utf8.sql
  21. 0  administrator/components/com_jomsocialgroupsync/sql/uninstall.mysql.utf8.sql
  22. 0  administrator/components/com_jomsocialgroupsync/tables/index.html
  23. +1 −1  administrator/components/com_jomsocialgroupsync/tables/synchronizationrule.php
  24. 0  administrator/components/com_jomsocialgroupsync/views/synchronizationrule/index.html
  25. +3 −3 administrator/components/com_jomsocialgroupsync/views/synchronizationrule/tmpl/edit.php
  26. 0  administrator/components/com_jomsocialgroupsync/views/synchronizationrule/tmpl/index.html
  27. +1 −1  administrator/components/com_jomsocialgroupsync/views/synchronizationrule/view.html.php
  28. 0  administrator/components/com_jomsocialgroupsync/views/synchronizationrules/index.html
  29. +5 −5 administrator/components/com_jomsocialgroupsync/views/synchronizationrules/tmpl/default.php
  30. 0  administrator/components/com_jomsocialgroupsync/views/synchronizationrules/tmpl/index.html
  31. +1 −1  administrator/components/com_jomsocialgroupsync/views/synchronizationrules/view.html.php
  32. +2 −2 administrator/language/en-GB/en-GB.com_jomsocialgroupsync.ini
  33. 0  administrator/language/en-GB/en-GB.com_jomsocialgroupsync.sys.ini
  34. BIN  com_jomsocialgroupsync.zip
  35. +1 −0  jomsocialgroupsync.xml
  36. +1 −0  plugins/community/jomsocialgroupsync/index.html
  37. +74 −0 plugins/community/jomsocialgroupsync/jomsocialgroupsync.php
  38. +18 −0 plugins/community/jomsocialgroupsync/jomsocialgroupsync.xml
  39. 0  plugins/system/jomsocialgroupsync/index.html
  40. +5 −46 plugins/system/jomsocialgroupsync/jomsocialgroupsync.php
  41. 0  plugins/system/jomsocialgroupsync/jomsocialgroupsync.xml
View
0  administrator/components/com_jomsocialgroupsync/access.xml 100644 → 100755
File mode changed
View
0  administrator/components/com_jomsocialgroupsync/config.xml 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/controller.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
View
0  administrator/components/com_jomsocialgroupsync/controllers/index.html 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/controllers/synchronizationrule.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access
View
2  administrator/components/com_jomsocialgroupsync/controllers/synchronizationrules.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access.
View
0  administrator/components/com_jomsocialgroupsync/helpers/index.html 100644 → 100755
File mode changed
View
12 administrator/components/com_jomsocialgroupsync/helpers/jomsocialgroupsync.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access
@@ -39,7 +39,7 @@ public static function getActions()
return $result;
}
-
+
/**
* Get Joomla ACL Group
*
@@ -62,11 +62,11 @@ public static function getJGroupName( $jgroupid )
* @return string
* @since 1.6
*/
- public static function getCGroupName( $cgroupid )
+ public static function getJSGroupName( $jsgroupid )
{
$db = JFactory::getDbo();
- $db->setQuery("SELECT name FROM #__community_groups WHERE id = $cgroupid");
- $cGroupName = $db->loadResult();
- return $cGroupName;
+ $db->setQuery("SELECT name FROM #__community_groups WHERE id = $jsgroupid");
+ $jsGroupName = $db->loadResult();
+ return $jsGroupName;
}
}
View
0  administrator/components/com_jomsocialgroupsync/index.html 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/jomsocialgroupsync.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
View
56 administrator/components/com_jomsocialgroupsync/jomsocialgroupsync.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<extension type="component" version="1.6.0" method="upgrade">
+ <name>JomSocialGroupSync</name>
+ <creationDate>2011-07-23</creationDate>
+ <copyright>Copyright (C) 2011. All rights reserved.</copyright>
+ <license>GNU General Public License version 2 or later; see LICENSE.txt</license>
+ <author>Brian Shaughnessy</author>
+ <authorEmail>brian@lcdservices.biz</authorEmail>
+ <authorUrl>www.lcdservices.biz</authorUrl>
+ <version>1.0.0</version>
+ <description>Sync JomSocial groups with Joomla ACL groups. Using this tool you can dynamically manage access control based on JomSocial group subscription.</description>
+
+ <scriptfile>script.php</scriptfile>
+
+ <install> <!-- Runs on install -->
+ <sql>
+ <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
+ </sql>
+ </install>
+ <uninstall> <!-- Runs on uninstall -->
+ <sql>
+ <file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
+ </sql>
+ </uninstall>
+
+ <files folder="components/com_jomsocialgroupsync">
+ <filename>index.html</filename>
+ </files>
+
+ <administration>
+ <menu link="option=com_jomsocialgroupsync&amp;view=synchronizationrules" view="synchronizationrules" img="class:component" alt="JomSocial Group Sync">COM_JOMSOCIALGROUPSYNC</menu>
+ <files folder="administrator/components/com_jomsocialgroupsync">
+ <filename>access.xml</filename>
+ <filename>config.xml</filename>
+ <filename>controller.php</filename>
+ <filename>index.html</filename>
+ <filename>jomsocialgroupsync.php</filename>
+ <folder>controllers</folder>
+ <folder>helpers</folder>
+ <folder>models</folder>
+ <folder>sql</folder>
+ <folder>tables</folder>
+ <folder>views</folder>
+ </files>
+ <languages folder="administrator/language/en-GB">
+ <language tag="en-GB">en-GB.com_jomsocialgroupsync.ini</language>
+ <language tag="en-GB">en-GB.com_jomsocialgroupsync.sys.ini</language>
+ </languages>
+ </administration>
+
+ <plugins>
+ <plugin folder="plugins/system" plugin="jomsocialgroupsync" name="JomSocial Group Sync" group="system" />
+ </plugins>
+
+</extension>
+
View
2  administrator/components/com_jomsocialgroupsync/models/fields/custom_field.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
defined('JPATH_BASE') or die;
View
0  administrator/components/com_jomsocialgroupsync/models/fields/index.html 100644 → 100755
File mode changed
View
0  administrator/components/com_jomsocialgroupsync/models/forms/index.html 100644 → 100755
File mode changed
View
12 administrator/components/com_jomsocialgroupsync/models/forms/synchronizationrule.xml 100644 → 100755
@@ -19,14 +19,14 @@
required="true"
filter="safehtml" />
- <field name="cgroup_id"
- key_field="cgroup_id"
- value_field="cgroup_label"
+ <field name="jsgroup_id"
+ key_field="jsgroup_id"
+ value_field="jsgroup_label"
type="sql"
- query="SELECT name as cgroup_label, id as cgroup_id FROM #__community_groups WHERE published = 1"
+ query="SELECT name as jsgroup_label, id as jsgroup_id FROM #__community_groups WHERE published = 1"
class="inputbox"
- label="COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_CGROUP_ID"
- description="COM_JOMSOCIALGROUPSYNC_FORM_DESC_SYNCHRONIZATIONRULE_CGROUP_ID"
+ label="COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_JSGROUP_ID"
+ description="COM_JOMSOCIALGROUPSYNC_FORM_DESC_SYNCHRONIZATIONRULE_JSGROUP_ID"
required="true"
filter="safehtml" />
View
0  administrator/components/com_jomsocialgroupsync/models/index.html 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/models/synchronizationrule.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access.
View
2  administrator/components/com_jomsocialgroupsync/models/synchronizationrules.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
defined('_JEXEC') or die;
View
53 administrator/components/com_jomsocialgroupsync/script.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * @version 2011-07-23 20:07:15$
+ * @author Marek Handze
+ * @package JomSocial Group Sync
+ * @copyright Copyright (C) 2011- . All rights reserved.
+ * @license GNU GPL
+ */
+
+defined( '_JEXEC' ) or die( 'Restricted access' );
+
+/*
+ * Installer script for package
+ */
+class com_jomsocialGroupSyncInstallerScript {
+
+ /**
+ * method to run during installation
+ * installs and enables the plugin
+ *
+ * @return void
+ */
+ function install($parent)
+ {
+ $manifest = $parent->get("manifest");
+ $parent = $parent->getParent();
+ $source = $parent->getPath("source");
+
+ $installer = new JInstaller();
+
+ // Install plugins
+ foreach($manifest->plugins->plugin as $plugin) {
+ $attributes = $plugin->attributes();
+ echo $plg = $source . DS . $attributes['folder'].DS.$attributes['plugin'];
+ $installer->install($plg);
+ }
+
+ $db = JFactory::getDbo();
+ $tableExtensions = $db->nameQuote("#__extensions");
+ $columnElement = $db->nameQuote("element");
+ $columnType = $db->nameQuote("type");
+ $columnEnabled = $db->nameQuote("enabled");
+
+ // Enable plugins
+ $db->setQuery( "UPDATE $tableExtensions
+ SET $columnEnabled = 1
+ WHERE $columnElement = 'jomsocialgroupsync'
+ AND $columnType = 'plugin'"
+ );
+ $db->query();
+ }
+}
+?>
View
2  administrator/components/com_jomsocialgroupsync/sql/install.mysql.utf8.sql 100644 → 100755
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS `#__jomsocialgroupsync_rules` (
`checked_out` INT(11) NOT NULL ,
`checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
`jgroup_id` INT(11) NOT NULL ,
-`cgroup_id` INT(11) NOT NULL ,
+`jsgroup_id` INT(11) NOT NULL ,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT COLLATE=utf8_general_ci;
View
0  administrator/components/com_jomsocialgroupsync/sql/uninstall.mysql.utf8.sql 100644 → 100755
File mode changed
View
0  administrator/components/com_jomsocialgroupsync/tables/index.html 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/tables/synchronizationrule.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access
View
0  administrator/components/com_jomsocialgroupsync/views/synchronizationrule/index.html 100644 → 100755
File mode changed
View
6 administrator/components/com_jomsocialgroupsync/views/synchronizationrule/tmpl/edit.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// no direct access
@@ -40,8 +40,8 @@
<?php echo $this->form->getInput('jgroup_id'); ?></li>
- <li><?php echo $this->form->getLabel('cgroup_id'); ?>
- <?php echo $this->form->getInput('cgroup_id'); ?></li>
+ <li><?php echo $this->form->getLabel('jsgroup_id'); ?>
+ <?php echo $this->form->getInput('jsgroup_id'); ?></li>
View
0  administrator/components/com_jomsocialgroupsync/views/synchronizationrule/tmpl/index.html 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/views/synchronizationrule/view.html.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access
View
0  administrator/components/com_jomsocialgroupsync/views/synchronizationrules/index.html 100644 → 100755
File mode changed
View
10 administrator/components/com_jomsocialgroupsync/views/synchronizationrules/tmpl/default.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
@@ -53,7 +53,7 @@
<?php echo JHtml::_('grid.sort', 'COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_JGROUP_ID', 'a.jgroup_id', $listDirn, $listOrder); ?>
</th>
<th class='left'>
- <?php echo JHtml::_('grid.sort', 'COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_CGROUP_ID', 'a.cgroup_id', $listDirn, $listOrder); ?>
+ <?php echo JHtml::_('grid.sort', 'COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_JSGROUP_ID', 'a.jsgroup_id', $listDirn, $listOrder); ?>
</th>
@@ -107,12 +107,12 @@
<?php endif; ?>
</td>
<td>
- <?php $cGroupName = JomSocialGroupSyncHelper::getCGroupName($item->cgroup_id); ?>
+ <?php $jsGroupName = JomSocialGroupSyncHelper::getJSGroupName($item->jsgroup_id); ?>
<?php if ($canEdit || $canEditOwn) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_jomsocialgroupsync&task=synchronizationrule.edit&id='.$item->id);?>">
- <?php echo $cGroupName.'</a> (id: '.$item->cgroup_id.')'; ?>
+ <?php echo $jsGroupName.'</a> (id: '.$item->jsgroup_id.')'; ?>
<?php else : ?>
- <?php echo $cGroupName.' (id: '.$item->cgroup_id.')'; ?>
+ <?php echo $jsGroupName.' (id: '.$item->jsgroup_id.')'; ?>
<?php endif; ?>
</td>
View
0  administrator/components/com_jomsocialgroupsync/views/synchronizationrules/tmpl/index.html 100644 → 100755
File mode changed
View
2  administrator/components/com_jomsocialgroupsync/views/synchronizationrules/view.html.php 100644 → 100755
@@ -4,7 +4,7 @@
* @package com_jomsocialgroupsync
* @copyright Copyright (C) 2011. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
- * @author Lighthouse Consulting and Design
+ * @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access
View
4 administrator/language/en-GB/en-GB.com_jomsocialgroupsync.ini 100644 → 100755
@@ -26,7 +26,7 @@ COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_STATE="State"
COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_CHECKED_OUT="N/A"
COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_CHECKED_OUT_TIME="N/A"
COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_JGROUP_ID="Joomla ACL Group"
-COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_CGROUP_ID="JomSocial Group"
+COM_JOMSOCIALGROUPSYNC_SYNCHRONIZATIONRULES_JSGROUP_ID="JomSocial Group"
COM_JOMSOCIALGROUPSYNC_TITLE_SYNCHRONIZATIONRULE="Synchronization Rule"
COM_JOMSOCIALGROUPSYNC_LEGEND_SYNCHRONIZATIONRULE="Synchronization Rule"
COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_ID="ID"
@@ -35,7 +35,7 @@ COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_STATE="State"
COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_CHECKED_OUT="N/A"
COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_CHECKED_OUT_TIME="N/A"
COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_JGROUP_ID="Joomla ACL Group"
-COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_CGROUP_ID="JomSocial Group"
+COM_JOMSOCIALGROUPSYNC_FORM_LBL_SYNCHRONIZATIONRULE_JSGROUP_ID="JomSocial Group"
View
0  administrator/language/en-GB/en-GB.com_jomsocialgroupsync.sys.ini 100644 → 100755
File mode changed
View
BIN  com_jomsocialgroupsync.zip
Binary file not shown
View
1  jomsocialgroupsync.xml
@@ -51,6 +51,7 @@
<plugins>
<plugin folder="plugins/system" plugin="jomsocialgroupsync" name="JomSocial Group Sync" group="system" />
+ <plugin folder="plugins/community" plugin="jomsocialgroupsync" name="JomSocial Group Sync" group="community" />
</plugins>
</extension>
View
1  plugins/community/jomsocialgroupsync/index.html
@@ -0,0 +1 @@
+<html><body bgcolor="#FFFFFF"></body></html>
View
74 plugins/community/jomsocialgroupsync/jomsocialgroupsync.php
@@ -0,0 +1,74 @@
+<?php
+/**
+ * @version 2011-07-23 20:07:15$
+ * @author Marek Handze
+ * @package JomSocial Group Sync
+ * @copyright Copyright (C) 2011. All rights reserved.
+ * @license GNU GPL
+ */
+
+defined( '_JEXEC' ) or die( 'Restricted access' );
+
+require_once( JPATH_ROOT.'/components/com_community/libraries/core.php');
+
+class plgCommunityJomSocialGroupSync extends CApplications
+{
+
+ //NOTE: If a JGroup or JSGroup is deleted, we don't remove from the linked group
+
+ /*
+ * JomSocial -> Joomla
+ * Update Joomla groups on JomSocial jsgroup-contact add
+ *
+ * @param string $group jsgroup object
+ * @param int $memberid Unique identifier (member)
+ *
+ * @return void
+ * @since 1.6
+ */
+ function onGroupJoin( &$group, $memberid ) {
+
+ // Get sync mappings
+ $mappings = self::getJomSocialGroupSyncMappings();
+ if ( empty($mappings) ) {
+ return;
+ }
+
+ // Instantiate JomSocial
+ require_once JPATH_ROOT.'/'.'administrator/components/com_community/defines.php';
+ require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php' );
+
+ jimport('joomla.user.helper1');
+ $model = CFactory::getModel( 'Groups' );
+
+ foreach ( $mappings as $mapping ) {
+ if ( $model->isMember($member, $mapping['jsgroup_id']) ) {
+
+ // Add user to jgroup members table
+ JUserHelper::addUserToGroup( $userid, $mapping['jgroup_id'] );
+
+ } else {
+ JUserHelper::removeUserFromGroup( $userid, $mapping['jgroup_id'] );
+ }
+ }
+ return true;
+ } //end jomsocial_post
+
+ /*
+ * Helper function to retrieve sync mappings
+ *
+ * @return array
+ * @since 1.6
+ */
+ public function getJomSocialGroupSyncMappings() {
+
+ $db = JFactory::getDbo();
+ $db->setQuery("SELECT * FROM #__jomsocialgroupsync_rules WHERE state = 1");
+ $mappings = $db->loadAssocList($key='id');
+
+ return $mappings;
+
+ } //end getJomSocialGroupSyncMappings
+
+}
+
View
18 plugins/community/jomsocialgroupsync/jomsocialgroupsync.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<extension type="plugin" version="1.6.0" method="upgrade" group="community">
+ <name>JomSocialGroupSync</name>
+ <author>Brian Shaughnessy</author>
+ <creationDate>2011-07-23</creationDate>
+ <copyright>© 2011. All rights reserved.</copyright>
+ <license>GNU/GPL</license>
+ <authorEmail>development@lcdservices.biz</authorEmail>
+ <authoreUrl>http://www.lcdservices.biz</authoreUrl>
+ <version>1.0</version>
+ <isapplication>true</isapplication>
+ <description>Companion plugin for the JomSocial Group Sync component, providing synchronization of Joomla ACL Groups with JomSocial Groups.</description>
+ <files>
+ <filename plugin="jomsocialgroupsync">jomsocialgroupsync.php</filename>
+ <filename plugin="jomsocialgroupsync">jomsocialgroupsync.xml</filename>
+ <filename>index.html</filename>
+ </files>
+</extension>
View
0  plugins/system/jomsocialgroupsync/index.html 100644 → 100755
File mode changed
View
51 plugins/system/jomsocialgroupsync/jomsocialgroupsync.php 100644 → 100755
@@ -30,14 +30,14 @@ class plgSystemJomSocialGroupSync extends JPlugin
* @throws Exception on error.
*/
function onUserAfterSave( $user, $isnew, $success, $msg ) {
-
+
//if 'latitude' key exists, event triggered from within JomSocial
if ( array_key_exists('latitude', $user) ) {
return;
}
-
+
$app = JFactory::getApplication();
-
+
// Instantiate JomSocial
require_once JPATH_ROOT.'/'.'administrator/components/com_community/defines.php';
@@ -60,10 +60,10 @@ function onUserAfterSave( $user, $isnew, $success, $msg ) {
// Cycle through mappings and add to/remove from JomSocial groups
foreach ( $mappings as $mapping ) {
- $data->groupid = $mapping['cgroup_id'];
+ $data->groupid = $mapping['jsgroup_id'];
if ( in_array($mapping['jgroup_id'], $user['groups']) ) {
-
+
// Add user to group members table
$addResult = $group->addMember( $data );
@@ -76,47 +76,6 @@ function onUserAfterSave( $user, $isnew, $success, $msg ) {
} //end onUserAfterSave
- //NOTE: If a JGroup or JSGroup is deleted, we don't remove from the linked group
-
- /*
- * JomSocial -> Joomla
- * Update Joomla groups on JomSocial jsgroup-contact add
- *
- * @param string $group jsgroup object
- * @param int $userid Unique identifier (user)
- *
- * @return void
- * @since 1.6
- */
- function onGroupJoin( &$group, $memberid ) {
-
- // Get sync mappings
- $mappings = self::getJomSocialGroupSyncMappings();
- if ( empty($mappings) ) {
- return;
- }
-
- // Instantiate JomSocial
- require_once JPATH_ROOT.'/'.'administrator/components/com_community/defines.php';
- require_once( JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php' );
-
- jimport('joomla.user.helper1');
- $model = CFactory::getModel( 'Groups' );
-
- foreach ( $mappings as $mapping ) {
- if ( $model->isMember($userid, $mapping['jsgroup_id']) ) {
-
- // Add user to jgroup members table
- JUserHelper::addUserToGroup( $userid, $mapping['jgroup_id'] );
-
- } else {
- JUserHelper::removeUserFromGroup( $userid, $mapping['jgroup_id'] );
- }
- }
- return true;
- } //end jomsocial_post
-
-
/*
* JomSocial <-> Joomla
* Run rules when mapping is created/edited or enabled
View
0  plugins/system/jomsocialgroupsync/jomsocialgroupsync.xml 100644 → 100755
File mode changed
Please sign in to comment.
Something went wrong with that request. Please try again.