Forum Replies Created

Viewing 15 replies - 16 through 30 (of 161 total)
  • Thread Starter Lukasz

    (@wpfed)

    Great, thank you, and just this, simple to fix, I currently have it modified so it stops throwing errors:

    PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in …\wp-content\plugins\contact-form-7-conditional-fields-pro\pro\summary.php on line 101

    Thread Starter Lukasz

    (@wpfed)

    @hcabrera thanks for getting back. I copied in your code and just changed to one of the my categories which does not have any popular posts and received the exact same errors as before. As soon as I add a view to one of the posts in the category, the error disappears, so it’s only posts with empty views that throw the error, this wont really be issue in prod.

    But, I tried your code on my functions.php, and it worked, no error, just blank if their is no views and link if their is views. So could it be a timing issue on page.php, maybe the function should be called within a hook or something to fire at the right time? This may not be sufficient:

    global $post;
    if ( is_page( $post->ID ) && ! is_page( $contactUsPage ) ) {

    Edit: The is_page doesn’t make a difference, removed or not. Something to do with outputting the results on page.php.

    • This reply was modified 1 year, 8 months ago by Lukasz.
    Thread Starter Lukasz

    (@wpfed)

    This appears to happen when there is no popular posts in certain categories, for example I have pages with associated categories, the category for the page is returned and then wpp checks for any posts in that category and passes null to the output which is then attempted to be processed. I’ll try to see if I an add some error handling for this situation.

    This is from my page.php:

    global $post;

                        if ( is_page( $post->ID ) && ! is_page( $contactUsPage ) ) {

                            $helpfulArticles = esc_html__( 'You might also find these helpful.', 'domain' );

                            $key_name = get_post_custom_values( $key = 'cat' );

                            $cat_ID   = get_cat_ID( $key_name[0] );

                            if ( function_exists( 'pll_register_string' ) ) {

                                $currentID = pll_get_post( 300 );

                            }

                            $closerForAside = '<li><a href="' . esc_url( get_permalink( $currentID ) ) .

                                '">'

                                . esc_html__( 'See all Articles', 'domain' ) . '<i class="fa fa-angle-right" aria-hidden="true"></i></a></li></ul></section></div>';

                            $args = array(

                                'post_type'   => 'post',

                                'limit'       => 3,

                                'cat'         => pll_get_term( $cat_ID, 'en' ),

                                'stats_views' => 0,

                                'range'       => 'all',

                                'freshness'   => 1,

                                'wpp_start'   => '<div id="popularPosts" class="sidebar popularPosts" aria-labelledby="helpfulArticles">

                    <section class="sidebarHelpTopics"><h2 id="helpfulArticles">' . $helpfulArticles . '</h2><ul>',

                                'wpp_end'     => $closerForAside,

                            );

                            wpp_get_mostpopular( $args );

                        }
    Thread Starter Lukasz

    (@wpfed)

    Hey @hcabrera,

    Interesting, I will have a look at the thread in greater details and share reproduction steps.

    Your site is running on insecure http protocol which is why it’s breaking. Make sure your server is setup with HTTPS and not HTTP and also setup redirect all traffic from http to https and set the strict transport security header either via server or in your code.

    Make sure to update your URL in general settings to HTTPS, WordPress should handle the search and replace of all your urls.

    You are also running on outdated PHP version which is no longer receiving security updates, you need to update to PHP 8+.

    • This reply was modified 2 years, 2 months ago by Lukasz.

    Paste the info from the info tab under database to see what you have installed.

    All posts have to have a category. You can choose the default WordPress sets under settings -> default post category

    Thread Starter Lukasz

    (@wpfed)

    Thank you @hcabrera!

    I narrowed down to this commit https://github.com/cabrerahector/wordpress-popular-posts/commit/3af6f8547e616e1caddccb576c230f1b2e7ae174

    I did quick test, I copied that file(src/Query.php) from the 6.1.1 to 6.1.2 and the French was displaying. Just have to figure out what line is specifically causing it.

    It means you should update to the latest version 6.3.3 which fixes that vulnerability.

    Thread Starter Lukasz

    (@wpfed)

    YES, I did make a mistake, I didn’t even realize, I interchange WordPress with PHP haha..anyways I am looking into a bunch of JavaScript and PHP PDF generation libraries and will see how it goes!

    Thread Starter Lukasz

    (@wpfed)

    Thank you for getting back! although my host does use wp-cli, they don’t allow me to use it or any command line type of tools unfortunately. I may try playing around with the APIs to trigger a migration or some other method.

    Is the shortcode or cf7 block added to those other pages? Check for any plugin/theme conflicts as well.

    Had same situation where codes remain static but text can change + it’s multilingual so keeping all that text in validation would be alot. Thanks for $after_pipe = $tag->pipes->do_pipe( $_POST[‘myoptions’] ); did the trick, here is sample code for reference:

    add_filter( 'wpcf7_validate_select', 'validate_codes', 10, 2 );
    add_filter( 'wpcf7_validate_select*', 'validate_codes', 10, 2 );
    
    function validate_codes( $result, $tag ) {
    
    	$name         = $tag->name;
            //sample values.
    	$valid_values = array(
    		'sd',
    		'sdf',
    		'sdf',
    		'sdf',
    		'sdf',
    		'sdfsd',
    		'345',
    		'345',
    		'gdg',
    		'345',
    		'887',
    		'55',
    		'88',
    		'54',
    		'55',
    		'222',
    		'456',
    	);
    
    	if ( $name == 'myinput' ) {
    
    		$value = isset( $_POST[ $name ] ) ? trim( $_POST[ $name ] ) : '';
    		$after_pipe = $tag->pipes->do_pipe( $value );
    
    		if ( $tag->is_required() && '' === $value ) {
    			$result->invalidate( $tag, '' );
    		}
    
    		$toarray = explode( ',', $after_pipe );
    
    		foreach ( $toarray as $item ) {
    
    			if ( ! in_array( $item, $valid_values, true ) ) {
    
    				$result->invalidate( $tag, $item );
    
    			}
    
    		}
    
    	}
    
    	return $result;
    
    }

    Thread Starter Lukasz

    (@wpfed)

    Thank you @takayukister will look into that.

    Odd, the error went away now, I didn’t do anything besides the passage of time haha, maybe some cache issue.

Viewing 15 replies - 16 through 30 (of 161 total)