Setup of ContentPassword

ContentPasword is triggered with a simple plugin code in the content. The code is {password PARAMETERS }. The following values are possible parameters, replace the placeholder "PARAMETERS" with a space delimited list of those you need:

  • pass="password": sets a password.
  • title="Title": set the title of the password dialog.
  • desc="Description": set the description of the dialog.
  • sql="SQL-query": set an SQL-query to verify the password.
    {password} will be replaced with the posted password.
  • group="groupname": assigns the content to a group.
    When the article is accessed with a password of this group, all other articles in this group are also unlocked.
  • allowgroup="groupname": When the article is unlocked, all articles in the specified group will be unlocked regardless whether the password belongs to the group.
  • passgroup="groupname": Allows unlocking of the article with the passwords of the specified group. The other articles in the group won't be unlocked.

All parameters with exception of "title" and "desc" can have multiple occurences. If the entered password is accepted by one of the parameters, the article will be unlocked.

Empty passwords are not allowed, passwords must not begin, or end with whitespace.
You should also insert a space between the parameters and the closing bracket to avoid problems with some editors.

Plugins are not executed in feed-view. To hide the content there, make the following changes. Be sure to document them since they can be overwritten by any Joomla-Update.

/libraries/joomla/document/feed/renderer/rss.php
Search:

            $feed.= "            <description><![CDATA[".$this->_relToAbs($data->items[$i]->description)."]]></description>\n";
Replace with:
            if (preg_match('/{password(area)?[^\\}]+}/', $data->items[$i]->description)) {
                $feed.= "            <description><![CDATA[This item is protected with a password.]]></description>\n";
            } else {
                $feed.= "            <description><![CDATA[".$this->_relToAbs($data->items[$i]->description)."]]></description>\n";
            }

/libraries/joomla/document/feed/renderer/atom.php
Search:

            if ($data->items[$i]->description!="") {
                $feed.= "        <summary type=\"html\">".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."</summary>\n";
                $feed.= "        <content type=\"html\">".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."</content>\n";
            }
Replace with:
            if ($data->items[$i]->description!="") {
                if (preg_match('/{password(area)?[^\\}]+}/', $data->items[$i]->description)) {
                    $feed.= "        <summary type=\"html\">This item is protected with a password.</summary>\n";
                    $feed.= "        <content type=\"html\">This item is protected with a password.</content>\n";
                } else {
                    $feed.= "        <summary type=\"html\">".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."</summary>\n";
                    $feed.= "        <content type=\"html\">".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."</content>\n";
                }
            }