Hello,
First I suggest you upgrade to 1.19 and 1.3.1 (if you don’t have a download link for the MU version use my contact page to send me your license number and I will send you one)
Now, to answer your question, it depends where you want to show those figures. If you want to show them as part of the output of the shortcode then I suggest you customize the templates and make your calculations there.
If it’s part of another process then you can use the following code:
$profile = wp_linkedin_get_profile(LINKEDIN_FIELDS, LINKEDIN_PROFILELANGUAGE);
If you want to retrieve for a specific user ID:
$GLOBALS['li_user_id'] = xxx;
$profile = wp_linkedin_get_profile(LINKEDIN_FIELDS, LINKEDIN_PROFILELANGUAGE);
unset($GLOBALS['li_user_id']);
$profile contains the full profile as an object and is cached
Thank you for your answer!
I would like to retrieve them for every user. I mean, I don’t need to show them anywhere, just at some point when profile will be imported for the first time I would like to capture the number of for example skills and depend from the number at that moment, give some points via MyCRED plugin.
The following examples that you gave me, I’m not sure how to use it. Which file I suppose to edit? Is it class-linkedin-connection.php? If yes, in which line I should insert my code?
Or could I hook action? If yes, then which action it will be?
I suggest you make your calculations in the shortcode template and give your “points” at that time but the use case seems strange since your users will get their points only once someone displayed their profile. If nobody look at that profile then no points will be given.
To customize a template, create a linkedin
folder in the wp-content
folder of your installation, then copy the template you want to customize (in your case profile.php
) and make your modifications on that copy.
No, I don’t want to give points when somebody looks at the profile. I want to give points the moment when user first time presses the button etc “Import my LinkedIn” to give access token then it’s redirected to LinkedIn to enter username/pass and redirected back to where he came from.
As I understand at that moment LinkedIn profile is retrieved from LinkedIn. Then I would like to count skills and recommendations and give points.
Ouf course I’m not sure if it’s correct, because I’m not sure if I understand the way plugin works. Does the user LinkedIn info is retrieved once and stored somewhere? Or does it retrieved every time when user profile is displayed?
the profile is not retreived and stored when the user connect their account, it’s only retreived when it’s needed. Also, it’s temporarily cached for performance reasons but it’s retreived again each time it’s displayed.
there’s no way you can hook up the token retreival process to include your calculations. Beside, even if you could, it would be triggered again each time the token needs to be refreshed.