Instantly share code, notes, and snippets.

# RalfAlbert/functions-php.part.php Last active Dec 10, 2015

What would you like to do?
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'
 .+

#Uuis'; $html = preg_replace($search, '', $html ); echo$html; }
 * @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 = '#

.+

#Uuis'; $html = preg_replace($search, '', $html ); echo$html; }
 * @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 = '#

.+

#Uuis'; $html = preg_replace($search, '', $html ); echo$html; }
 /** * JavaScript (jQuery) * Removes all paragraphs with class '.forgetmenot' */ jQuery( document ).ready( function ( $) {$( '.forgetmenot' ).remove(); } );