Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am currently working on a simple plugin. Activating my plugin works fine. However, I can't activate any other plugin as long as mine is active. Also, the edit links won't work.

Any help with this would be great! Below is the code for the main plugin file sponsoren.php

<?php  
/* 
Plugin Name: Sponsoren
Plugin URI: 
Version: 
Author: 
Description: 
*/  

// Enqueue Scripts
add_action( 'admin_enqueue_scripts', 'sponsoren_admin' );
add_action('admin_menu', 'sponsoren_custom_menu_page');
add_action( 'wp_enqueue_scripts', 'sponsoren_frontend' );

function sponsoren_custom_menu_page() {
   $page = add_menu_page( 'Sponsoren', 'Sponsoren', 'manage_options', 
       'sponsoren/sponsoren-admin.php', '', plugins_url( 'sponsoren/images/icon.png' ), 33 );
}

function sponsoren_admin() {
    wp_enqueue_style( 'sponsoren-admin-style', plugins_url('/stylesheet.css', __FILE__) );
    wp_enqueue_script( 'sponsoren-admin-script', plugins_url('/script.js', __FILE__) );
}

function sponsoren_frontend() {
    wp_enqueue_style( 'sponsoren-frontend-style', plugins_url('/sponsoren.css', __FILE__) );
    wp_enqueue_script( 'sponsoren-frontend-script', plugins_url('/sponsoren.js', __FILE__), array( 'jquery' ) );
}

// Create database table upon activation
function jal_install() {
   global $wpdb;

   $table_name = $wpdb->prefix . "sponsoren";

   $sql = "CREATE TABLE $table_name (
   id int NOT NULL AUTO_INCREMENT,
   name tinytext,
   bild tinytext,
   url tinytext,
   PRIMARY KEY id (id)
    );";

}

register_activation_hook( __FILE__, 'jal_install' );

// Ajax action used in sponsoren-admin.php
add_action('wp_ajax_sponsor_delete', 'sponsor_del');
function sponsor_del() {
    global $wpdb;
    $wpdb->delete( $wpdb->prefix.'sponsoren', array( 'id' => $_POST['deleteid'] ) );
    die();
}

// Widget
function widget_sponsoren_frontend($args=array(), $params=array()) {

    $title = get_option('widget_sponsoren_title');

    echo $before_widget;
    echo $before_title . $title . $after_title;
    // some more widget output

    echo $after_widget; 
}

wp_register_sidebar_widget('widget_sponsoren','Unsere Sponsoren', 'widget_sponsoren_frontend');

// Widget Options
wp_register_widget_control(
    'widget_sponsoren',     // id
    'widget_sponsoren',     // name
    'widget_sponsoren_control'  // callback function
);

function widget_sponsoren_control($args=array(), $params=array()) {

    if (isset($_POST['submitted'])) {
        update_option('widget_sponsoren_title', $_POST['widgettitle']);
    }

    $widgettitle = get_option('widget_sponsoren_title');
    ?>

    Widget Title:<br />
    <input type="text" class="widefat" name="widgettitle" value="<?php echo stripslashes($widgettitle); ?>" />

    <input type="hidden" name="submitted" value="0" />
    <?php
}
share|improve this question

1 Answer 1

up vote 1 down vote accepted

You should first make sure that you don't get any JavaScript errors. Plugin activations and edit buttons are using JavaScript and if your code has issues, it might break some portions of the website. Use Chrome Inspect to check it for JS errors.

share|improve this answer
    
Oh my god. So simple. I used a jQuery-selector 'a.edit' within my plugin... This also selected the activation and edit links on the plugin page. Thank you so much! –  eevaa Nov 28 '13 at 19:37
    
Glad I could help. Please accept my answer :) –  Alex Dumitru Nov 28 '13 at 19:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.