RDP Linkedin Login free WordPress plugin
Description
RDP Linkedin Login free WordPress plugin
RDP Linkedin Login provides:
Login button shortcode – shows a Sign in with LinkedIn button when logged out
Ability to register a visitor with the WordPress installation
Ability to push newly-registered visitor info to another site that is also using RDP Linkedin Login
Ability to display member count for a site
Ability to display the member count from another site that is also using RDP LinkedIn Login
Logged-in session security using nonces and client IP address
OOP with hooks and filters for easy integration and customization
Ability to set an after-login redirect url, by using a custom JavaScript function
Ability to run custom JavaScript code after login, by defining a rdp_ll_login_onClose function
Support
Posting to the WordPress.org Support Forum does not send me notifications of new issues. Therefore, please send support requests using the contact form on my web site.
Sponsor
This plug-in brought to you through the generous funding of Laboratory Informatics Institute, Inc.
Usage
To display a Sign in with LinkedIn button, use the [rdp-linkedin-login] shortcode in a widget or page.
To display the member count, add the [rdp-linkedin-login-member-count] shortcode to a widget.
It is also possible to display the member count from another site that is also using the RDP LinkedIn Login plugin. Simply use the optional url attribute, by adding rdpllaction/member_count to the target domain.
example:
[rdp-linkedin-login-member-count url=http://www.example.com/rdpllaction/member_count]
External Scripts Included
JS Cookie v2.0.4 under MIT License
jQuery.PositionCalculator v1.1.2 under MIT License
Hook Reference:
rdp_ll_before_user_login
Param 1: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Param 2: RDP_LL_DATAPASS object
Fires before attempting to register or log-in a user.
rdp_ll_after_insert_user
Param 1: WP_User object
Param 2: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Fires after a new user is registered with the site. (Register New Users? must be enabled)
rdp_ll_after_user_push
Param 1: WP User Object
Param 2: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Param 3: Array of results including HTTP headers or WP_Error if the request failed
Fires after a new user’s LinkedIn information is pushed to another site. (Register New Users? must be enabled)
rdp_ll_after_registered_user_login
Param: WP User Object
Fires after a registered user is logged into the site. (Register New Users? must be enabled)
rdp_ll_registered_user_login_fail
Param: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Fires after a failed attempt to log registered user into the site. (Register New Users? must be enabled)
rdp_ll_after_user_login
Param 1: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Param 2: RDP_LL_DATAPASS object
Fires after attempting to register or log-in a user.
rdp_ll_after_scripts_styles
Param: none
Fires after enqueuing plug-in-specific scripts and styles
Filter Reference:
rdp_ll_render_login
Param 1: String containing log-in HTML for the [rdp-ingroups-login] shortcode
Param 2: String containing status – ‘true’ if user is logged in, ‘false’ otherwise
Return: log-in HTML for the [rdp-ingroups-login] shortcode
rdp_ll_before_insert_user
Param 1: WP_User->ID or false if the user ID does not exist in the usermeta table, based on search for LinkedIn user token id and meta_key = _rdp_ll_id
Param 2: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Return: WP_User->ID or false, if the user does not already exist in WordPress
rdp_ll_before_registered_user_login
Param 1: Boolean indicating if user is logged in based on result of WordPress is_user_logged_in() function
Param 2: JSON object representing a LinkedIn Person containing firstName, lastName, emailAddress, pictureUrl, id, public-profile-url, location, headline and summary
Param 3: WP_User->ID or false, if the user does not already exist in WordPress
Return: Boolean indicating if user is logged in
rdp_ll_custom_menu_items
Param 1: Array to hold custom link data
Param 2: String containing status – ‘true’ if user is logged in, ‘false’ otherwise
Return: Array of links, where the link text is the key and the link URL is the value
rdp_ll_actions_submenu
Param: String containing HTML of popup actions menu, which appears after clicking on the picture or name displayed by the plugin, after a person is logged in
Return: String containing HTML of actions menu
rdp_ll_app_scope_filter
Param: String containing default LinkedIn application scopes
Return: String containing LinkedIn application scopes, each separated by a space
rdp_ll_app_profile_parameters_filter
Param: String containing default LinkedIn application profile parameters
Return: String containing LinkedIn application profile parameters
Javascript Function Reference:
rdp_ll_login_onClose
Param: redirect URL
Fires upon successful log-in, just before the log-in pop-up window closes.
Redirect Code Example
In this example, all links with class rdp_jb_must_sign_in are assigned an event listener that sets a cookie, with the cookie value derived from the link’s href attribute. The cookie name should always be rdp_ll_login_redirect.
When the pop-up log-in window executes its close script, the function rdp_ll_login_onClose is called, and it reloads the page to show that the visitor is logged in. In the document.ready() function, the cookie is read, then deleted, and the parent window is redirected to the appropriate URL.
Example Code of Custom Sign-In JavaScript File
var $j=jQuery.noConflict(); // Use jQuery via $j(…) $j(document).ready(rdp_sign_in_onLoad); function rdp_sign_in_onLoad(){ var redirectPath = Cookies.get(‘rdp_ll_login_redirect’); var loggedIn = $j(‘body’).hasClass(‘logged-in’); if(loggedIn && redirectPath && redirectPath != ‘undefined’){ Cookies.remove(‘rdp_ll_login_redirect’, { path: ‘/’ }); window.location.href = redirectPath; } $j(‘#rdp-jb-main’).on( “click”, ‘.title.rdp_jb_must_sign_in’ , function(event){ event.preventDefault(); var redirectURL = $j(this).attr(‘href’); var date = new Date(); date.setTime(date.getTime()+(30*1000)); Cookies.set(‘rdp_ll_login_redirect’, redirectURL, {expires: date, path: ‘/’ }) }); }//rdp_sign_in_onLoad function rdp_ll_login_onClose(redirect_url){ window.location.reload(); }//rdp_ll_login_onClose