WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Social Login
Has anyone got this working with WishList Member? (4 posts)

  1. lelandf
    Member
    Posted 5 months ago #

    First of all, I think this is the best social login solution available on WordPress.org. Can't believe others actually try to charge people for the "service" of social logins (even though that's already provided by social networks, for free).

    Basically, my question is exactly what it reads in the thread title. If you've got this working with WishList Member, I'd love to hear from you.

    The problem with WishList is it's closed source (they use obfuscation techniques that would never be allowed on WordPress.org), and their "documentation" leaves much to be desired. Unfortunately this is a client project and they're stuck on WishList.

    Basically all I need is a code snippet with how to automatically assign a WishList member level to a user. I can figure everything else out on my own with available hooks in both plugins.

    I'd really appreciate any guidance on this. I realize this isn't exactly WordPress Social Login support, it's more like a customization/integration request mostly related to another plugin.

    If you're a mod and feel the need to remove my post, feel free to do so, but I hope that if a solution is found, other users can benefit from that...for free.

    http://wordpress.org/plugins/wordpress-social-login/

  2. HappyPlugins
    Member
    Posted 5 months ago #

    Hi

    We are doing custom development for Wishlist Member & WordPress and and this your issue actually is very simple with even getting into the code of Wishlist Member

    All you need is add_action to 'user_register' hook.

    Write a custom function that use Wishlist Member API to add every one that is registering to a specific level on Wishlist Member.

    You can use the Wishlist Member API documentation for more information about that.

    You can also follow HappyPlugins Blog there we publish there code snippets for various membership and eCommerce platforms.

  3. lelandf
    Member
    Posted 5 months ago #

    Hey happyplugins,

    Thanks so much for the response. I understand the part about the hooks, etc. What I'm unsure of what exactly the custom function should be.

    Judging from the Codex page on user_register the basic shell of the function would go like this:

    add_action('user_register', 'lelandf_wishlist_addmember');
    
    function lelandf_wishlist_addmember($user_id) {
    
    // Code to assign WishList member level to a user ID goes here
    
    }

    Now referring to the WishList API documentation PDF, I'm guessing it has some combination with the "PUT: Updating Data" section on page 8 and the "POST Adds a member to a membership level" section on page 12.

    I'll look into it more and update here on my findings. Any additional guidance would be appreciated as well.

    WordPress Social Login also provides their own hooks related to user registration, perhaps those would be effective as well.

  4. HappyPlugins
    Member
    Posted 5 months ago #

    Regarding Social Login registration hook it does not really matter which one you use.

    You just need to use a one that is sending you the user ID that has been registered.

    As for the code:

    You will need to build an array for all the parameters and then transfer it to the Wishlist API

    $level_id is the Wishlist level number

    $data = array ( "Users" => array ($user_id));
    
    $api = $this->loadAPI();
    $response = $api->post('/levels/'.$level_id.'/members/', $data);

    This is the loadAPI functions

    private function getAPIkey()
        {
            global $wpdb;
            $table = $wpdb->prefix . 'wlm_options';
            $query = "
    				SELECT option_value
    				FROM $table
    				WHERE option_name = 'WLMAPIKey'
    				";
            $key   = $wpdb->get_results($query);
            return $key[0]->option_value;
        }
    
        public function loadAPI()
        {
            $api = new wlmapiclass(site_url() . '/', $this->getAPIkey());
            $api->return_format = 'php';
            return $api;
        }

    Hope this is helpful

    We will publish later a post with more information about this process on our blog and link here.

Reply

You must log in to post.

About this Plugin

About this Topic