• Resolved kacsa

    (@kacsa)


    Hi,

    Can you tell me where the plugin gets the user ID?

    What I exactly want is to modify the functions.php to update a user’s ‘active’ status in a different DB, which works actually if I give the actualy ID of the user manually, but obviously I want to get that ID automatically assigned, so I can use the name that goes with the currently registering user’s ID to update the status in the other DB, with comparing the two login names.

    I saw that the functions.php uses the user ID, but no matter what part of the code I tried to copy, the result was always an empty sting, or 0.
    I hope I was clear.

    Any help is appreciated.

    Thanks,
    Kacsa

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author PickPlugins

    (@pickplugins)

    Thanks for your post.

    Sorry to say there is no filter or action hook used for checking such action for 3rd party. we should update the plugin for this purpose.

    Regards

    Thread Starter kacsa

    (@kacsa)

    So, I failed to give up, cause I like this plugin so much.
    If someone’s interested, I found a way to get it work, with a 99,99999999% success rate:
    When an activation key is generated, it is stored in the usermeta table, where I can find the user’s ID based on the activation key meta value. I could then use the ID to link the two DBs.

    I know that there’s a chance that two users can get the same key, but the probability of that is so low, I’m willing to take the risk ??

    Regards,
    Kacsa

    Thread Starter kacsa

    (@kacsa)

    While, I’m at it:
    If I’d try to modify the action-uv-registration.php file after the lines:

    update_user_meta( $user_id, 'user_activation_key', $user_activation_key ); 
    update_user_meta( $user_id, 'user_activation_status', 0 );

    adding something like:

    $conn = mysqli_connect("localhost", "user", "pass", "wp");
    $result = mysqli_query($conn, "SELECT user_id FROM wp.wp_usermeta WHERE meta_value='$user_activation_key'");
    if($result->num_rows > 1) {
    $user_activation_key =  md5(uniqid('', true) );
    update_user_meta( $user_id, 'user_activation_key', $user_activation_key );
    }
    mysqli_close($conn);

    Would that generate a new key and update the value if it finds one already in that table? Or am I completely on the wrong track here?

    If it’s a more complicated issue, then no worries, I’ll leave it as it is now.

    Regards,
    Kacsa

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get user ID’ is closed to new replies.