nopublic

You are currently browsing articles tagged nopublic.

My plugins for controlling content access needed updating because Elgg 1.2 changed views/default/input/access.php; therefore, they no longer worked. I have made the appropriate changes to:

  • nopublic
  • nopublicwithfeeds
  • allpublic

In the near future I will also update higherwalls.

The real news here may be how the plugins will be housed and supported. I uploaded the plugins to a wiki that also gives information about the use, configuration, and installation of these and other plugins that I have created. There will also be a link to a discussion forum offering support for specific plugins.

The plugins are available here. Please be aware that both the wiki and the forum are in early stages of development.

Tags: , , , , , ,

Since I work in a k12 environment, I needed to make a plugin that removed “Public” as an option when users post content. I didn’t take me long to locate the file engine/lib/access.php as the file that controls these functions.

I hacked the core code and indeed it functioned as I wanted it to. Hacks to the core are undesireable because it complicates upgrading, so I wanted to create an override. I worked many hours trying to create a hack of the core access.php, but I was unsuccessful. I just couldn’t figure out how to write a start.php that would function. Finally, I had a break through, but it had nothing to do with overriding engine/lib/access.php.

Diego Andrés Ramírez Aragón and Jens von der Heydt suggested that the key to this may reside in the views directory. I knew how to write an override of elgg views. First I created the initial directories for the plugin:

nopublic/
nopublic/views

To find the rest of the pathway, I had to find where the access file was in the views directory and mirror it. Since it was in

views/default/input/access.php

I created

nopublic/views/default/input/

Next I opened created a copy of the original access.php, made my hacks and inserted it plugins’s input folder.

$class = $vars['class'];
if (!$class) $class = “input-access”;

if (!is_array($vars['options']))
{
$vars['options'] = array();
$vars['options'] = get_write_access_array();
}

if (is_array($vars['options']) && sizeof($vars['options']) > 0) {

?>

was changed to:

$class = $vars['class'];
if (!$class) $class = “input-access”;

if (!is_array($vars['options']))
{
$vars['options'] = array();
$vars['options'] = get_write_access_array();
unset($vars['options'][2]);
}

if (is_array($vars['options']) && sizeof($vars['options']) > 0) {

?>

The start.php requires no hooks. Simply initialize and register the plugin:

<?php
function nopublic_init() {

}

register_elgg_event_handler(‘init’,'system’,’nopublic_init’);
?>

I put that in my plugin directory, along with an manifest.xml file so now I had:

nopublic/start.php
nopublic/manifest.xml
nopublic/views/default/input/access.php

That disables the public access option–the basic nopublic plugin. There are many directories in the views folder that can be overridden this easily.

Clearly, there is much to explore with views overrides. I look forward to learning more about the manifestations of each file. They provide important customization options beyond themes.

I’d like to hear how others are using views overrides!

Tags: , , , ,

I have had several requests for the Higherwalls plugin with out the walled garden functionality. I decided to make the plugin with two flavors.

The original version also overrode the owner’s block so that the links to create RSS and OpenDD feeds were deleted. I created another version that retains the ability to click on the links to get the feeds.

Again, to totally disable the feeds, you will need to go to your elgg/views folder and delete the rss and opendd folders.

Tags: , , , , ,