mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
9e53314c3a
- new code structure, optimized for next development; - created spl_autoloader for remove includes; - UM classes with namespaces; - deprecated global $ultimatemember; variable (use UM() instead); - new UM/WP roles logic; - new settings class and logic (deprecated Redux framework, deprecated some old options, added some new options); - new dependencies class for extensions; - WP native styles for backend fields; - new upgrades and license activations for extensions; - new logic form backend forms and fields; - created uninstall.php file for delete permanently all UM settings; - optimized registration/upgrade profile process; Deprecated Hooks: um_new_user_registration_plain um_user_registration_extra_hook um_add_user_frontend um_post_registration_global_hook um_admin_extend_directory_options_general (was action...will be filter)
74 lines
1.7 KiB
PHP
74 lines
1.7 KiB
PHP
<?php
|
|
namespace um\widgets;
|
|
|
|
// Exit if accessed directly
|
|
if ( ! defined( 'ABSPATH' ) ) exit;
|
|
|
|
class UM_Search_Widget extends \WP_Widget {
|
|
|
|
function __construct() {
|
|
|
|
parent::__construct(
|
|
|
|
// Base ID of your widget
|
|
'um_search_widget',
|
|
|
|
// Widget name will appear in UI
|
|
__('Ultimate Member - Search', 'ultimate-member'),
|
|
|
|
// Widget description
|
|
array( 'description' => __( 'Shows users they follow in a widget.', 'ultimate-member' ), )
|
|
);
|
|
|
|
}
|
|
|
|
// Creating widget front-end
|
|
public function widget( $args, $instance ) {
|
|
$title = apply_filters( 'widget_title', $instance['title'] );
|
|
|
|
// before and after widget arguments are defined by themes
|
|
echo $args['before_widget'];
|
|
if ( ! empty( $title ) ) {
|
|
echo $args['before_title'] . $title . $args['after_title'];
|
|
}
|
|
|
|
// display the search form
|
|
um_search_form();
|
|
|
|
echo $args['after_widget'];
|
|
}
|
|
|
|
// Widget Backend
|
|
public function form( $instance ) {
|
|
if ( isset( $instance[ 'title' ] ) ) {
|
|
$title = $instance[ 'title' ];
|
|
} else {
|
|
$title = __( 'Search Users', 'ultimate-member' );
|
|
}
|
|
|
|
if ( isset( $instance[ 'max' ] ) ) {
|
|
$max = $instance[ 'max' ];
|
|
} else {
|
|
$max = 11;
|
|
}
|
|
|
|
// Widget admin form
|
|
?>
|
|
|
|
<p>
|
|
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
|
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
|
</p>
|
|
|
|
<?php
|
|
}
|
|
|
|
// Updating widget replacing old instances with new
|
|
public function update( $new_instance, $old_instance ) {
|
|
$instance = array();
|
|
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
|
return $instance;
|
|
}
|
|
|
|
}
|