• Resolved doctorbr

    (@doctorbr)


    How to add the image button below to the header?

    I am using the Blocksy theme and it offers two elements: HTML and button.

    My second question: How to synchronize the name when it is edited on the Google account profile?

    When the profile photo is changed in Google Account, the user avatar also changes in WordPress, but this synchronism does not happen when the name is changed.

    I would like a snippet to synchronize the name changed in Google Account profile with the name displayed publicly on WordPress, for example, when the user makes a comment.

    What can be done?

    Thanks in advance!

    • This topic was modified 6 months ago by doctorbr.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Robert

    (@robertnextendweb)

    Hi @doctorbr

    1.) Are you sure you cannot add a shortcode? I have just tried the Blocksy Theme and for me it works just fine. If it does not, then perhaps you have an old editor, in which case you could try simply writing the shortcode in the body.

    [nextend_social_login provider="google" style="icon"]

    2.) We do not provide this option, but with some custom coding you could make it happen. Please note that we are unable to provide support for custom coding of any kind, but in our developer docs:
    https://nextendweb.com/nextend-social-login-docs/backend-developer/
    you will find actions that you can use to override certain logic, for example:

    nsl_login

    Which is fired whenever the user logs in.
    So you just need to update the existing user’s first and last name based on the data from the provider instance, and also update the publicly displayed name.

    Thread Starter doctorbr

    (@doctorbr)

    Hello, @robertnextendweb

    I used the HTML element of the Blocksy theme and this shortcode to add the login button to the navigation menu

    [nextend_social_login provider="google" style="grid" labeltype="login"]

    Will I have problems with Google for lightly changed the button? Look:

    These were the modifications:

    div.nsl-container-grid .nsl-container-buttons a {
    	margin: 1px;
    }
    div.nsl-container .nsl-button-google[data-skin="dark"] .nsl-button-svg-container {
    	margin: 1px;
    	padding: 7px;
    }
    div.nsl-container .nsl-button-default div.nsl-button-label-container {
    	margin: 0 12px 0 12px;
    	padding: 10px 0;
    	font-family: Roboto !important;
    	font-size: 1rem !important;
    }

    About how to synchronize the name when it is edited on the Google account profile, I couldn’t understand what to do. Please, could you explain in detail or create a tutorial?

    P.S. I use the WPCode plugin for snippets.

    Thanks in advance. ??

    Plugin Support Robert

    (@robertnextendweb)

    Hi @doctorbr

    I am glad you managed to add the button.

    Regarding the slight modification:
    Google does have design guidelines that have to be followed, which you can find here:
    https://developers.google.com/identity/branding-guidelines
    Your modifications seem to be fine, so you are unlikely to receive backlash for it, and Google is quite lenient on such small changes, but if you do receive a notification from them or your app gets disabled, you need to remove the custom CSS codes, and use our presets instead.

    As for syncing:
    Please note that like I mentioned we do not provide custom coding service, so I cannot tell you exactly what code to use, but basically what you need to do is add an action:
    https://developer.www.ads-software.com/reference/functions/add_action/
    where the hook name would be “nsl_login”, which is fired whenever the user logs in. In the callback you get access to 2 parameters, the user_id and provider. Based on the user_id you can find what user to update:
    https://developer.www.ads-software.com/reference/functions/wp_update_user/
    From the provider instance you can access the first_name and last_name userdata. You can find a basic example here on how to use a Nextend Social Login action:
    https://nextendweb.com/nextend-social-login-docs/backend-developer/#modify-userdata

    Thread Starter doctorbr

    (@doctorbr)

    Hello, @robertnextendweb

    Fatal error: Uncaught TypeError: Cannot access offset of type string on string (…)

    After activating the code below the above error came:

    add_action('nsl_login', function($userData, $provider){
        $userData['username']=$provider->getAuthUserData('first_name').'-'.$provider->getAuthUserData('last_name');
                
        return $userData;
    },10,2);

    If you cannot provide the code to synchronize the Google account profile name, please consider updating the plugin as a suggestion. ??

    Thank you so much for all the detailed explanations and for helping me with the shortcode. ??

    Plugin Support Robert

    (@robertnextendweb)

    The problem is you are not using the action correctly. If you check the docs:
    https://nextendweb.com/nextend-social-login-docs/backend-developer/#nsl_login
    The “nsl_login” action does not give you the userData associative array, instead it gives you the user id.
    So what you are trying to do will not work, as the user id is not an array, so it cannot have the “username” key.

    Instead, inside this action you need to update the user using the “wp_update_user” WordPress function:
    https://developer.www.ads-software.com/reference/functions/wp_update_user/
    If you cannot seem to make this happen, then I would rather advise hiring a developer who could write this for you.

    Thread Starter doctorbr

    (@doctorbr)

    Wow! It would have been easier if you had shown the code. ??

    Now I miss two features in the plugin:

    • Google One Tap (pop-up);
    • Name Synchronization.

    But still, Nextend Social Login is excellent (5 stars) ??

    Thank you so much for all the help.

    • This reply was modified 5 months, 4 weeks ago by doctorbr.
    • This reply was modified 5 months, 4 weeks ago by doctorbr.
Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.