WordPress.org

Forums

[resolved] Having Trouble with add_user_to_blog (2 posts)

  1. mburtis
    Member
    Posted 3 years ago #

    I'm working on a custom function that's hooked to the submission of a Gravity Form. Basically, the user who fills out the form who has an account on the Multisite install but is NOT a user of the blog gets added as an author when the form is submitted.

    I'm doing this by using add_user_to_blog, but the results I'm getting are odd. After submission, if I go to the Users page for the blog, no users are listed, BUT the tally number for "Authors" goes up in the summary of users above the table.

    If I go to my global tables and look at wp_usermeta there are new rows for the user being added to the blog with the proper capability and role.

    Is the information about the users on a blog in multisite stored somewhere else that is referenced when the users table is built? What am I missing?

    Here's the function I'm using (although, I don't think there's anything really wrong with it. It's doing what it's supposed to be doing, I think, in terms of adding the rows to wp_usermeta):

    function gb_add_user($entry) {
    
    $user_id = $entry['created_by'];
    
    add_user_to_blog(6866, $user_id, 'Author');
    }
  2. mburtis
    Member
    Posted 3 years ago #

    Never mind. I figured it out. I was capitalizing the role name and it needs to be all lower case. You'd think I'd have noticed. . .

Topic Closed

This topic has been closed to new replies.

About this Topic