Forum Replies Created

Viewing 1 replies (of 1 total)
  • crisss1205

    (@crisss1205)

    Go to the flugin and edit it. In the “common.php” file go down to the PHP function “fbc_insert_user()” and change the role to “author”.

    In the end it should look like this.

    function fbc_userinfo_keys() {
      return array('name',
                   'first_name',
                   'last_name',
                   'profile_url');
    }
    
    function fbc_insert_user($fbuid) {
    
      $userinfo = fbc_anon_api_client()->users_getInfo(array($fbuid),
                                                       fbc_userinfo_keys());
    
      if ($userinfo === null) {
        error_log('wp-fbconnect: empty query result for user ' . $fbuid);
      }
    
      $userinfo = $userinfo[0];
    
      $fbusername = 'fb' . $fbuid;
      if (username_exists($fbusername)) {
        return FBC_ERROR_USERNAME_EXISTS;
      }
    
      $userdata = fbc_userinfo_to_wp_user($userinfo);
      $userdata += array(
        'user_pass' => wp_generate_password(),
    
        /*
          WP3.0 requires an unique email address for new accounts.  We might
          not have one, so give it a unique and identifiably fake address.
        */
        'user_email' => $fbusername.'@wp-fbconnect.fake',
        'user_login' => $fbusername,
        /*
          In the event this blog is configured to setup new users as
          admins, don't apply that to fbconnect users.
         */
        'role' => 'author'
      );
    
      $wpuid = wp_insert_user($userdata);
      // $wpuid might be an instance of WP_Error
      if($wpuid && is_integer($wpuid)) {
        update_usermeta($wpuid, 'fbuid', "$fbuid");
      }
    
      return $wpuid;
    }
Viewing 1 replies (of 1 total)