• Resolved jmayorga9112

    (@jmayorga9112)


    hi, im trying to check if a file was uploaded by an user and i want to check it everytime it logs in.

    by now i got this from the examples but it doesn’t working showing the msg

    add_action( ‘um_user_login’, ‘my_user_login’, 10, 1 );
    function my_user_login( $args ) {

    $id= get_current_user_id();
    echo “user id is”.$id;
    if ( empty(“wp_content\uploads\ultimatemember\”.$id) ) {
    echo “no file was uploaded”;
    }

    }

    obviously the string is bad coded but the exmple is something like that.
    the thing is not even the first echo statement is showing either home, account nor profile page.

Viewing 1 replies (of 1 total)
  • Hey @jmayorga9112

    You want to check if the file exists.

    
    add_action( ‘um_user_login’, ‘my_user_login’, 10, 1 );
    
    function my_user_login( $args ) {
       $user_id = get_current_user_id();
       $file_name = 'ENTER NAME OF FILE YOU ARE LOOKING FOR HERE';
       $file = UM()->uploader()->get_upload_base_url() . $user_id . "/" . $file_name;
       if ( ! file_exists( $file ) ) {
          echo “no file was uploaded”;
       } 
    }
    

    Just enter the file name and this should give you the results you are looking for.

Viewing 1 replies (of 1 total)

The topic ‘um user login’ is closed to new replies.