WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] get the admin username of a multisite blog (5 posts)

  1. stevenss
    Member
    Posted 1 year ago #

    Hello

    I use the function get_userdata (username) to get a variable file.
    So eg the user (=admin and only user of a multisite blog) "test" would see the content of the file:
    ....com/folder/'.$username.'.txt = ....com/folder/test.txt

    This works, though this is for a multisite and I would like the superadmin to see the same content...but of course the admin won't see the same since wordpress then pulls the content of the file ....com/folder/superadmin.txt, which doesn't exist.

    So I would like a function that doesn't get the username of the logged in user, but the username of the admin of the current blog, so the username sees the same content as the admin of the blog.

    Is there such a function? If so, it would be great if you could show it.

    Thanks in advance
    Steven

  2. andrewmills
    Member
    Posted 1 year ago #

    Hi, Steven. I'm not completely certain if this is what you are looking for, but have you tried get_admin_users_for_domain?

    Based on what I'm reading, it may be possible for multiple names to be returned if a particular site has more than one admin level user.

  3. stevenss
    Member
    Posted 1 year ago #

    That will work.

    Thanks!

  4. andrewmills
    Member
    Posted 1 year ago #

    You're welcome. When you consider this matter resolved, could I ask you to change the status of this thread to resolved? Thank you.

  5. stevenss
    Member
    Posted 1 year ago #

    Ok ;)

Topic Closed

This topic has been closed to new replies.

About this Topic