california Canada conference Conferences database db db2 DB2 pureXML development eclipse fall flickr google ibm Internet it java jdbc Joomla Linux mapping Open Source Other perl Personal Photography Portugal programming purexml rails rogers ruby shipment Software software-testing sql sqlj Tech toronto tpmg Travel twiki USA xml yahoo

Joomla – Enabling registered users do add content

Tags:

Although Joomla is one of the most advance CMS available, there are some things that I really don’t like/agree with. One of these things is the complex Access Control List. There are too many different user types and registered users have no permission to add content to the site. They need to be upgraded from “Registered” to “Author”. Still, and Author can only create content, but not publish it. Only a Publisher can publish content. And between Author and Publisher there is still the Editor, that can create and edit content, but can’t publish. As you can see, there are too many different user types (and I forgot to mention the Manager and Administrator types also availabel for the frontend. On the backend, another long list exhists).

If this complex organization was not enough, you cannot specify a default user type, so everybody that registers becomes a “Registered User”, without permissions to add content. The Joomla solution is to go to the administration backend  and switch the user to the group you think it fits (one of the listed above). However, if you want a user to be able to create, publish and edit it’s OWN content, it’s not possible rigth now. Registered users can only create content and Publishers can publish content from all users, so none of this types is good for our needs. After reading on foruns about the Joomla ACL (that was inherited just like it is now from Mambo) and about the no-will of Joomla developers to listen to community and change it, the only solution is to change the source code yourself. A very easy solution indeed. Just open the file includes/gacl.class.php and inside the funciton gacl add the lines:

$this->_mos_add_acl( 'action', 'add', 'users', 'registered', 'content', 'all' );
$this->_mos_add_acl( 'action', 'edit', 'users', 'registered', 'content', 'own' );
$this->_mos_add_acl( 'action', 'publish', 'users', 'registered', 'content', 'own' );


This will allow registered users to add any type of content, edit their own content and publish their own content. The same logic applies to other user types in case you want to change any of the permissions on the file.

Auto Publishing

Another sometimes useful feature not available in Joomla is the frontpage auto-publish of content (the Publisher is the one that decides to put the content in the frontpage or not when he publishes it). This can be achieved with a single change in the file components/com_content/content.php. Search for the line:

$row->frontpage         = 0;

and replace it with:

$row->frontpage         = 1;

This will enable frontpage auto-publishing of all your contents. Note: although this may be useful for publishing news in the frontpage, it may not be what you want for when you create articles that are not to display in the frontpage (In this case, you need to uncheck the frontpage publishing box). You should consider wich one is the most common case and decide on the best option for it.

VN:F [1.8.1_1037]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.1_1037]
Rating: +1 (from 1 vote)

Popularity: 100% [?]

59 Comments »

Avoiding Spam in Joomla

Tags:

If you own or administer a Joomla/Mambo site and are frequently being attacked by spammers in your forum/guestbook/gallery, com_securityimages may be the solution for you. There are some instructions here to show how to configure it to work with joomlaboard/simpleboard. Basically, you just call the security framework at insertion and validation time. To add anti-spam support for zOOm gallery (com_zoom), just edit the file /components/com_zoom/www/view.php and find the following lines:

<input type="hidden" name="isAdmin" value="<?php echo $zoom->_isAdmin; ?>" />
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value=
"<?php echo _ZOOM_ADD;?>" class="button" /></td>

Replace this lines with:

 


<input type="hidden" name="isAdmin" value=
"<?php echo $zoom->_isAdmin; ?>" />
</td>
</tr>
<?php include ($mosConfig_absolute_path.
'/administrator/components/com_securityimages/client.php'); ?>
<tr>
<td class="sb_leftcolumn">Anti-spam:
</td>
<td>
<?php echo insertSecurityImage("security_refid"); ?><br/>
<?php echo getSecurityImageText("security_try"); ?></td></tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value=
"<?php echo _ZOOM_ADD;?>" class="button" /></td>

Now find the lines:

if ($zoom->_gallery->_images[$key]->isMember($popup)) {
if ($submit === true) {
    $uname = $zoom->getParam($_REQUEST, 'uname');
    $comment = ($zoom->getParam($_REQUEST, 'comment'));
    $zoom->_gallery->_images[$key]->addComment($uname,$comment);
        }

and replace them with:

 

if ($zoom->_gallery->_images[$key]->isMember($popup)) {
include ($mosConfig_absolute_path.
'/administrator/components/com_securityimages/server.php');
$checkSecurity = checkSecurityImage($security_refid, $security_try);
if ($submit === true) {
        if ($checkSecurity==false){
        echo "";} else{ $uname = $zoom->getParam($_REQUEST, 'uname'); $comment = ($zoom->getParam($_REQUEST, 'comment')); $zoom->_gallery->_images[$key]->addComment($uname,$comment); }} 

And that’s it! You should now have captcha images showing up on your zOOm gallery comment boxes, avoind the huge ammount of spam that this component is usually victim.

 

This code was implemented in this website: Carapecos Online – Photo Gallery and is currently using SecurityImages component 4.2.1 

VN:F [1.8.1_1037]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.1_1037]
Rating: 0 (from 0 votes)

Popularity: 20% [?]

8 Comments »