[wp-hackers] Check to see if there a wordpress user account and create one if not outside of wordpress

Alex Rayan alexrayan69 at gmail.com
Tue Nov 19 14:34:35 UTC 2013


Hi Daniel,

Glad to hear you progressed with your task. No need to credit me. It's an
open community to share knowledge.

Best regards,
Alex


On Mon, Nov 18, 2013 at 6:36 PM, Daniel <danielx386 at gmail.com> wrote:

> Hi Alex,
>
> I managed to get 95% of what I'm after going, the other 5% is info
> that I'm trying to pull from phpBB and I'm going to ask over there
> because it looks like an issue on phpBB and not WordPress side.
>
> Alex please let me know how you want me to credit you (Got a website?)
> and I'll do that right away.
>
> Thank-you :)
>
> Daniel
>
>
>
>
>
>
> On Tue, Nov 19, 2013 at 1:52 AM, Alex Rayan <alexrayan69 at gmail.com> wrote:
> > Hi Danial,
> >
> > Yes, in order to user wordpress core functions you would need to include
> > wp-load.php or call your script from within a custom wordpress template
> > page, for example.
> > If the password is not a plain text, you could generate a random password
> > and ask a user to update it after. wp_insert_user only accepts a plain
> text
> > password since it applies required hashing on it after.
> >
> > Hope it worked for you. : )
> >
> > Best regards,
> > Alex
> >
> >
> > On Sun, Nov 17, 2013 at 7:08 PM, Daniel <danielx386 at gmail.com> wrote:
> >
> >> Hi Alex,
> >>
> >> Thank-you for getting back to me,  now I take it that I should be able
> >> to use the script that you provided (I know that it need some editing)
> >> after I done the usual  "include '/../../../wp-load.php';"?
> >>
> >> Also what should I do if the password is not in plain text? (I'm not
> >> entirely sure if the "$password" is still alive at that point of the
> >> script, it's going right after someone logged into phpbb, I will need
> >> to check on that)
> >>
> >> Having said that I will give it a go and see how I go :)
> >>
> >> Thank-you again Alex :)
> >>
> >> Regards,
> >> Daniel
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Mon, Nov 18, 2013 at 10:55 AM, Alex Rayan <alexrayan69 at gmail.com>
> >> wrote:
> >> > Hi Daniel,
> >> >
> >> > I'm sorry I don't have time to go through your whole script, but to
> check
> >> > whether the user exists you can use:
> >> > if( !email_exists( $email )) {
> >> > }
> >> > and to pass email that you would like to check against.
> >> > Then if the email is not found in the database, you can create a new
> user
> >> > account as follows:
> >> >
> >> > $args = array(
> >> > 'user_pass'=>$plain_text_pass,
> >> > 'user_login'=>$username,
> >> > 'user_nicename'=>$url_friendly_name,
> >> > 'user_email'=>$user_email,
> >> > 'display_name'=>$display_name
> >> > );
> >> > $user_id = wp_insert_user($args);
> >> >
> >> > You can check a full list of arguments that you can pass here:
> >> > http://codex.wordpress.org/Function_Reference/wp_insert_user
> >> >
> >> > Also, it's probably a good idea to check for username_exists before
> >> passing
> >> > a username in case that one is already taken. Then, you could, for
> >> example,
> >> > append a number at the end of the username.
> >> >
> >> > On success the function above returns user_id.
> >> >
> >> > Hope it helps.
> >> >
> >> > Best regards,
> >> > Alex
> >> >
> >> >
> >> > On Sun, Nov 17, 2013 at 5:34 PM, Daniel <danielx386 at gmail.com> wrote:
> >> >
> >> >> Hi guys,
> >> >>
> >> >> Just wondering, does anyone know how I can go about checking to see
> if
> >> >> there a wordpress account and create one if there isn't?
> >> >>
> >> >> Script that I got: https://gist.github.com/Danielx64/7519092
> >> >>
> >> >> There a marker in the file that has "// Somewhere here I want to put
> a
> >> >> check to see if there a wp account" What I want to happen there is
> >> >> that a check get done to see if there is a wordpress account and if
> >> >> there not, create one.
> >> >>
> >> >> Does anyone know if it can be done?
> >> >>
> >> >> PS, I don't need to worry about logging into wordpress as that will
> >> >> get taken care of by a different script. Also anyone who can help me
> >> >> out will also get credit in the source code and readme :)
> >> >>
> >> >> Regards,
> >> >> Daniel
> >> >> _______________________________________________
> >> >> wp-hackers mailing list
> >> >> wp-hackers at lists.automattic.com
> >> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> >>
> >> > _______________________________________________
> >> > wp-hackers mailing list
> >> > wp-hackers at lists.automattic.com
> >> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >> _______________________________________________
> >> wp-hackers mailing list
> >> wp-hackers at lists.automattic.com
> >> http://lists.automattic.com/mailman/listinfo/wp-hackers
> >>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list