Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter netstepinc

    (@netstepinc)

    Stefano,
    THANK YOU so much. I think just about nailed it.
    I changed _general_ to _author_ but it’s throwing an argument count error.
    I’m unclear regarding how to get data from your class to feed to the function in my template function file.

    Any additional tips would be welcome, but no worries. You’ve already given me some ideas.

    
    Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 2 passed in /wp-includes/class-wp-hook.php on line 287 
    and exactly 4 expected in /wp-content/themes/tna/inc/post_pay_counter.php:13 
    Stack trace: 
    #0 /wp-includes/class-wp-hook.php(287): {closure}('N.A.', 'author_words_re...') 
    #1 /wp-includes/plugin.php(206): WP_Hook->apply_filters('N.A.', Array) 
    #2 /wp-content/plugins/post-pay-counter/classes/ppc_wp_list_table_posts_class.php(157): apply_filters('ppc_author_stat...', 'N.A.', 'author_words_re...') 
    #3 /wp-admin/includes/class-wp-list-table.php(1410): Post_Pay_Counter_Posts_List_Table->column_default(Array, 'author_words_re...') 
    #4 /wp-admin/includes/class-wp-list-table.php(1350): WP_List_Table->single_row_columns(Array) 
    #5 /wp-admin/includes/class-wp-list-table.php(1337): WP_List_Table->single_row(Array) 
    #6 /wp-content/themes/tna/inc/post_pay_counter.php on line 13
    

    This plugin is amazing right? I’m trying to figure out why it’s free…what the catch? How can it work so well and have a dedicated support site and be free? I’ve been using opensource tools for 15 years and this still amazes me.

    You rock!
    I need to import into my dev site for testing the new site, then import again just before go-live to get all the latest customers and orders.
    I will be buying the pro version today.

    Thread Starter netstepinc

    (@netstepinc)

    I’m betting handling href url params is something simple in the plugin syntax. In the mean time I added a small bit of code to the end of the function before the return to handle multiple URL parameters.

    
    if($atts['htmltag'] && $atts['htmltag'] == 'a'):
    	$u=0;
    	$url_str = '';
    	foreach($params as $param){
    		$value = esc_html($_REQUEST[$param]);
    		if(strlen($value) > 0):
    			if($u == 0){
    				$url_str .= '?';
    			}else{
    				$url_str .= '&';
    			}
    			$url_str .= $param . '=' . esc_html($_REQUEST[$param]);
    			$u++;
    		endif;
    	}
    	$return = '<a href="' . $atts['href'] . $url_str . '">' . $content . '</a>';
    endif;
    
    • This reply was modified 5 years ago by netstepinc.
    Thread Starter netstepinc

    (@netstepinc)

    Thank you for your response. I will talk to my supervisor and follow up with you ASAP.

    Thread Starter netstepinc

    (@netstepinc)

    This is not fancy, but it worked for me.
    edit_yikes_tabs.php

    
    <?php
    /*INSTRUCTIONS
    WARNING: This is built for a specific purpose and limited use. Do not leave this in your website in the current form.
    NOTE: URL parameter &go=0 is for testing. &go=1 will execute the update so don't change that until you're ready.
    
    1. Copy db settings from wp-config file and paste below
    2. Define the TABLE_POSTMETA value below.
    3. Upload to your website web directory
    4. Test it at https://EXAMPLE.COM/edit_yikes_tabs.php?search=FIND&replace=REPLACE&go=0
    5. DELETE the file from your website when done. This is quick primitive unsecure code.
    */
    
    //DB CONNECT
    define('DB_NAME','');
    define('DB_USER','');
    define('DB_PASSWORD','');
    define('DB_HOST', 'localhost');
    define('TABLE_POSTMETA','wp_postmeta');
    
    $search = $_GET['search'];
    $replace = $_GET['replace'];
    $execute = $_GET['go'];
    
    echo '<div>SEARCH: '.$search.'</div>';
    echo '<div>REPLACE: '.$replace.'</div>';
    
    // Create connection
    $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
    if ($mysqli->connect_error) {
    	die("Connection failed: " . $mysqli->connect_error);
    } 
    mysqli_set_charset($mysqli,"utf8");
    
    // Perform an SQL query
    $sql = "SELECT <code>meta_id</code>,<code>meta_value</code> from ".TABLE_POSTMETA." where <code>meta_key</code> = 'yikes_woo_products_tabs'";
    
    // to get the error information
    if (!$result = $mysqli->query($sql)) {
        echo "Error: Our query failed to execute and here is why: \n";
        echo "Query: " . $sql . "\n";
        echo "Errno: " . $mysqli->errno . "\n";
        echo "Error: " . $mysqli->error . "\n";
        exit;
    }
    if ($result->num_rows === 0) {
        echo "No results";
        exit;
    }
    
    while ($data = $result->fetch_assoc()) {
    	$value = unserialize($data['meta_value']); 
    
    	echo '<div style="margin:10px; padding:10px; border:1px solid #00CC00; background:#FFFFCC">';
    	echo 	'ORIGINAL SERIALIZED TAB DATA: <b>postmeta id: ' . $data['meta_id'] . '</b><br>' . $data['meta_value'];
    	echo 	'<hr><b>BEFORE</b><br>'; print_r($value);
    
    	for($i=0; $i < count($value); $i++){
    		$content = $value[$i]['content'];
    		if(strstr($content,$search) == true){
    			$value[$i]['content'] = str_replace($search,$replace,$content);
    		}
    	}
    	$new_value = serialize($value);
    
    	echo 	'<hr><b>AFTER</b><br>'; print_r($value);
    	echo 	'<hr><b>SERIALIZED</b><br>'.$new_value;
    	
    	$update = "update wpso_postmeta set <code>meta_value</code> = '".$new_value."' where <code>meta_id</code>= '".$data['meta_id']."'";
    	if($execute == 1){
    		echo '<hr color="green" size="2"><b>UPDATE QUERY</b><br>'.$update;
    		$mysqli->query($update);
    	}
    	echo '</div>';
    }
    ?>
    
    Thread Starter netstepinc

    (@netstepinc)

    I built an external script that enabled me to unserialize > edit > serialize and update the meta_values.

    netstepinc

    (@netstepinc)

    Did this get resolved?
    I’m having the same problem.

Viewing 8 replies - 16 through 23 (of 23 total)