• Resolved elonden

    (@elonden)


    Is there a way to exclude the non-active sites from the dropdown list.

    Reason is that I have a few “template” sites which are in a deactive state. These sites still pop up in the selector list but obviously when someone selects this it will return a “This site is no longer available” message.

    I would be great if by default all the non-active sites are excluded from the drop-down list.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter elonden

    (@elonden)

    I assume an additional negatecriteria needs to be added to this section:

    //show all sites from the WMN
    function showAll(){

    $out = ”;
    $all_wmn_sites = get_sites();
    $current_site_id = get_current_blog_id();

    foreach ($all_wmn_sites as $site) {
    if ($current_site_id != $site->blog_id) {
    $the_site = get_blog_details($site->blog_id);
    $out .= “<option value='” . $the_site->siteurl . “‘>” . $the_site->blogname . “</option>”;
    }
    }

    return $out;
    }

    Plugin Author alordiel

    (@alordiel)

    Hello,

    Sorry for the late answer. I have not thought of this, but it is easy to solve.
    You can make the following change in the code:

    foreach ($all_wmn_sites as $site) {
    	if($site->deleted || $site->archived || $site->spam){
    		continue;
    	}
    	if ($current_site_id != $site->blog_id) {
    		$the_site = get_blog_details($site->blog_id);
    		$out .= "<option value='" . $the_site->siteurl . "'>" . $the_site->blogname . "</option>";
    	}
    }

    Strangely enough $site->deleted is the option to check if a site is active or deactivated.
    I will make sure to include this as an option in the next update.

    Regards,
    al

    Plugin Author alordiel

    (@alordiel)

    Hello,

    Just to let you know that in the latest version (0.6) I have included the check above so no deleted, archive or spam site will be shown in the list.
    Also marking this a solved.
    Please let me know if any issues.

    Regards,
    Al

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

The topic ‘Exclude non-active sites’ is closed to new replies.