Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Removing the Forgetmenot-checkbox on the WordPress login screen.
README
Install
Donwload the zip-archive, uncompress it into a folder, upload the folder to your WordPress plugin-folder. Activate the plugin on the plugin screen.
!!!ATTENTION!!!
If you are using PHP5.2, delete or rename the file 'index.php' BEFORE upload/activate the plugin. Then rename the file 'index_php52.php' into 'index.php'
<?php
/**
* Remove forgetmenot-checkbox on login screen
* Uses the hook 'after_theme_setup' instead of 'plugins_loaded' because
* first the theme have to be setup for get_template_directory_uri()
*
* @uses add_action()
* @hook after_setup_theme
*/
add_action(
'after_setup_theme',
'WPSE77581_remove_forgetmenot',
10,
0
);
/**
* Hook up all actions and filters
*
* @uses add_action()
* @hook login_enqueue_scripts
* @hook login_head
* @hook login_footer
*/
function WPSE77581_remove_forgetmenot() {
// add JavaScript
add_action( 'login_enqueue_scripts', 'WPSE77581_enqueue_script', 10, 0 );
// plain PHP with outputbuffering
add_action( 'login_head', 'WPSE77581_start_outputbuffer', 1, 0 );
add_action( 'login_footer', 'WPSE77581_end_outputbuffer', 1, 0 );
}
/**
* Enqueueing needed JavaScripts
* JS is stored in the folder 'js' inside the theme folder
*
* @uses wp_enqueue_script
* @uses get_template_directory_uri()
*/
function WPSE77581_enqueue_script() {
wp_enqueue_script(
'WPSE77581-remove-forgetmenot',
get_template_directory_uri() . '/js/wpse77581.js',
array( 'jquery' ),
false,
true
);
}
/**
* Start outputbuffering
* Buffers the DOM for later manipulation
*/
function WPSE77581_start_outputbuffer() {
ob_start();
}
/**
* End outputbuffering
* Get the content from outputbuffer and remove the paragraph with checkbox
*/
function WPSE77581_end_outputbuffer() {
$html = ob_get_clean();
$search = '#<p class="forgetmenot">.+</p>#Uuis';
$html = preg_replace( $search, '', $html );
echo $html;
}
<?php
/**
* WordPress-Plugin Remove Forgetmenot
*
* PHP version 5.3
*
* @category PHP
* @package WordPress
* @subpackage Remove Forgetmenot
* @author Ralf Albert <me@neun12.de>
* @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt
* @version 0.1
* @date 20112-12-29
* @link http://wordpress.com
*/
/**
* Plugin Name: Remove Forgetmenot
* Plugin URI: http://yoda.neun12.de
* Description: Removes the 'forgetmenot' checkbox from the login screen
* Version: 0.1
* Author: Ralf Albert
* Author URI: http://yoda.neun12.de
* Text Domain:
* Domain Path:
* Network:
* License: GPLv3
*/
/*
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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
namespace WPSE77581;
/**
* Start the plugin when plugins was loaded
*/
add_action(
'plugins_loaded',
'WPSE77581\remove_forgetmenot',
10,
0
);
/**
* Initialize the plugin. Hook up all actions and filters
*/
function remove_forgetmenot() {
// add JavaScript
add_action( 'login_enqueue_scripts', 'WPSE77581\enqueue_script', 10, 0 );
// plain PHP with outputbuffering
add_action( 'login_head', 'WPSE77581\start_outputbuffer', 1, 0 );
add_action( 'login_footer', 'WPSE77581\end_outputbuffer', 1, 0 );
}
/**
* Enqueueing needed JavaScripts
*/
function enqueue_script() {
wp_enqueue_script(
'WPSE77581-remove-forgetmenot',
plugins_url( 'wpse77581.js', __FILE__ ),
array( 'jquery' ),
false,
true
);
}
/**
* Start outputbuffering
* Buffers the DOM for later manipulation
*/
function start_outputbuffer() {
ob_start();
}
/**
* End outputbuffering
* Get the content from outputbuffer and remove the paragraph with checkbox
*/
function end_outputbuffer() {
$html = ob_get_clean();
$search = '#<p class="forgetmenot">.+</p>#Uuis';
$html = preg_replace( $search, '', $html );
echo $html;
}
<?php
/**
* WordPress-Plugin Remove Forgetmenot
*
* PHP version 5.2
*
* @category PHP
* @package WordPress
* @subpackage Remove Forgetmenot
* @author Ralf Albert <me@neun12.de>
* @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.txt
* @version 0.1
* @date 20112-12-29
* @link http://wordpress.com
*/
/**
* Plugin Name: Remove Forgetmenot
* Plugin URI: http://yoda.neun12.de
* Description: Removes the 'forgetmenot' checkbox from the login screen
* Version: 0.1
* Author: Ralf Albert
* Author URI: http://yoda.neun12.de
* Text Domain:
* Domain Path:
* Network:
* License: GPLv3
*/
/*
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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* Start the plugin when plugins was loaded
*/
add_action(
'plugins_loaded',
'WPSE77581_remove_forgetmenot',
10,
0
);
/**
* Initialize the plugin. Hook up all actions and filters
*/
function WPSE77581_remove_forgetmenot() {
// add JavaScript
add_action( 'login_enqueue_scripts', 'WPSE77581_enqueue_script', 10, 0 );
// plain PHP with outputbuffering
add_action( 'login_head', 'WPSE77581_start_outputbuffer', 1, 0 );
add_action( 'login_footer', 'WPSE77581_end_outputbuffer', 1, 0 );
}
/**
* Enqueueing needed JavaScripts
*/
function WPSE77581_enqueue_script() {
wp_enqueue_script(
'WPSE77581-remove-forgetmenot',
plugins_url( 'wpse77581.js', __FILE__ ),
array( 'jquery' ),
false,
true
);
}
/**
* Start outputbuffering
* Buffers the DOM for later manipulation
*/
function WPSE77581_start_outputbuffer() {
ob_start();
}
/**
* End outputbuffering
* Get the content from outputbuffer and remove the paragraph with checkbox
*/
function WPSE77581_end_outputbuffer() {
$html = ob_get_clean();
$search = '#<p class="forgetmenot">.+</p>#Uuis';
$html = preg_replace( $search, '', $html );
echo $html;
}
/**
* JavaScript (jQuery)
* Removes all paragraphs with class '.forgetmenot'
*/
jQuery( document ).ready(
function ( $ ) {
$( '.forgetmenot' ).remove();
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.