Skip to content

Instantly share code, notes, and snippets.

Avatar

Sander Potjer sanderpotjer

View GitHub Profile
@sanderpotjer
sanderpotjer / docs.md
Created Dec 19, 2017
PWT Image dev-docs
View docs.md

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"
@sanderpotjer
sanderpotjer / default_logout.php
Created Oct 27, 2014
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
View 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 / index.php
Created Sep 24, 2014
Default Joomla Template example
View index.php
<?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 / edit.php
Last active Jan 26, 2020
Template override for improved Joomla article submission form
View edit.php
<?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');
View migrate.php
<?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 / getActions for com_content
Created Jun 19, 2012
administrator/components/com_content/helpers/content.php
View getActions for com_content
/**
* 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)
@sanderpotjer
sanderpotjer / faculty.php
Created Jun 11, 2012
Adding French faculty videos
View faculty.php
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 / build.xml
Created Feb 14, 2012
ACL Manager Build file
View build.xml
<?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 / 27216-sarp.patch
Created Dec 11, 2011
Patch for [#27216] to fix greyed out edit-state fields, because empty data it was looking to component permissions
View 27216-sarp.patch
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 / 24602-sarp.patch
Created Dec 10, 2011
Patch for [#24602] Users with create rights in a category but not component can't create subcategories
View 24602-sarp.patch
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();
You can’t perform that action at this time.