item()) { return; } // Locate the record for the user that created the current item. // Their name will be displayed as part of the contact link. $userDetails = ORM::factory("user") ->where("id", $theme->item->owner_id) ->find_all(); // Create a new block to display the links in. $block = new Block(); $block->css_id = "g-contact-owner"; $block->title = t("Contact:"); $block->content = new View("contactowner_block.html"); // if $displayBlock is true, this block will be displayed, // if there aren't any links to put in the block for whatever reason // then $displayBlock will rename set to false and the // block will not be displayed. $displayBlock = false; // Figure out if the contact item owner email link should be displayed. // only display it if the current owner has an email address and // the option for allowing item owners to be contacted is set to true. if ((count($userDetails) > 0) && ($userDetails[0]->email != "") && (module::get_var("contactowner", "contact_user_link") == true)) { $block->content->userLink = "item->owner_id) . "\">" . t("Contact") . " " . $userDetails[0]->name . ""; $displayBlock = true; } // Figure out if the contact site owner link should be displayed. if (module::get_var("contactowner", "contact_owner_link")) { $block->content->ownerLink = "" . t(module::get_var("contactowner", "contact_button_text")) . ""; $displayBlock = true; } if ($displayBlock) { return $block; } } }