Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ProfileGrid Support

    (@profilegrid0)

    Hello @gbordormor22,

    Thank you for writing to us.

    As of now, plugin does not have this feature. However, Could you please elaborate on your requirement so we can help you with a possible solution.

    Thread Starter gbordormor22

    (@gbordormor22)

    Thank You for your reply. It really made me happy.

    Here are 3 Scenarios:

    SCENARIO 1:
    A Social network using ProfileGrid wants its members to have a Member Number represented by “MN” — as seen here– https://prnt.sc/YeDfvp7wneVv

    SCENARIO 2:
    This is a School Alumni Website– where there’s no payment for anything. Past students just register and create Account.

    Then a Unique ID is generated for them, to be shown on their Profile Page.

    SCENARIO 3:
    A Laundry Business wants its customers to Register through WooCommerce My-Account Page.

    Then when the Customers have submitted their clothes to the Laundry Business for washing, the Unique ID is the Reference number that the Customer quotes to the company, in order to look for their Clothes. As you can see here– https://prnt.sc/o07lm-UVtkFa

    These are 3 possible Scenarios. The Numbering Prefix would be different, but the Logic is the same.

    Meaning that, for the Social Network website, the Prefix is “MN” for Member Number.

    For the Alumni Website, the Prefix is “STN” for Student Number. While for the Laundry Business, the Prefix is “Tag Number”.

    Here is the Numbering Logic:

    There will be a Prefix, then number counts from 1 to infinity.

    By the Time we get to the One Millionth Member, the number for the Social Network’s Member Number will be MN: 1,000,000.

    By the 1 Bilionth Member, the Number will be too long. So I imagined Batch Number Range– the method of splitting the Site Members or Users into smaller units called “Batches”.

    So, if I set 10,000 as the Batch Range. It means that when I hit Member 10,000(Ten Thousand), the Number will be MN: 10,000 /BN1—- with BN1 representing Batch Number 1.

    When the number is 10,001, this one additional person will fall into Batch 2, and his Unique ID will be MN:1/BN2.

    So that after every 10,000(being the Batch Range that I have set), the Number starts counting from 1 again, but the Batch Number(represented by “BN“) continues to grow from 1 to 2 to 3, after every 10,000 person.

    This is the Numbering Logic. And I do hope you understand?

    Now, I got this Code from here– https://wordpress.stackexchange.com/questions/65738/create-unique-id-for-user

    add_filter("user_register", "get_unique");
    function get_unique($user_id){
        $prefix = "MN:";
        do {
            $unique = mt_rand();
            $unique = substr($unique, 0, 3);
            $unique = $prefix . $unique;
        } while (!check_unique($unique));
        return update_usermeta( $user_id, 'memnumber', $unique );//$unique;
    }
    function check_unique($unique) {
        global $wpdb;
        $result = $wpdb->get_var("SELECT meta_value from $wpdb->usermeta where meta_key='memnumber' AND meta_value = '$unique'");
        if(empty($result))
            return true;
        return false;
    }

    ==========================
    The challenge is that I don’t know PHP. I only know how to insert PHP Code Snippets into my Child Theme’s Functions.PHP file.

    Instinctively, I feel that my answer is somewhere in that code.

    QUESTION 2:
    Can you Please help me look to that Page, and look at the Codes there, to see if they can provide my solution?

    My Point is that, what I am looking for, is not impossible. I’ve just not found it yet, in WordPress.

    So, can you Please help me take a look here– https://wordpress.stackexchange.com/questions/65738/create-unique-id-for-user

    —- to see how that Page could provide solution for me?

    Needing to hear from you soon.

    Regards.

    Special Regards.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom User ID functionality’ is closed to new replies.