Silenceway Notas y apuntes de a ratos…

7Mar/100

Proteger el acceso al RSS de un blog de WordPress

Hay varias formas de proteger el acceso al rss de un blog de wordpress, pero lo hacen redirigiendo a la página de inicio de sesión.
En algunos lectores de feed, esto no funciona ya que requieren autenticación por http para poder agregar el feed. Este plugin permite esta opción.

< ?php
/*
Plugin Name: Silencesoft Protect RSS
Plugin URI: http://www.silencesoft.net
Description: A plugin to protect rss feeds to only registered users
Version: 1.0
Author: Byron Herrera
Author URI: http://byronh.axul.net

Copyright 2010 Byron Herrera (email : bh at axul dot net)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

function sil_protect_rss() {
global $wpdb;
if (! is_feed()) return;
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="RSS Feeds"');
header('HTTP/1.1 401 Unauthorized');
echo 'This rss feeds requires authentication.';
exit;
} else {
if (user_pass_ok($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW'])) {
// can proceed normally
} else {
header('WWW-Authenticate: Basic realm="RSS Feeds"');
header('HTTP/1.1 401 Unauthorized');
echo 'Error on username or password.';
exit;
}
}
}

add_action('pre_get_posts', 'sil_protect_rss');

O puede descargarlo de: http://www.silencesoft.net/Wordpress/

Imprimir Imprimir
21Jul/090

Publicado Formpress 0.4 pre

Después de dedicarle tiempo a la actualización y a añadirle nuevas características al plugin Formpress de WordPress, hoy subí esta versión en línea para las primeras pruebas.
Falta agregarle bastante documentación, pero aún estoy trabajando en código así que cuando termine me pondré a organizar toda esa parte.
Igual tiene por ahí algunos "echo" que no debería, pero estoy en depuración :D
En WordPress
Zip

Imprimir Imprimir