Viewing 1 replies (of 1 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    2.6.3 included a change to the wpmem_a_activate_user function to better utilize native WP functions. It went from using $wpdb->update to wp_update_user. This allowed removing the process of hashing the password as wp_update_user does this automatically.

    The new function seems to operate fine when called by the bulk user management (Users > WP-Members) where you can activate one or many users.

    However, there seems to be situations where the function can hang when called from the individual user-edit page. I have not determined what is causing this but I have isolated that it is occurring exactly at the point that the function calls wp_update_user. This is odd because wpmem_a_activate_user works fine when used by the bulk management page.

    At present, there is a workaround, but I would like to be able to isolate exactly why wp_update_user hangs in these one-off situations (since it is used successfully elsewhere around the plugin).

    So, for users currently effected by this you have two easy choices:

    1. Simply activate users from the bulk user management page. You can activate one at a time, or several at once. OR…

    2. Make a change to wpmem_a_activate_user found in wp-members-admin.php as follows:

    1. Go to Plugins > Edit and select WP-Members from the list
    2. Select wp-members-admin.php from the Plugin Files
    3. Locate the function wpmem_a_activate_user (it is near the bottom in the Bulk User Management Section – using “find” in your browser should make this easier)
    4. The function there should look like this:
      function wpmem_a_activate_user( $user_id )
      {
      	$new_pass = wp_generate_password();
      	wp_update_user( array ( 'ID' => $user_id, 'user_pass' => $new_pass ) );
      
      	if( WPMEM_USE_EXP == 1 ) { wpmem_set_exp( $user_id ); }
      
      	require_once( 'wp-members-email.php' );
      
      	wpmem_inc_regemail( $user_id, $new_pass, 2 );
      	update_user_meta( $user_id, 'active', 1 );
      }

      Replace it with this:

      function wpmem_a_activate_user( $user_id )
      {
      	$new_pass = wp_generate_password();
      	$new_hash = wp_hash_password( $new_pass );
      
      	global $wpdb;
      	$wpdb->update( $wpdb->users, array( 'user_pass' => $new_hash ), array( 'ID' => $user_id ), array( '%s' ), array( '%d' ) );
      
      	if( WPMEM_USE_EXP == 1 ) { wpmem_set_exp( $user_id ); }
      
      	require_once( 'wp-members-email.php' );
      
      	wpmem_inc_regemail( $user_id, $new_pass, 2 );
      	update_user_meta( $user_id, 'active', 1 );
      }

    5. Click Update File and you’re done.

    If I am unable to figure out why wp_update_user is hanging in these instances, then I will be including the above change in the next release.

    BTW… Are you aware you started two threads on this topic?

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP-Members] Moderate registration U get a 404 error.’ is closed to new replies.