WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Default User/Site Owner label (3 posts)

  1. ktrusak
    Member
    Posted 1 year ago #

    I am setting up a contact form and am trying to set the form to automatically point to the email of the user who registered the site (their role is set to author). Is there a function or label in wordpress for the user who registered the current site?

    Gravity forms already has a hook to alter where the notification is sent, I am just hoping WordPress has a function built in for 'site owner' or 'registered user' or something? This is what I tried (I think I am messing up lines 3-6 a bit):

    add_filter("gform_notification_email_1", "change_notification_email", 10, 2);
    function change_notification_email($email, $entry){
        $blogusers = get_users('role=author');
        foreach ($blogusers as $user) {
            return $user->user_email;
        }
    }

    Help is sincerely appreciated on this one, I am not sure where to start looking...

  2. There's no way to see who 'registered' the site. You could (like you're trying) cull a list of people who are on that site as authors, but that's as good as it'll get.

  3. ktrusak
    Member
    Posted 1 year ago #

    Okay, I will try to get that code working then

Topic Closed

This topic has been closed to new replies.

About this Topic