WordPress.org

Ready to get started?Download WordPress

Forums

WP-FacebookConnect
Can WP-FacebookConnect users be WP "Authors"? (5 posts)

  1. be7
    Member
    Posted 3 years ago #

    WP-FacebookConnect users apparently can only leave comments. Can they be WP "Authors" so that they can make new posts?

  2. ahupp
    Member
    Plugin Author

    Posted 3 years ago #

    An existing administrator can change the user's role in the admin console to anything they want, including administrator or author.

    -Adam

  3. lilqhgal
    Member
    Posted 3 years ago #

    I use wordpress for online publishing for a public facing website. It would be tedious to do this for every single new user. Can it be done initially via some sort of code so it's not required to do it for every single user?

  4. Jacob Dunn
    Member
    Posted 3 years ago #

    You could use a plug-in like role-scoper to modify the default permissions of subscribers so that they're able to create new posts. Then, no role changes would be necessary, and you could keep actual administrators separate from facebook-connect users in your user administration, as well.

  5. crisss1205
    Member
    Posted 3 years ago #

    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;
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic