Skip to content

Instantly share code, notes, and snippets.

@sanderpotjer
sanderpotjer / 24602-sarp.patch
Created December 10, 2011 23:05
Patch for [#24602] Users with create rights in a category but not component can't create subcategories
diff --git administrator/components/com_categories/controllers/category.php administrator/components/com_categories/controllers/category.php
index 8c02b62c03e412732c5963bc1a99b2f9e7126f6b..cb879c7f2abfaca71318622d05d016a9df6cc86a 100644
--- administrator/components/com_categories/controllers/category.php
+++ administrator/components/com_categories/controllers/category.php
@@ -53,7 +53,8 @@ class CategoriesControllerCategory extends JControllerForm
*/
protected function allowAdd($data = array())
{
- return JFactory::getUser()->authorise('core.create', $this->extension);
+ $user = JFactory::getUser();
@sanderpotjer
sanderpotjer / 27216-sarp.patch
Created December 11, 2011 15:56
Patch for [#27216] to fix greyed out edit-state fields, because empty data it was looking to component permissions
diff --git administrator/components/com_content/models/article.php administrator/components/com_content/models/article.php
index 3c5015f82ccf7dab85d56809c5080fa6047a53d6..9c0130e59d113338c098f320c3463def3cb63109 100644
--- administrator/components/com_content/models/article.php
+++ administrator/components/com_content/models/article.php
@@ -168,6 +168,7 @@ class ContentModelArticle extends JModelAdmin
}
// Modify the form based on Edit State access controls.
+ $data = $this->loadFormData();
if (!$this->canEditState((object) $data)) {
@sanderpotjer
sanderpotjer / build.xml
Created February 14, 2012 08:11
ACL Manager Build file
<?xml version="1.0" encoding="UTF-8"?>
<project name="aclmanager" default="dist" basedir="/Users/sanderpotjer/github/aclmanager/build/">
<condition property="project_dir" value="..">
<not>
<isset property="project_dir" />
</not>
</condition>
<condition property="package_dir" value="../packages">
<not>
<isset property="package_dir" />
@sanderpotjer
sanderpotjer / faculty.php
Created June 11, 2012 09:47
Adding French faculty videos
if($country=='de') {
$speakers = array(
'JIM_CATHCART' => array('topics' => array('06B','12A'), 'video' => 'cathcart_de'),
'LISA_FORD' => array('topics' => array('01A','05A','09A'), 'video' => 'ford_de'),
'AMANDA_GORE' => array('topics' => array('02B','08B'), 'video' => 'gore_de'),
'JIM_HENNIG' => array('topics' => array('03A','04A','08A','11A'), 'video' => 'hennig_de'),
'JOHN_HERSEY' => array('topics' => array('01B','05B','10B'), 'video' => 'hersey_de'),
'TERRY_PAULSON' => array('topics' => array('03B','06A','09B','12B'), 'video' => 'paulson_de'),
'NIDO_QUBEIN' => array('topics' => array('02A','10A'), 'video' => 'qubein_de'),
'MARCIA_STEELE' => array('topics' => array('07A'), 'video' => 'steele_de'),
@sanderpotjer
sanderpotjer / getActions for com_content
Created June 19, 2012 14:37
administrator/components/com_content/helpers/content.php
/**
* Gets a list of the actions that can be performed.
*
* @param int The category ID.
* @param int The article ID.
*
* @return JObject
* @since 1.6
*/
public static function getActions($categoryId = 0, $articleId = 0)
<?php
define('_JEXEC', 1);
// Connect with Joomla
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';
// Database connection
$db = JFactory::getDBO();
@sanderpotjer
sanderpotjer / edit.php
Last active May 5, 2023 03:08
Template override for improved Joomla article submission form
<?php
/**
* @package Article Form override for Joomla 3
* @copyright Copyright (c) 2014 Sander Potjer - www.perfectwebteam.nl
* @license GNU General Public License version 3 or later
*/
defined('_JEXEC') or die;
JHtml::_('behavior.keepalive');
@sanderpotjer
sanderpotjer / index.php
Created September 24, 2014 17:31
Default Joomla Template example
<?php
// Template by Perfect Web Team // www.perfectwebteam.nl //
defined('_JEXEC') or die;
// Connect with Joomla
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$uri = JFactory::getURI();
// Variables
@sanderpotjer
sanderpotjer / default_logout.php
Created October 27, 2014 11:25
Template override for direct logout when using logout menu item in your menu. Place override in templates/nameoftemplate/html/com_users/login/default_logout.php
<?php
defined('_JEXEC') or die;
$app = JFactory::getApplication();
$return = $this->params->get('logout_redirect_url', $this->form->getValue('return'));
$url = JRoute::_('index.php?option=com_users&task=user.logout&' . JSession::getFormToken() . '=1&return=' . $return);
$app->redirect($url);
@sanderpotjer
sanderpotjer / docs.md
Created December 19, 2017 09:30
PWT Image dev-docs

Form field

The form field is used like this:

<fieldset name="images" addfieldpath="components/com_pwtimage/models/fields">
	<field
		name="image"
		type="pwtimage.image"
		label="COM_PWTIMAGE_FIELD_PHOTO_LABEL"
 description="COM_PWTIMAGE_FIELD_PHOTO_DESC"