-
-
Save tech-suey/abe0de8ba8a8f63fc221204033a98a7f to your computer and use it in GitHub Desktop.
Revisions
-
tech-suey revised this gist
Jul 13, 2023 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -78,4 +78,4 @@ function wppbc_handle_output_display_state( $display_field, $field, $form_locati } } return $display_field; } -
tech-suey revised this gist
Jul 13, 2023 . 1 changed file with 54 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,4 +25,57 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // Start writing code after this line! function wppbc_fv_check_if_user_locked( $message, $field, $request_data, $form_location, $form_role = '', $user_id = 0 ) { // Handle visibility for register form if( $form_location == 'register' ) { // Visibility for User Locked option if( !current_user_can( apply_filters( 'wppb_fv_capability_user_locked', 'manage_options' ) ) ) { if (isset($field['visibility']) && ($field['visibility'] == 'user_locked')) { remove_filter('wppb_check_form_field_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $field['field'] ), 'wppb_in_fv_check_field_value', 11); remove_filter('wppb_check_form_field_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $field['field'] ), 'wppb_in_fv_check_if_user_locked', 11); } } } return $message; } function wppbc_init_field_visibility() { if ( !defined('WPPBFV_IN_PLUGIN_DIR') ){ return; } $filter_fields = wppb_in_field_visibility_get_extra_fields(); // add filters for the fields foreach( $filter_fields as $filter_field_slug => $filter_field ) { if( class_exists('Wordpress_Creation_Kit_PB') ) { add_filter('wppb_check_form_field_' . Wordpress_Creation_Kit_PB::wck_generate_slug( $filter_field ), 'wppbc_fv_check_if_user_locked', 10, 6); } } } add_action( 'init', 'wppbc_init_field_visibility', 999 ); /* * Make field visibility user locked on the Edit Profile page only */ add_filter( 'wppb_output_display_form_field', 'wppbc_handle_output_display_state', 999, 5 ); function wppbc_handle_output_display_state( $display_field, $field, $form_location, $form_role, $user_id ){ // Handle visibility for register form if( $form_location == 'register' ) { // Visibility for User Locked option if( !current_user_can( apply_filters( 'wppb_fv_capability_user_locked', 'manage_options' ) ) ) { if (isset($field['visibility']) && ($field['visibility'] == 'user_locked')) { $display_field = true; } } } return $display_field; } -
sareiodata created this gist
Jul 2, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ <?php /** * Plugin Name: Name Of The Plugin * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates * Description: A brief description of the Plugin. * Version: The Plugin's Version Number, e.g.: 1.0 * Author: Name Of The Plugin Author * Author URI: http://URI_Of_The_Plugin_Author * License: A "Slug" license name e.g. GPL2 */ /* Copyright YEAR PLUGIN_AUTHOR_NAME (email : PLUGIN AUTHOR EMAIL) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. 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 */ // Start writing code after this line!