• Hello,

    thank you for the plugin and your work on it.

    Version 2.2.2 [maybe 2.2.1 aswell – I updated from 2.2.0] blocks the excerpts/ post summaries of the posts on the posts page. Even the content of the optional wordpress excerpt metabox gets blocked. Instead the restricted access message is shown, but not correctly, there should be a link, not only plain text.
    Posts page is accessible for everyone, posts only for logged-in users.
    Any chance to force the excerpts to be shown again? They are used to spark interest…

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Thread Starter shouldvelearnedit

    (@shouldvelearnedit)

    Hi @champsupertramp

    Indeed I Have. And now a second time (; Maybe I still miss something…

    Option unchecked – that is why the restricted access message is shown, incorrectly though. On Version 2.2.0 the excerpts were not blocked. I mean the automatically created ones excerpt.
    If it is easier to unblock the content of the wordpress excerpt metabox I would switch to using them.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shouldvelearnedit

    Please try adding the following code snippets to your site. You can add it to your theme/child-theme’s functions.php file or use the Code Snippets plugin to run the code:

    /**
     * Customize WP_Post object for the restricted post (if it's not hidden) in the archive page
     *
     * @param WP_Post $post
     * @param array $restriction_settings
     * @param WP_Post $original_post
     *
     * @return WP_Post
     */
    function um_custom_data_restricted_archive_post( $post, $restriction_settings, $original_post ) {
    	// if you want to show the original post title instead of the restriction content title
    	// use these object keys https://developer.www.ads-software.com/reference/functions/get_post/#comment-876
    	$post->post_title = $original_post->post_title;
    	// sometimes $original_post is already customized then please use this way
    	$p = get_post( $original_post->ID );
    	$post->post_title = $p->post_title;
            $post->post_excerpt = $p->post_excerpt;
    	return $post;
    }
    add_filter( 'um_restricted_archive_post', 'um_custom_data_restricted_archive_post', 10, 3 );
    
    /**
     * Customize WP_Post object for the restricted post (if it's not hidden) in the singular post's page
     *
     * @param WP_Post $post
     * @param array $restriction_settings
     * @param WP_Post $original_post
     *
     * @return WP_Post
     */
    function um_custom_data_restricted_singular_post( $post, $restriction_settings, $original_post ) {
    	// if you want to show the original post title instead of the restriction content title
    	// use these object keys https://developer.www.ads-software.com/reference/functions/get_post/#comment-876
        	$post->post_title = $original_post->post_title;
    	// sometimes $original_post is already customized then please use this way
    	$p = get_post( $original_post->ID );
    	$post->post_title = $p->post_title;
           $post->post_excerpt = $p->post_excerpt;
    	return $post;
    }
    add_filter( 'um_restricted_singular_post', 'um_custom_data_restricted_singular_post', 10, 3 );
    
    // avoid changing the post title to the "restricted content title"
    add_filter( 'um_ignore_restricted_title', '__return_true' );

    Regards,

    Thread Starter shouldvelearnedit

    (@shouldvelearnedit)

    Hi @champsupertramp thank you for the provided snippet. When added to child-theme’s functions.php the posts page/ archive page shows excerpts again. Unfortunately not the post title and only the content of the wordpress excerpt metabox. The latter means some work on earlier posts, but if there is now way to show the automatically created excerpts, I would do that. Then again I need the posts titles linked to the post so logged-in users get to the certain page and the others to the registration page.

    kind regards

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shouldvelearnedit

    Did you push the code on this site? I cannot see the excerpts. There are restriction messages only: https://water-mist-systems.com/weblog/

    Regards,

    Thread Starter shouldvelearnedit

    (@shouldvelearnedit)

    Indeed I did. But due to only one post having an example text in the wordpress excerpt metabox I undid it. Pushed it online again if you want to have a look.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shouldvelearnedit

    Sorry for the late response. Could you please share the code for showing the post title and excerpt like the ones I’ve provided above? Are they the same or did you make any additional changes to the code? Please share it so we can review them.

    If you are still having issues with the code, could you please try this beta version 2.2.3?
    https://downloads.www.ads-software.com/plugin/ultimate-member.2.2.3-beta.zip

    Ensure that you’ve created a backup of your site before updating it.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. ??

    Regards,

    Thread Starter shouldvelearnedit

    (@shouldvelearnedit)

    Hi @champsupertramp sorry for the lack of activity, there were tasks with higher priority.

    I copied the code you posted 2 weeks ago to my child theme’s function.php file. Results as per my last answer.

    Going to test the beta in staging environment soon.

    Thread Starter shouldvelearnedit

    (@shouldvelearnedit)

    With the beta installed I get the post title but not excerpt (neither the automatic wp ones nor from metabox)

    Thread Starter shouldvelearnedit

    (@shouldvelearnedit)

    2.2.3 installed;
    using only the code from this answer in function.php;
    i get post title and post excerpt.

    Excerpt only from the metabox, if there is nothing in the metabox, the restriction message is shown – without a link though.
    Any chance to pass the automated wordpress excerpts through?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Excerpts/ post summaries blocked’ is closed to new replies.