WordPress.org

Support

Support » Plugins and Hacks » WordPress Social Login » Has anyone got this working with WishList Member?

Has anyone got this working with WishList Member?

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    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.

    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.

    Hi, we have a new plugin that was developed exactly for WishList Member social login and registration. If you are still interested, you can check it out here: http://wlmsocial.com

    Kind Regards
    SD

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Has anyone got this working with WishList Member?’ is closed to new replies.
Skip to toolbar