Well, you noticed on your line where you have this:
<?php if ($userId) { $userInfo = $facebook->api('/' . $userId); ?> Welcome <?= $userInfo['name'] ?> <?php } else { ?> <fb:login-button></fb:login-button> <?php } ?>
Instead of using $ userId, you can do this:
$userInfo = $facebook->api('/me','GET');
This will give you information about the currently registered user.
Now, the data returned by the facebook API depends on the permissions that you request from the user when the user grants permission to your site. Here you can find the list of user object data to be returned, and the corresponding permission for this, if necessary. https://developers.facebook.com/docs/reference/api/user/
Since some of the data you require, such as a mobile phone number or email address, is not required on facebook, perhaps the best approach for you is to use the registration form: https://developers.facebook.com/docs/plugins/registration/
The registration plugin allows people to easily register on your site with their Facebook account. A plugin is a simple iframe that you can get on your page. When you enter Facebook, people see a form that is filled with their information on Facebook, where necessary.
The registration plugin allows you to request additional information that is not available through the Facebook API (for example, your favorite movie). The plugin also allows people who do not have a Facebook account, or do not want to subscribe to your site using Facebook - use the same form as those who are connected to Facebook. This eliminates the need to provide you with two separate logins.
source share