Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi there,

    Which line is line 15 of single.php?

    Thread Starter haampie

    (@haampie)

    Got it :]

    There is one line of script in admin-ajax.php after my own ajax_action that says: die('0');
    The solution is to add die() to the end of your own ajax function, so you die the script before die('0') :]

    function secretnameofmyawesomeplugin_js(){
    	if(isset($_POST['url']) && !empty($_POST['url'])){
    		echo 'ok';
    	} else {
    		echo 'false';
    	}
    }
    die()
    Thread Starter haampie

    (@haampie)

    Thanks for your comment willkemp, but unfortunately there are no relevant errors in the logs.

    If I remove the add_option function and the update check, the error is gone. So I think something is wrong with add_option('wp_poll_db_version', $wp_poll_db_version);

    I’ll post the whole script again:

    <?php
    global $wp_poll_db_version;
    $wp_poll_db_version = '0.1';
    
    function my_own_poll_installation(){
    	global $wp_poll_db_version;
    	global $wpdb;
    
    	$table_name = $wpdb->prefix . 'poll_engine';
    	if($wpdb->get_var("SHOW TABLES LIKE '" . $table_name . "'") != $table_name){
    		$sql = "CREATE TABLE " . $table_name . " (
    			id mediumint(9) NOT NULL AUTO_INCREMENT,
    			time bigint(11) DEFAULT '0' NOT NULL,
    			name tinytext NOT NULL,
    			text text NOT NULL,
    			url VARCHAR(55) NOT NULL,
    			UNIQUE KEY id (id)
    		);";
    		require_once(ABSPATH . 'wp-admin/include/upgrade.php');
    		dbDelta($sql);
    
    		$welcome_name = "Admin";
    		$welcome_text = "Congratulations, you just completed the installation!";
    
    		$insert = "INSERT INTO " . $table_name .
    			" (time, name, text) " .
    			"VALUES ('" . time() . "','" . $wpdb->escape($welcome_name) . "','" . $wpdb->escape($welcome_text) . "')";
    		$results = $wpdb->query( $insert );
    //add_option('wp_poll_db_version', $wp_poll_db_version);
    	}
    
    /*$installed_ver = get_option( "wp_poll_db_version" );
    if( $installed_ver != $wp_poll_db_version ) {
    	$sql = "CREATE TABLE " . $table_name . " (
    	id mediumint(9) NOT NULL AUTO_INCREMENT,
    	time bigint(11) DEFAULT '0' NOT NULL,
    	name tinytext NOT NULL,
    	text text NOT NULL,
    	url VARCHAR(55) NOT NULL,
    	UNIQUE KEY id (id)
    	);";
    	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    	dbDelta($sql);
    
    	update_option( "wp_poll_db_version", $wp_poll_db_version );
    }*/
    
    }
    
    function wp_poll_menu(){
    	add_menu_page('WP Poll Engine', 'Poll Settings', 8, 'poll_settings', 'wp_poll_page');
    	add_submenu_page('poll_settings', 'Subpage for Poll Settings', 'Subpage', 8, 'poll_settings_sub', 'wp_poll_subpage');
    }
    
    function wp_poll_page() {
    	echo '<h2>Title</h2>';
    }
    
    function wp_poll_subpage(){
    	echo '<h2>Subpage</h2>';
    }
    
    register_activation_hook(__FILE__, 'my_own_poll_installation');
    add_action('admin_menu', 'wp_poll_menu');
    ?>

    Thread Starter haampie

    (@haampie)

    Hey Matt,

    Maybe the register_activation_hook function is bugged, because changing the name of my installation function makes no sense. I’m absolutely sure there is no function called my_own_poll_installation_function() ??

    As I said before, when I remove the line containing the register_activation_hook, there is no error.

    Thread Starter haampie

    (@haampie)

    Whoops, I marked the topic as resolved when I posted it ?? So, it is not resolved!

    If I remove the line with the register_activation_hook function there is no error… But I want to use that function anyway.

    Thread Starter haampie

    (@haampie)

    Sorry, I need to post something more:
    Above is the sourcecode of the admin area.

    And by the way, I made this theme myself…

    Thread Starter haampie

    (@haampie)

    <h3>New WordPress
    Theme URI: https://zjapske.no-ip.org/wordpress/
    Description: Something new
    Version: 1.0
    Author: Harmen Stoppels
    Tags: beautiful colors, fixed width

    This layout may not be used without the written permission of Harmen Stoppels!
    */

    * {
    padding: 0;
    margin: 0;
    }
    body {
    font-family: Georgia,”Times New Roman”,Times,serif;
    font-size: 12px;
    […More CSS…]
    input#submit {

    } 1.0
    Author: Harmen Stoppels
    Tags: beautiful colors, fixed width

    This layout may not be used without the written permission of Harmen Stoppels!
    */

    * {
    padding: 0;
    margin: 0;
    }
    body {
    font-family: Georgia,”Times New Roman”,Times,serif;
    font-size: 12px;
    […More CSS…]
    input#submit {

    }</p>

    Well, it starts with a h3 wich isn’t closed. Then the whole sheet is displayed again and closes a p tag, wich isn’t opened…

    Thread Starter haampie

    (@haampie)

    Someone?

    Forum: Developing with WordPress
    In reply to: Userrole
    Thread Starter haampie

    (@haampie)

    Thanks ??

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