Monday, August 19, 2013

wordpress wp_insert_user cannot login?

its a weird behaviour.
after running these code below, i wasn't able to login.
but when i request for password, the password reset works.
so, work around is, running wp_set_password after insert user:

$user = array(
          'user_login'          => $email,
          'user_password'       => $password,
          'user_email'          => $email,
          'first_name'          => $first_name,
          'last_name'           => $last_name,
          'user_registered'     => $row->updated_at

$user_id = wp_insert_user($user);

$customer = get_user_by('id', $user_id);

$customer->add_role( 'customer' );

//workaround below
wp_set_password( $password, $user_id );

Wednesday, August 14, 2013

cpanel subprocess exited with status 2

it looks like recent changes on cpanel have caused third party perl modules to fail,

tail /usr/local/cpanel/logs/error_log shows:
Can't locate Template/

to fix it, follow here:

*note: use at your own responsibilities:
rm -f /usr/bin/perl /usr/local/bin/perl
ln -s /usr/local/cpanel/3rdparty/bin/perl /usr/bin/perl
ln -s /usr/bin/perl /usr/local/bin/perl