• Resolved jacob106007

    (@jacob106007)


    Hi,
    Thanks for this wonderful plugin..
    I’ve wrote a custom class for a subscriber profile.

    Problem is that after submitting form, control is not going to custom call back function.

    Any help would be appreciated.

    Below is my complete class:

    
    class tmlCustomProfile
    {
    	public function __construct()
    	{
    		add_action( 'init', array($this,'subscriberProfileFormFields'), 0);
    		add_action( 'init', array($this,'subscriberProfilesActionRegister'), 0 );
    		add_shortcode( 'subscriber-profile', array($this, 'getSubscriberProfile') );
    		add_action( 'wp_enqueue_scripts', array($this,'customScripts'), 10 );
    	}
    
    	public function subscriberProfileFormFields ()
    	{
    		$user = wp_get_current_user();
    		tml_register_form( 'subscriber_profile', array(
    				'action' => tml_get_action_url( 'profile' ),
    				'render_args' => array(
    						'show_links' => false,
    				),
    		) );
    		tml_add_form_field( 'subscriber_profile', 'personal_options_section_header', array(
    			'type' => 'custom',
    			'content' => '<h3>' . esc_html_x( 'Update Profile', 'profile section', 'theme-my-login-profiles' ) . '</h3>',
    			'wrap' => false,
    			'priority' => 10,
    		) );
    		$profile_img = get_user_meta( $user->ID, 'profile_image', true );
    		$gender = get_user_meta( $user->ID, 'gender', true );
    		if(empty($profile_img)) {
    			switch ($gender) {
    				case 'boy':
    					$profile_img = get_stylesheet_directory_uri() . '/inc/images/facepicture.png';
    					break;
    				case 'girl':
    					$profile_img = get_stylesheet_directory_uri() . '/inc/images/facepicture-f.png';
    					break;
    				default:
    					$profile_img = get_stylesheet_directory_uri() . '/inc/images/facepicture.png';
    					break;
    			}
    		}
    		tml_add_form_field( 'subscriber_profile', 'personal_options_section_content', array(
    				'type' => 'custom',
    				'content' => '<div class="user-image"><img src="'.$profile_img.'" alt="No Image" /></div>',
    				'wrap' => false,
    				'priority' => 10,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'profile_image', array(
    				'type' => 'file',
    				'label' => __( 'Profile Image', 'theme-my-login-profiles' ),
    				'value' => '',
    				'id' => 'profile_image',
    				'priority' => 10,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'first_name', array(
    				'type' => 'text',
    				'label' => __( 'First Name', 'theme-my-login-profiles' ),
    				'value' => $user->first_name,
    				'id' => 'first_name',
    				'priority' => 35,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'last_name', array(
    				'type' => 'text',
    				'label' => __( 'Last Name', 'theme-my-login-profiles' ),
    				'value' => $user->last_name,
    				'id' => 'last_name',
    				'priority' => 40,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'email', array(
    				'type' => 'email',
    				'label' => __( 'Email', 'theme-my-login-profiles' ),
    				'value' => $user->user_email,
    				'id' => 'email',
    				'priority' => 40,
    		) );
    		if ( $show_password_fields = apply_filters( 'show_password_fields', true, $user ) ) {
    			tml_add_form_field( 'subscriber_profile', 'pass1', array(
    					'type' => 'password',
    					'label' => __( 'New Password', 'theme-my-login-profiles' ),
    					'id' => 'pass1',
    					'attributes' => array(
    							'autocomplete' => 'off',
    					),
    					'priority' => 95,
    			) );
    			tml_add_form_field( 'subscriber_profile', 'pass2', array(
    					'type' => 'password',
    					'label' => __( 'Repeat New Password', 'theme-my-login-profiles' ),
    				//'description' => __( 'Type your new password again.', 'theme-my-login-profiles' ),
    					'id' => 'pass2',
    					'attributes' => array(
    							'autocomplete' => 'off',
    					),
    					'priority' => 95,
    			) );
    		}
    		tml_add_form_field( 'subscriber_profile', 'indicator', array(
    				'type'     => 'custom',
    				'content'  => '<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite">' . __( 'Strength indicator' ) . '</div>',
    				'priority' => 95,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'indicator_hint', array(
    				'type'     => 'custom',
    				'content'  => '<p class="description indicator-hint">' . wp_get_password_hint() . '</p>',
    				'priority' => 95,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'status', array(
    				'type'     => 'dropdown',
    				'label'    => 'Status',
    				'value'    => get_user_meta( $user->ID, 'status', true ),
    				'id'       => 'status',
    				'priority' => 15,
    				'options' 	=> array(
    						'student' => 'Student',
    						'teacher' => 'Teacher',
    						'other' => 'Other'
    				)
    		) );
    		tml_add_form_field( 'subscriber_profile', 'gender', array(
    				'type'     => 'dropdown',
    				'label'    => 'Gender',
    				'value'    => $gender,
    				'id'       => 'gender',
    				'priority' => 15,
    				'options' 	=> array(
    						'boy' => 'Boy',
    						'girl' => 'Girl'
    				)
    		) );
    		tml_add_form_field( 'subscriber_profile', 'nickname', array(
    				'type' => 'text',
    				'label' => __( 'Nickname', 'theme-my-login-profiles' ),
    				'value' => $user->nickname,
    				'id' => 'nickname',
    				'priority' => 45,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'school_name', array(
    				'type'     => 'text',
    				'label'    => 'School Name',
    				'value'    => get_user_meta( $user->ID, 'school_name', true ),
    				'id'       => 'school_name',
    				'priority' => 15,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'city', array(
    				'type'     => 'dropdown',
    				'label'    => 'City',
    				'value'    => get_user_meta( $user->ID, 'city', true ),
    				'id'       => 'city',
    				'priority' => 15,
    				'options' 	=> getCities()
    		) );
    		tml_add_form_field( 'subscriber_profile', 'submit', array(
    				'type' => 'submit',
    				'value' => __( 'Update Profile', 'theme-my-login-profiles' ),
    				'priority' => 105,
    		) );
    		tml_add_form_field( 'subscriber_profile', '_wpnonce', array(
    				'type' => 'hidden',
    				'value' => wp_create_nonce( 'update-user_' . $user->ID ),
    				'priority' => 105,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'user_id', array(
    				'type' => 'hidden',
    				'value' => $user->ID,
    				'priority' => 105,
    		) );
    	}
    
    	public function subscriberProfilesActionRegister ()
    	{
    		$user = wp_get_current_user();
    		if (!empty( $user->roles ) && is_array( $user->roles ) && !in_array( 'subscriber', $user->roles ) ) {
    			return;
    		}
    		tml_register_action( 'subscriber_profile', array(
    				'title' => __( 'Your Profile', 'theme-my-login-profiles' ),
    				'slug' => 'profile',
    				'callback' => array($this,'subscriberProfilesActionHandler'),
    				'network'           => true,
    				'show_on_forms' => false,
    				'show_in_slug_settings' => false,
    				'show_in_widget' => false,
    				'show_nav_menu_item' => false,
    		) );
    	}
    
    	public function subscriberProfilesActionHandler ()
    	{
    		require_once ABSPATH . 'wp-admin/includes/user.php';
    		if ( ! is_user_logged_in() ) {
    			$redirect_to = wp_login_url();
    			wp_redirect( $redirect_to );
    			exit;
    		}
    		$user_id = get_current_user_id();
    		if ( ! tml_is_post_request() ) {
    			return;
    		}
    		if ( isset( $_POST['first_name'] ) ) {
    			update_user_meta( $user_id, 'first_name', $_POST['first_name'] );
    		}
    		if ( isset( $_POST['last_name'] ) ) {
    			update_user_meta( $user_id, 'last_name', $_POST['last_name'] );
    		}
    		if( isset($_POST['school_name'])) {
    			update_user_meta( $user_id, 'school_name', $_POST['school_name']);
    		}
    		if( isset($_POST['status'])) {
    			update_user_meta( $user_id, 'status', $_POST['status']);
    		}
    		if( isset($_POST['gender'])) {
    			update_user_meta( $user_id, 'gender', $_POST['gender']);
    		}
    		if( isset($_POST['city'])) {
    			update_user_meta( $user_id, 'city', $_POST['city']);
    		}
    		if ( ! function_exists( 'wp_handle_upload' ) ) {
    			require_once( ABSPATH . 'wp-admin/includes/file.php' );
    		}
    		if(!empty($_FILES['profile_image']['name'])) {
    			$uploadedfile = $_FILES['profile_image'];
    			$check_img = getimagesize($_FILES["profile_image"]["tmp_name"]);
    			if($check_img === false) {
    				tml_add_error( 'profile_image', __( 'Please upload an Image', 'theme-my-login-profiles' ), 'error' );
    			} else {
    				$upload_overrides = array( 'test_form' => false );
    				$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
    				if ( $movefile && ! isset( $movefile['error'] ) ) {
    					update_user_meta( $user_id, 'profile_image', $movefile['url']);
    				} else {
    					tml_add_error( 'profile_image', __( $movefile['error'], 'theme-my-login-profiles' ), 'error' );
    				}
    			}
    		}
    		$errors = edit_user( $user_id );
    		$user = new stdClass;
    		$user->ID = $user_id;
    		$user->user_email = esc_html( trim( $_POST[ 'email' ] ) );
    		wp_update_user( $user );
    		if ( ! is_wp_error( $errors ) ) {
    			$redirect_to = add_query_arg( 'updated', true, tml_get_action_url( 'profile' ) );
    			wp_redirect( $redirect_to );
    			exit;
    		}
    		tml_set_errors( $errors );
    	}
    	public function customScripts ()
    	{
    		$suffix = SCRIPT_DEBUG ? '' : '.min';
    		$dependencies = array( 'jquery' );
    		if ( tml_is_action( 'subscriber_profile' ) && tml_allow_user_passwords() ) {
    			$dependencies[] = 'password-strength-meter';
    		}
    		wp_enqueue_script( 'theme-my-login-custom', THEME_MY_LOGIN_URL . "assets/scripts/theme-my-login$suffix.js", $dependencies, THEME_MY_LOGIN_VERSION );
    		wp_localize_script( 'theme-my-login-custom', 'themeMyLogin', array(
    				'action' => tml_is_action() ? tml_get_action()->get_name() : '',
    				'errors' => tml_get_errors()->get_error_codes(),
    		) );
    	}
    	public function getSubscriberProfile ()
    	{
    		if ( ! is_user_logged_in() ) {
    			$redirect_to = wp_login_url();
    			wp_redirect( $redirect_to );
    			exit;
    		}
    		ob_start();
    		$user_id = get_current_user_id();
    		$user = new WP_User( $user_id );
    		if ( ! empty( $user->roles ) && is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
    			?>
    			<div class="profile-form">
    				<?php
    				echo do_shortcode('[theme-my-login action="subscriber_profile"]');
    				?>
    			</div>
    		<?php } else {
    			echo do_shortcode('[theme-my-login]');
    		}
    		return ob_get_clean();
    	}
    }
    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    $plugin = 'theme-my-login/theme-my-login.php';
    if(is_plugin_active($plugin)) {
    	$tmlCustomProfileObj = new tmlCustomProfile();
    }
    • This topic was modified 4 years, 6 months ago by jacob106007.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    You registered a custom action “subscriber_profile” but your form action is pointing to the “profile” action. Change this:

    'action' => tml_get_action_url( 'profile' ),

    To this:

    'action' => tml_get_action_url( 'subscriber_profile' ),

    And also, register the action before the form.

    Thread Starter jacob106007

    (@jacob106007)

    Thanx for your reply.
    After modification It didn’t worked…
    This is class after modification:

    <?php
    
    class tmlCustomProfile
    {
    
    	public function __construct()
    	{
    		add_action( 'init', array($this,'subscriberProfilesActionRegister'), 0 );
    		add_action( 'init', array($this,'subscriberProfileFormFields'), 0);
    		add_shortcode( 'subscriber-profile', array($this, 'getSubscriberProfile') );
    		add_action( 'wp_enqueue_scripts', array($this,'customScripts'), 10 );
    	}
    
    	public function subscriberProfilesActionRegister ()
    	{
    		$user = wp_get_current_user();
    		if (!empty( $user->roles ) && is_array( $user->roles ) && !in_array( 'subscriber', $user->roles ) ) {
    			return;
    		}
    		tml_register_action( 'subscriber_profile', array(
    				'title' => __( 'Your Profile', 'theme-my-login-profiles' ),
    				'slug' => 'profile',
    				'callback' => array($this,'subscriberProfilesActionHandler'),
    				'network'           => true,
    				'show_on_forms' => false,
    				'show_in_slug_settings' => false,
    				'show_in_widget' => false,
    				'show_nav_menu_item' => false,
    		) );
    	}
    	public function subscriberProfileFormFields ()
    	{
    		$user = wp_get_current_user();
    		tml_register_form( 'subscriber_profile', array(
    				'action' => tml_get_action_url( 'subscriber_profile' ),
    				'render_args' => array(
    						'show_links' => false,
    				),
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'personal_options_section_header', array(
    			'type' => 'custom',
    			'content' => '<h3>' . esc_html_x( 'Update Profile', 'profile section', 'theme-my-login-profiles' ) . '</h3>',
    			'wrap' => false,
    			'priority' => 10,
    		) );
    		$profile_img = get_user_meta( $user->ID, 'profile_image', true );
    		$gender = get_user_meta( $user->ID, 'gender', true );
    
    		if(empty($profile_img)) {
    
    			switch ($gender) {
    				case 'boy':
    					$profile_img = get_stylesheet_directory_uri() . '/inc/images/facepicture.png';
    					break;
    				case 'girl':
    					$profile_img = get_stylesheet_directory_uri() . '/inc/images/facepicture-f.png';
    					break;
    
    				default:
    					$profile_img = get_stylesheet_directory_uri() . '/inc/images/facepicture.png';
    					break;
    			}
    		}
    
    		tml_add_form_field( 'subscriber_profile', 'personal_options_section_content', array(
    				'type' => 'custom',
    				'content' => '<div class="user-image"><img class="img-fluid" src="'.$profile_img.'" alt="No Image"/></div>',
    				'wrap' => false,
    				'priority' => 10,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'profile_image', array(
    				'type' => 'file',
    				'label' => __( 'Profile Image', 'theme-my-login-profiles' ),
    				'value' => '',
    				'id' => 'profile_image',
    				'priority' => 10,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'first_name', array(
    				'type' => 'text',
    				'label' => __( 'First Name', 'theme-my-login-profiles' ),
    				'value' => $user->first_name,
    				'id' => 'first_name',
    				'priority' => 35,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'last_name', array(
    				'type' => 'text',
    				'label' => __( 'Last Name', 'theme-my-login-profiles' ),
    				'value' => $user->last_name,
    				'id' => 'last_name',
    				'priority' => 40,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'email', array(
    				'type' => 'email',
    				'label' => __( 'Email', 'theme-my-login-profiles' ),
    				'value' => $user->user_email,
    				'id' => 'email',
    				'priority' => 40,
    		) );
    
    		if ( $show_password_fields = apply_filters( 'show_password_fields', true, $user ) ) {
    
    			tml_add_form_field( 'subscriber_profile', 'pass1', array(
    					'type' => 'password',
    					'label' => __( 'New Password', 'theme-my-login-profiles' ),
    					'id' => 'pass1',
    					'attributes' => array(
    							'autocomplete' => 'off',
    					),
    					'priority' => 95,
    			) );
    
    			tml_add_form_field( 'subscriber_profile', 'pass2', array(
    					'type' => 'password',
    					'label' => __( 'Repeat New Password', 'theme-my-login-profiles' ),
    				//'description' => __( 'Type your new password again.', 'theme-my-login-profiles' ),
    					'id' => 'pass2',
    					'attributes' => array(
    							'autocomplete' => 'off',
    					),
    					'priority' => 95,
    			) );
    		}
    
    		tml_add_form_field( 'subscriber_profile', 'indicator', array(
    				'type'     => 'custom',
    				'content'  => '<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite">' . __( 'Strength indicator' ) . '</div>',
    				'priority' => 95,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'indicator_hint', array(
    				'type'     => 'custom',
    				'content'  => '<p class="description indicator-hint">' . wp_get_password_hint() . '</p>',
    				'priority' => 95,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'status', array(
    				'type'     => 'dropdown',
    				'label'    => 'Status',
    				'value'    => get_user_meta( $user->ID, 'status', true ),
    				'id'       => 'status',
    				'priority' => 15,
    				'options' 	=> array(
    						'student' => 'Student',
    						'teacher' => 'Teacher',
    						'other' => 'Other'
    				)
    		) );
    		tml_add_form_field( 'subscriber_profile', 'gender', array(
    				'type'     => 'dropdown',
    				'label'    => 'Gender',
    				'value'    => $gender,
    				'id'       => 'gender',
    				'priority' => 15,
    				'options' 	=> array(
    						'boy' => 'Boy',
    						'girl' => 'Girl'
    				)
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'nickname', array(
    				'type' => 'text',
    				'label' => __( 'Nickname', 'theme-my-login-profiles' ),
    				'value' => $user->nickname,
    				'id' => 'nickname',
    				'priority' => 45,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'school_name', array(
    				'type'     => 'text',
    				'label'    => 'School Name',
    				'value'    => get_user_meta( $user->ID, 'school_name', true ),
    				'id'       => 'school_name',
    				'priority' => 15,
    		) );
    		tml_add_form_field( 'subscriber_profile', 'city', array(
    				'type'     => 'dropdown',
    				'label'    => 'City',
    				'value'    => get_user_meta( $user->ID, 'city', true ),
    				'id'       => 'city',
    				'priority' => 15,
    				'options' 	=> getCities()
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'submit', array(
    				'type' => 'submit',
    				'value' => __( 'Update Profile', 'theme-my-login-profiles' ),
    				'priority' => 105,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', '_wpnonce', array(
    				'type' => 'hidden',
    				'value' => wp_create_nonce( 'update-user_' . $user->ID ),
    				'priority' => 105,
    		) );
    
    		tml_add_form_field( 'subscriber_profile', 'user_id', array(
    				'type' => 'hidden',
    				'value' => $user->ID,
    				'priority' => 105,
    		) );
    	}
    	public function subscriberProfilesActionHandler ()
    	{
    
    		require_once ABSPATH . 'wp-admin/includes/user.php';
    
    		if ( ! is_user_logged_in() ) {
    			$redirect_to = wp_login_url();
    			wp_redirect( $redirect_to );
    			exit;
    		}
    		$user_id = get_current_user_id();
    		if ( ! tml_is_post_request() ) {
    			return;
    		}
    		if ( isset( $_POST['first_name'] ) ) {
    			update_user_meta( $user_id, 'first_name', $_POST['first_name'] );
    
    		}
    		if ( isset( $_POST['last_name'] ) ) {
    			update_user_meta( $user_id, 'last_name', $_POST['last_name'] );
    
    		}
    		if( isset($_POST['school_name'])) {
    			update_user_meta( $user_id, 'school_name', $_POST['school_name']);
    
    		}
    		if( isset($_POST['status'])) {
    			update_user_meta( $user_id, 'status', $_POST['status']);
    
    		}
    		if( isset($_POST['gender'])) {
    			update_user_meta( $user_id, 'gender', $_POST['gender']);
    
    		}
    		if( isset($_POST['city'])) {
    			update_user_meta( $user_id, 'city', $_POST['city']);
    
    		}
    
    		if ( ! function_exists( 'wp_handle_upload' ) ) {
    
    			require_once( ABSPATH . 'wp-admin/includes/file.php' );
    		}
    		if(!empty($_FILES['profile_image']['name'])) {
    			$uploadedfile = $_FILES['profile_image'];
    
    			$check_img = getimagesize($_FILES["profile_image"]["tmp_name"]);
    
    			if($check_img === false) {
    
    				tml_add_error( 'profile_image', __( 'Please upload an Image', 'theme-my-login-profiles' ), 'error' );
    
    			} else {
    
    				$upload_overrides = array( 'test_form' => false );
    
    				$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
    
    				if ( $movefile && ! isset( $movefile['error'] ) ) {
    
    					update_user_meta( $user_id, 'profile_image', $movefile['url']);
    
    				} else {
    
    					tml_add_error( 'profile_image', __( $movefile['error'], 'theme-my-login-profiles' ), 'error' );
    				}
    
    			}
    		}
    		$errors = edit_user( $user_id );
    		$user = new stdClass;
    		$user->ID = $user_id;
    		$user->user_email = esc_html( trim( $_POST[ 'email' ] ) );
    		wp_update_user( $user );
    		if ( ! is_wp_error( $errors ) ) {
    			$redirect_to = add_query_arg( 'updated', true, tml_get_action_url( 'profile' ) );
    			wp_redirect( $redirect_to );
    			exit;
    		}
    		tml_set_errors( $errors );
    
    	}
    	public function customScripts ()
    	{
    		$suffix = SCRIPT_DEBUG ? '' : '.min';
    
    		$dependencies = array( 'jquery' );
    		if ( tml_is_action( 'subscriber_profile' ) && tml_allow_user_passwords() ) {
    
    			$dependencies[] = 'password-strength-meter';
    		}
    
    		wp_enqueue_script( 'theme-my-login-custom', THEME_MY_LOGIN_URL . "assets/scripts/theme-my-login$suffix.js", $dependencies, THEME_MY_LOGIN_VERSION );
    		wp_localize_script( 'theme-my-login-custom', 'themeMyLogin', array(
    				'action' => tml_is_action() ? tml_get_action()->get_name() : '',
    				'errors' => tml_get_errors()->get_error_codes(),
    		) );
    	}
    	public function getSubscriberProfile ()
    	{
    		if ( ! is_user_logged_in() ) {
    
    			$redirect_to = wp_login_url();
    
    			wp_redirect( $redirect_to );
    
    			exit;
    		}
    		ob_start();
    		$user_id = get_current_user_id();
    		$user = new WP_User( $user_id );
    
    		if ( ! empty( $user->roles ) && is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) {
    
    			?>
    			<div class="profile-form">
    				<?php
    				echo do_shortcode('[theme-my-login action="subscriber_profile"]');
    				?>
    			</div>
    
    		<?php } else {
    
    			echo do_shortcode('[theme-my-login]');
    		}
    
    		return ob_get_clean();
    	}
    }
    
    include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    
    $plugin = 'theme-my-login/theme-my-login.php';
    
    if(is_plugin_active($plugin)) {
    	$tmlCustomProfileObj = new tmlCustomProfile();
    }

    This is the outcome of the form at front end:

    <div class="tml tml-subscriber_profile">
    <form name="subscriber_profile" action="http://karmuqablalocal/profile/" method="post" enctype="multipart/form-data">
    <div class="tml-field-wrap tml-personal_options_section_header-wrap">
    <h3>Update Profile</h3></div>
    
    <div class="tml-field-wrap tml-personal_options_section_content-wrap">
    <div class="user-image"><img class="img-fluid lazy-loaded" src="http://karmuqablalocal/wp-content/themes/bridge-child/inc/images/facepicture.png" data-lazy-type="image" data-src="http://karmuqablalocal/wp-content/themes/bridge-child/inc/images/facepicture.png" alt="No Image"><noscript><img class="img-fluid" src="http://karmuqablalocal/wp-content/themes/bridge-child/inc/images/facepicture.png" alt="No Image"/></noscript></div></div>
    
    <div class="tml-field-wrap tml-profile_image-wrap">
    <label class="tml-label" for="profile_image">Profile Image</label>
    <input name="profile_image" type="file" value="" id="profile_image" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-status-wrap">
    <label class="tml-label" for="status">Status</label>
    <select name="status" id="status" class="tml-field">
    <option value="student" selected="selected">Student</option>
    <option value="teacher">Teacher</option>
    <option value="other">Other</option>
    </select>
    </div>
    
    <div class="tml-field-wrap tml-gender-wrap">
    <label class="tml-label" for="gender">Gender</label>
    <select name="gender" id="gender" class="tml-field">
    <option value="boy" selected="selected">Boy</option>
    <option value="girl">Girl</option>
    </select>
    </div>
    
    <div class="tml-field-wrap tml-school_name-wrap">
    <label class="tml-label" for="school_name">School Name</label>
    <input name="school_name" type="text" value="Army Public School" id="school_name" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-city-wrap">
    <label class="tml-label" for="city">City</label>
    <select name="city" id="city" class="tml-field">
    <option value="abbottabad">Abbottabad</option>
    <option value="astore">Astore</option>
    <option value="attock">Attock</option>
    <option value="awaran">Awaran</option>
    <option value="badin">Badin</option>
    <option value="bagh">Bagh</option>
    <option value="bahawalnagar">Bahawalnagar</option>
    <option value="bahawalpur">Bahawalpur</option>
    <option value="bajaur">Bajaur</option>
    <option value="bannu">Bannu</option>
    <option value="barkhan">Barkhan</option>
    <option value="batagram">Batagram</option>
    <option value="bhakkar">Bhakkar</option>
    <option value="bhimber">Bhimber</option>
    <option value="bhiria_city">Bhiria City</option>
    <option value="bhiria_road">Bhiria Road</option>
    <option value="bhirkan">Bhirkan</option>
    <option value="bolan">Bolan</option>
    <option value="boriri">Boriri</option>
    <option value="buner">Buner</option>
    <option value="chagai">Chagai</option>
    <option value="chak">Chak</option>
    <option value="chakwal">Chakwal</option>
    <option value="charsadda">Charsadda</option>
    <option value="chiniot">Chiniot</option>
    <option value="d_g_khan">D.G.Khan</option>
    <option value="dadu">Dadu</option>
    <option value="dera_bugti">Dera Bugti</option>
    <option value="dera_ismail_khan">Dera Ismail Khan</option>
    <option value="diamer">Diamer</option>
    <option value="digri">Digri</option>
    <option value="diplo">Diplo</option>
    <option value="dokri">Dokri</option>
    <option value="faisalabad">Faisalabad</option>
    <option value="gambat">Gambat</option>
    <option value="garhi_yasin">Garhi Yasin</option>
    <option value="ghanche">Ghanche</option>
    <option value="ghizer">Ghizer</option>
    <option value="ghotki">Ghotki</option>
    <option value="gilgit">Gilgit</option>
    <option value="gujranwala">Gujranwala</option>
    <option value="gujrat">Gujrat</option>
    <option value="gwadar">Gwadar</option>
    <option value="hafizabad">Hafizabad</option>
    <option value="hangu">Hangu</option>
    <option value="haripur">Haripur</option>
    <option value="harnai">Harnai</option>
    <option value="hattian">Hattian</option>
    <option value="hunza">Hunza</option>
    <option value="hyderabad">Hyderabad</option>
    <option value="islamkot">Islamkot</option>
    <option value="jacobabad">Jacobabad</option>
    <option value="jafarabad">Jafarabad</option>
    <option value="jamshoro">Jamshoro</option>
    <option value="jhal_magsi">Jhal Magsi</option>
    <option value="jhang">Jhang</option>
    <option value="jhelum">Jhelum</option>
    <option value="jungshahi">Jungshahi</option>
    <option value="kalat">Kalat</option>
    <option value="kandhkot">Kandhkot</option>
    <option value="kandiaro">Kandiaro</option>
    <option value="karachi">Karachi</option>
    <option value="karak">Karak</option>
    <option value="kashmore">Kashmore</option>
    <option value="kasur">Kasur</option>
    <option value="kech">Kech</option>
    <option value="keti_bandar">Keti Bandar</option>
    <option value="khadro">Khadro</option>
    <option value="khairpur">Khairpur</option>
    <option value="khairpur_nathan_shah">Khairpur Nathan Shah</option>
    <option value="khanewal">Khanewal</option>
    <option value="kharan">Kharan</option>
    <option value="kharmang">Kharmang</option>
    <option value="khipro">Khipro</option>
    <option value="khushab">Khushab</option>
    <option value="khuzdar">Khuzdar</option>
    <option value="khyber">Khyber</option>
    <option value="kohat">Kohat</option>
    <option value="kohlu">Kohlu</option>
    <option value="kolai_pallas">Kolai Pallas</option>
    <option value="korangi">Korangi</option>
    <option value="kotli">Kotli</option>
    <option value="kotri">Kotri</option>
    <option value="kurram">Kurram</option>
    <option value="lahore">Lahore</option>
    <option value="lakhi_ghulam_shah">Lakhi ghulam shah</option>
    <option value="lakki_marwat">Lakki Marwat</option>
    <option value="larkana">Larkana</option>
    <option value="lasbela">Lasbela</option>
    <option value="layyah">Layyah</option>
    <option value="lehri">Lehri</option>
    <option value="lodhran">Lodhran</option>
    <option value="loralai">Loralai</option>
    <option value="lower_chitral">Lower Chitral</option>
    <option value="lower_dir">Lower Dir</option>
    <option value="lower_kohistan">Lower Kohistan</option>
    <option value="madeji">Madeji</option>
    <option value="malakand">Malakand</option>
    <option value="malir">Malir</option>
    <option value="mandi_baha_ud_din">Mandi Baha ud din</option>
    <option value="manjhand">Manjhand</option>
    <option value="mansehra">Mansehra</option>
    <option value="maqsoodo_rind">Maqsoodo Rind</option>
    <option value="mardan">Mardan</option>
    <option value="mastung">Mastung</option>
    <option value="matiari">Matiari</option>
    <option value="mehar">Mehar</option>
    <option value="mehrabpur">Mehrabpur</option>
    <option value="mian_sahib">Mian Sahib</option>
    <option value="mianwali">Mianwali</option>
    <option value="mirpur">Mirpur</option>
    <option value="mirpur_khas">Mirpur Khas</option>
    <option value="mithani">Mithani</option>
    <option value="mithi">Mithi</option>
    <option value="mohmand">Mohmand</option>
    <option value="moro">Moro</option>
    <option value="multan" selected="selected">Multan</option>
    <option value="musakhel">Musakhel</option>
    <option value="muzaffarabad">Muzaffarabad</option>
    <option value="muzaffargarh">Muzaffargarh</option>
    <option value="nagar">Nagar</option>
    <option value="nagarparkar">Nagarparkar</option>
    <option value="nankana_sahib">Nankana Sahib</option>
    <option value="narowal">Narowal</option>
    <option value="naseerabad">Naseerabad</option>
    <option value="naudero">Naudero</option>
    <option value="naushahro_feroze">Naushahro Feroze</option>
    <option value="nawabshah">Nawabshah</option>
    <option value="neelum">Neelum</option>
    <option value="north_waziristan">North Waziristan</option>
    <option value="nowshera">Nowshera</option>
    <option value="nushki">Nushki</option>
    <option value="okara">Okara</option>
    <option value="orakzai">Orakzai</option>
    <option value="pakpattan">Pakpattan</option>
    <option value="panjgur">Panjgur</option>
    <option value="peshawar">Peshawar</option>
    <option value="pir_jo_goth">Pir Jo Goth</option>
    <option value="piryaloi">Piryaloi</option>
    <option value="pishin">Pishin</option>
    <option value="poonch">Poonch</option>
    <option value="qambar">Qambar</option>
    <option value="qasimabad">Qasimabad</option>
    <option value="qilla_abdullah">Qilla Abdullah</option>
    <option value="qilla_saifullah">Qilla Saifullah</option>
    <option value="qubo_saeed_khan">Qubo Saeed Khan</option>
    <option value="quetta">Quetta</option>
    <option value="rahim_yar_khan">Rahim Yar Khan</option>
    <option value="rajanpur">Rajanpur</option>
    <option value="rajo_khanani">Rajo Khanani</option>
    <option value="ranipur">Ranipur</option>
    <option value="ratodero">Ratodero</option>
    <option value="rawalpindi">Rawalpindi</option>
    <option value="rohri">Rohri</option>
    <option value="sahiwal">Sahiwal</option>
    <option value="sakrand">Sakrand</option>
    <option value="samaro">Samaro</option>
    <option value="sanghar">Sanghar</option>
    <option value="sann">Sann</option>
    <option value="sargodha">Sargodha</option>
    <option value="shahbandar">Shahbandar</option>
    <option value="shahdadkot">Shahdadkot</option>
    <option value="shahdadpur">Shahdadpur</option>
    <option value="shahpur_chakar">Shahpur Chakar</option>
    <option value="shahpur_jahania">Shahpur jahania</option>
    <option value="shangla">Shangla</option>
    <option value="sheerani">Sheerani</option>
    <option value="sheikhupura">Sheikhupura</option>
    <option value="shigar">Shigar</option>
    <option value="shikarpaur">Shikarpaur</option>
    <option value="sialkot">Sialkot</option>
    <option value="sibi">Sibi</option>
    <option value="sijawal_junejo">Sijawal Junejo</option>
    <option value="sinjhoro">Sinjhoro</option>
    <option value="sita_road">Sita Road</option>
    <option value="skardu">Skardu</option>
    <option value="sohbatpur">Sohbatpur</option>
    <option value="south_waziristan">South Waziristan</option>
    <option value="sudhnati">Sudhnati</option>
    <option value="sukkur">Sukkur</option>
    <option value="swabi">Swabi</option>
    <option value="swat">Swat</option>
    <option value="tando_adam_khan">Tando Adam Khan</option>
    <option value="tando_allahyar">Tando Allahyar</option>
    <option value="tando_muhammad_khan">Tando Muhammad Khan</option>
    <option value="tangwani">Tangwani</option>
    <option value="tank">Tank</option>
    <option value="thari_mirwah">Thari Mirwah</option>
    <option value="tharushah">Tharushah</option>
    <option value="thatta">Thatta</option>
    <option value="toba_tek_singh">Toba Tek Singh</option>
    <option value="tor_ghar">Tor Ghar</option>
    <option value="umerkot">Umerkot</option>
    <option value="upper_chitral">Upper Chitral</option>
    <option value="upper_dir">Upper Dir</option>
    <option value="upper_kohistan">Upper Kohistan</option>
    <option value="vehari">Vehari</option>
    <option value="warah">Warah</option>
    <option value="washuk">Washuk</option>
    <option value="zhob">Zhob</option>
    <option value="ziarat">Ziarat</option>
    </select>
    </div>
    
    <div class="tml-field-wrap tml-first_name-wrap">
    <label class="tml-label" for="first_name">First Name</label>
    <input name="first_name" type="text" value="Samia" id="first_name" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-last_name-wrap">
    <label class="tml-label" for="last_name">Last Name</label>
    <input name="last_name" type="text" value="Fakhar" id="last_name" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-email-wrap">
    <label class="tml-label" for="email">Email</label>
    <input name="email" type="email" value="m_omer106@hotmail.com" id="email" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-nickname-wrap">
    <label class="tml-label" for="nickname">Nickname</label>
    <input name="nickname" type="text" value="omer671" id="nickname" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-pass1-wrap">
    <label class="tml-label" for="pass1">New Password</label>
    <input name="pass1" type="password" value="" id="pass1" autocomplete="off" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-pass2-wrap">
    <label class="tml-label" for="pass2">Repeat New Password</label>
    <input name="pass2" type="password" value="" id="pass2" autocomplete="off" class="tml-field">
    </div>
    
    <div class="tml-field-wrap tml-indicator-wrap">
    <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite">Strength indicator</div></div>
    
    <div class="tml-field-wrap tml-indicator_hint-wrap">
    <p class="description indicator-hint">Hint: The password should be at least twelve characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).</p></div>
    
    <div class="tml-field-wrap tml-submit-wrap">
    <input name="submit" type="submit" value="Update Profile" class="tml-button">
    </div>
    
    <input name="_wpnonce" type="hidden" value="973b4fced6">
    
    <input name="user_id" type="hidden" value="1078">
    
    </form>
    </div>

    Any help would be apperciated..

    Thanx

    Plugin Author Jeff Farthing

    (@jfarthing84)

    You shouldn’t use the 0 priority on the init callbacks. The default of 10 should be fine.

    Thread Starter jacob106007

    (@jacob106007)

    I’ve fixed the issue by creating a filter in constructor everything seems to be working fine.
    Thanx for your help šŸ™‚

    
    add_filter( 'tml_is_action',array($this, 'tmlActionFilterCallback'),10,2);
    public function tmlActionFilterCallback ($is_action, $action) {
        if($action == 'subscriber_profile') {
            $is_action = true;
        }
        return $is_action;
    }
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘After submitting custom profile update form it is not going to custom call back’ is closed to new replies.