• Resolved szekitom

    (@szekitom)


    I added the function.php this line:
    add_filter("um_restrict_post_thumbnail","__return_true");

    It still worked in the summer, but since then something has changed and it no longer shows tumbnail pictures.

    What can I do to make sure that people who aren’t logged in can see the posts thumbails?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Aswin Giri

    (@aswingiri)

    Hello @szekitom

    This filter hook is still available in UM core. So, it should work fine. Have you checked if there are any other issues? Can you please mention which version of UM are you using?

    Thread Starter szekitom

    (@szekitom)

    Hi,

    Yes I see in the source code, but I’m not programmer, not understood when what happen. UM has also been updated since then, as have the other components (PHP, WP) Now everything is uptodate:
    – UM 2.5.1
    – PHP 8.0
    – WP 6.1
    My theme (8Rise) don’t show error message

    <div class="blocksquare" style="background-image:url(<?php if ( has_post_thumbnail() ) {the_post_thumbnail_url('thumbnail512');} ?>);">

    but another (Mantra) theme put an error message:
    Warning: Trying to access arra offset on value of type bool in
    …/mantra/includes/theme-loop.php on line 249
    This is theme thumbnail code:

    function cryout_echo_first_image( $postID ) {
    	$args = array(
    		'numberposts' => 1,
    		'order'=> 'ASC',
    		'post_mime_type' => 'image',
    		'post_parent' => $postID,
    		'post_status' => 'any',
    		'post_type' => 'any',
    	);
    
    	$attachments = get_children( $args );
    
    	if ($attachments) {
    		foreach($attachments as $attachment) {
    			$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'custom' )  ? wp_get_attachment_image_src( $attachment->ID, 'custom' ) : wp_get_attachment_image_src( $attachment->ID, 'custom' );
    
    			return esc_url( $image_attributes[0] ); //this is the line 249
    
    		}
    	}
    }

    For some reason don’t get the image.

    • This reply was modified 3 years, 7 months ago by szekitom.
    • This reply was modified 3 years, 7 months ago by szekitom.
    • This reply was modified 3 years, 7 months ago by szekitom.
    Thread Starter szekitom

    (@szekitom)

    The filter looks like registered fine.

    global $wp_filter;
    $hook = ‘um_restrict_post_thumbnail’;
    print_r( $wp_filter[$hook] );

    The output is here

    Thread Starter szekitom

    (@szekitom)

    Hi,

    I found a trick or a bug.
    If only the post is restricted, the thumbnail will appear on the main page.

    If the category of the post is also limited, the thumbnail will not appear on the main page.

    The picture has same category of the post.

    I think the “filter_post_thumbnail” function doesn’t check the “category” and doesn’t allow the thumbnail image. Or I don’t know where the error is, but this could be the solution

    I hope the description of my problem is understandable!

    Best regards,
    Tamás

    • This reply was modified 3 years, 6 months ago by szekitom.
    Plugin Support andrewshu

    (@andrewshu)

    Hello @szekitom

    Sorry for the late answer. Have you solved this problem?
    Please let me know if you need our help.

    I checked the “um_restrict_post_thumbnail” filter with post and category restriction and this hook works well.

    Thank you.

    Thread Starter szekitom

    (@szekitom)

    Hi,

    Not problem, I found a solution( see above)

    Tnx, the answer!

    Best regards,

    Tamás Szekeres

    • This reply was modified 3 years, 4 months ago by szekitom.
Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘thumbnail without login’ is closed to new replies.