Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)

  • _
    Participant

    @viniciusandre

    I don’t know if there’s something wrong with it, but that’s the get_blog_owner, just in case.


    function get_blog_owner($blog_id = “”, $one_result = true) {
    if (!$blog_id) global $blog_id;
    if (!is_numeric($blog_id)) return “Blog ID must be an integer.”;

    global $wpdb;

    //first we’ll attempt to find the author by matching the admin email against users
    $qryAuthor = $wpdb->get_var(“SELECT ID FROM “.$wpdb->users.”, “.$wpdb->base_prefix.$blog_id.”_options WHERE option_name = ‘admin_email’ AND option_value = user_email;”);
    if ($qryAuthor) return get_userdata($qryAuthor);

    //if that fails, we’ll look for the blog administrator, user level 10
    $qryAuthor = $wpdb->get_results(“SELECT user_id FROM “.$wpdb->usermeta.” WHERE meta_key = ‘”.$wpdb->base_prefix.$blog_id.”_user_level’ AND meta_value = 10;”);
    if ($wpdb->num_rows <= 0) return false; //if there are still no results, return false
    if ($wpdb->num_rows == 1 || $one_result == true) return get_userdata($qryAuthor[0]->user_id); //if there’s only one blog admin or only want one result, we’ll return that

    //otherwise return an array of administrators
    $authors = array();
    foreach ($qryAuthor as $author) $authors[] = get_userdata($author->user_id);
    return $authors;
    }



    _
    Participant

    @viniciusandre

    This appear to be fixed on the SVN version.

    It was driving me crazy, so I gave it a try. It only seems to have some encoding issues, then. Nothing an utf8_decode/encode output can’t solve.

Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar