WP Plugin превращает администратора в белый экран - PullRequest
1 голос
/ 29 июля 2010

Я разрабатываю плагин для WordPress и столкнулся с проблемой.

Проблема вызвана этим кодом:

<?php

function gs_subscribe_button ($type) {
    global $wpdb;
    $id = get_option('google_merchant');
    $table_name = $wpdb->prefix . "subscription_types";
    $result = mysql_query ("SELECT * FROM $table_name WHERE id = $type");

    echo '<form method="POST" action="https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/'.$id.'" accept-charset="utf-8">';

        while ($row = mysql_fetch_array($result)) {

    echo  '<input type="hidden" name="shopping-cart.items.item-1.item-name" value="'.$row['name'].'"/>
  <input type="hidden" name="shopping-cart.items.item-1.item-description" value="Your chossen Subscription"/>
  <input type="hidden" name="shopping-cart.items.item-1.unit-price" value="'.$row['price'].'"/>
  <input type="hidden" name="shopping-cart.items.item-1.unit-price.currency" value="GBP"/>
  <input type="hidden" name="shopping-cart.items.item-1.quantity" value="1"/>';

        }


    echo '<input type="hidden" name="_charset_" />';

    echo '<input type="image"
    name="Google Checkout"
    alt="Fast checkout through Google"
    src="http://checkout.google.com/buttons/checkout.gif?merchant_id=';
    echo $id;
    echo '&w=180&h=46&style=white&variant=text&loc=en_US"
    height="46"
    width="180" />';

    echo '</form>';


}

?>

Что-то в этом вызывает всех администраторовэкраны для блокировки.Есть ли способ сказать Wordpress применять функции только в интерфейсе?

1 Ответ

0 голосов
/ 29 июля 2010

решение было:

if (! Is_admin ()) { include ('template.php'); }

Не нашёл is_admin в первый раз.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...