Changing the "You are not allowed to view this content" text when an entry is pending approval

If you're using GravityView to create user profiles and you have your View set to show only Approved entries, a user will see the following message if they attempt to view their profile before the entry has been approved:

"Message displays: 'You are not allowed to view this content' on a user profile page."

You can use this filter to change the "You are not allowed to view this content" text:

add_filter( 'gettext', 'gv_modify_text', 20, 3 );
function gv_modify_text( $translated_text, $text, $domain ) {
    if ( $domain === 'gk-gravityview' && $translated_text === 'You are not allowed to view this content.' ) {
        return "Your entry hasn't been approved yet!";
    }
    return $translated_text;
}

With the filter in place, the user will see the following message:

Profile page indicating entry is pending approval, dated October 22, 2019

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us