start_controls_section( 'delete_button_section', array( 'label' => __( 'Trash Button', 'frontend-admin' ), 'tab' => Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'delete_button_text', array( 'label' => __( 'Delete Button Text', 'frontend-admin' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'Delete', 'frontend-admin' ), 'placeholder' => __( 'Delete', 'frontend-admin' ), ) ); $this->add_control( 'delete_button_icon', array( 'label' => __( 'Delete Button Icon', 'frontend-admin' ), 'type' => Controls_Manager::ICONS, ) ); $this->end_controls_section(); $this->start_controls_section( 'actions_section', array( 'label' => __( 'Actions', 'frontend-admin' ), 'tab' => Controls_Manager::TAB_CONTENT, ) ); if ( ! class_exists( 'ElementorPro\Modules\QueryControl\Module' ) ) { $this->add_control( 'reassign_posts', array( 'label' => __( 'Reassign Posts To...', 'frontend-admin' ), 'description' => __( 'Enter user ID. If left empty, all of the user\'s posts will be deleted.', 'frontend-admin' ), 'type' => Controls_Manager::TEXT, 'placeholder' => __( '18', 'frontend-admin' ), ) ); } else { $this->add_control( 'reassign_posts', array( 'label' => __( 'Reassign Posts To...', 'frontend-admin' ), 'description' => __( 'If left empty, all of the user\'s posts will be deleted.', 'frontend-admin' ), 'label_block' => true, 'type' => Query_Module::QUERY_CONTROL_ID, 'autocomplete' => array( 'object' => Query_Module::QUERY_OBJECT_USER, 'display' => 'detailed', ), ) ); } $this->add_control( 'confirm_delete_message', array( 'label' => __( 'Confirm Delete Message', 'frontend-admin' ), 'type' => Controls_Manager::TEXT, 'default' => __( 'The user will be deleted. Are you sure?', 'frontend-admin' ), 'placeholder' => __( 'The user will be deleted. Are you sure?', 'frontend-admin' ), ) ); $this->add_control( 'show_delete_message', array( 'label' => __( 'Show Success Message', 'frontend-admin' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'frontend-admin' ), 'label_off' => __( 'No', 'frontend-admin' ), 'default' => 'true', 'return_value' => 'true', ) ); $this->add_control( 'delete_message', array( 'label' => __( 'Success Message', 'frontend-admin' ), 'type' => Controls_Manager::TEXTAREA, 'default' => __( 'You have deleted this user', 'frontend-admin' ), 'placeholder' => __( 'You have deleted this user', 'frontend-admin' ), 'dynamic' => array( 'active' => true, 'condition' => array( 'show_delete_message' => 'true', ), ), ) ); $this->add_control( 'delete_redirect', array( 'label' => __( 'Redirect After Delete', 'frontend-admin' ), 'type' => Controls_Manager::SELECT, 'default' => 'custom_url', 'options' => array( 'current' => __( 'Reload Current Url', 'frontend-admin' ), 'custom_url' => __( 'Custom Url', 'frontend-admin' ), 'referer_url' => __( 'Referer', 'frontend-admin' ), ), ) ); $this->add_control( 'redirect_after_delete', array( 'label' => __( 'Custom URL', 'frontend-admin' ), 'type' => Controls_Manager::URL, 'placeholder' => __( 'Enter Url Here', 'frontend-admin' ), 'show_external' => false, 'required' => true, 'dynamic' => array( 'active' => true, ), 'condition' => array( 'delete_redirect' => 'custom_url', ), ) ); $this->end_controls_section(); $this->start_controls_section( 'user_section', array( 'label' => __( 'User', 'frontend-admin' ), 'tab' => Controls_Manager::TAB_CONTENT, ) ); fea_instance()->local_actions['user']->action_controls( $this, false, 'delete_user' ); $this->end_controls_section(); do_action( 'frontend_admin/elementor/permissions_controls', $this ); if ( empty( fea_instance()->pro_features ) ) { $this->start_controls_section( 'style_promo_section', array( 'label' => __( 'Styles', 'frontend-admin' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ) ); $this->add_control( 'styles_promo', array( 'type' => Controls_Manager::RAW_HTML, 'raw' => __( '
Go Pro to unlock styles.
', 'frontend-admin' ), 'content_classes' => 'acf-fields-note', ) ); $this->end_controls_section(); } else { do_action( 'frontend_admin/delete_button_styles', $this ); } } public function prepare_field(){ $local_field = parent::prepare_field(); if( ! $local_field ) { return false; } $local_field['type'] = 'delete_user'; $local_field['reassign_posts'] = $settings['reassign_posts']; return $local_field; } }