Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Arvid de Jong

    (@ihitro)

    Correction: The filetree does work in WP 3.7.1, but only when you connect a post.

    I does not work when you put an filetree shortcode in an page.
    Then the loading image keeps spinning.

    PS. I am using WP Filebase Pro

    The ajax file tree does not work at the frontend for me

    Forum: Plugins
    In reply to: [User Photo] Front End

    Hi Kevin,

    Here is my code:

    On the page

    <form action="<?php the_permalink(); ?>" method="post" enctype="multipart/form-data" id="adduser">
          <table class="leden">
            <tr>
              <td class="links" width="205"><strong>Profile foto</strong></td>
              <td width="10">:</td>
              <td class="rechts" width="205"><?php
    		  if(userphoto_exists($current_user)){
    		  userphoto($current_user);
    		  ?>
                <input type="checkbox" name="userphoto_delete" id="userphoto_delete" />
                Delete current photo?
                <?php
    		  }
    		 ?>
                <input type="file" id="userphoto_image_file" name="userphoto_image_file">
                <br></td>
            </tr>
            <tr>
              <td class="links"><strong>Password</strong></td>
              <td width="10">:</td>
              <td class="rechts"><input name="pass1" type="password" id="pass1" />
                (min. 4 chars)</td>
            </tr>
            <tr>
              <td class="links"><strong>Password again</strong></td>
              <td width="10">:</td>
              <td class="rechts"><input name="pass2" type="password" id="pass2" /></td>
            </tr>
            <tr>
              <td class="links"><strong>Last name</strong></td>
              <td width="10">:</td>
              <td class="rechts"><input name="last-name" type="text" id="last-name" value="<?php the_author_meta( 'last_name', $current_user->ID ); ?>" /></td>
            </tr>
            <tr>
              <td class="links"><strong>First name</strong></td>
              <td>:</td>
              <td class="rechts"><input name="first-name" type="text" id="first-name" value="<?php the_author_meta( 'first_name', $current_user->ID ); ?>" /></td>
            </tr>
            <tr>
              <td class="links"><strong>E-mail</strong></td>
              <td>:</td>
              <td class="rechts"><input name="email" type="email" id="email" value="<?php the_author_meta( 'user_email', $current_user->ID ); ?>" /></td>
            </tr>
          </table>
          <?php echo $referer; ?>
          <?php wp_nonce_field( 'vdsgvsdgcs' ) ?>
          <input name="action" type="hidden" id="action" value="update-user" />
          <a class="button mb30" href="javascript:;" onclick="document.getElementById('adduser').submit();">save</a>
        </form>

    This script does the update and you can put it above the form:

    <?php
    /* Get user info. */
    global $current_user, $wp_roles;
    get_currentuserinfo(); 
    
    /* Load the registration file. */
    require_once( ABSPATH . WPINC . '/registration.php' );
    $error = array();
    /* If profile was saved, update profile. */
    if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {
    
        /* Update user password. */
        if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {
            if ( $_POST['pass1'] == $_POST['pass2'] )
                wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );
            else
                $error[] = __('The passwords you entered do not match.  Your password was not updated.', 'profile');
        }
    
        /* Update user information. */
        if ( !empty( $_POST['email'] ) ){
            if (!is_email(esc_attr( $_POST['email'] )))
                $error[] = __('The Email you entered is not valid.  please try again.', 'profile');
            elseif(email_exists(esc_attr( $_POST['email'] )) != $current_user->ID && email_exists(esc_attr( $_POST['email'] )) != false)
                $error[] = __('This email is already used by another user.  try a different one.', 'profile');
            else{
    			wp_update_user( array ('ID' => $current_user->ID, 'user_email' => esc_attr( $_POST['email'] )));
            }
        }
    
        if ( !empty( $_POST['first-name'] ) )
            update_user_meta( $current_user->ID, 'first_name', esc_attr( $_POST['first-name'] ) );
        if ( !empty( $_POST['last-name'] ) )
            update_user_meta($current_user->ID, 'last_name', esc_attr( $_POST['last-name'] ) );
        if ( !empty( $_POST['description'] ) )
            update_user_meta( $current_user->ID, 'description', esc_attr( $_POST['description'] ) );
    
        /* Redirect so the page will show updated info.*/
      /*I am not Author of this Code- i dont know why but it worked for me after changing below line to if ( count($error) == 0 ){ */
        if ( count($error) == 0 ) {
            //action hook for plugins and extra fields saving
           // do_action('edit_user_profile_update', $current_user->ID);
            wp_redirect( get_permalink() );
            exit;
        }
    }
    ?>

    I hope it helps

    Forum: Plugins
    In reply to: [User Photo] Front End

    Hi,

    I tried also several things to upload @ the frontend but no results.
    It seems the system does not see the upload $_FILES['userphoto_image_file'].

    Does someone have a workaround?

    Ps. The delete function is working perfectly.

    Regards

    UPDATE: SOLVED
    I forgot the following line in my form. <form enctype="multipart/form-data" >

Viewing 4 replies - 1 through 4 (of 4 total)