Changing the labels of the approval statuses

Screenshot of the Approval Status field on a View

Depending on the project, there are labels more suited than the existing ones: Approval, Unapproved, and Disapproved. Fortunately, there's an easy way to change them.

Once the Approval Status field is added to your View, click on the cog icon to access the Approval Status Settings modal:

Screenshot of the Approval Status field on a View

On the Approval Status Settings modal, you can change the labels for the three available statuses:

Screenshot of the Approval Status settings panel

Changing the labels of the actions of the Approve Entries field

It is also possible to change the labels of the actions from the Approve Entries field.

Screenshot of the Approve Entries field on a ViewIn the example below, replace the ###### characters with the new label you prefer for each action.

add_filter( 'gettext', 'gk_modify_approval_text', 20, 3 );
function gk_modify_approval_text( $translated_text, $text, $domain ) {

	if ( $domain !== 'gk-gravityview') {
		return $translated_text;
	}
    
	if ( ! class_exists( '\GravityView_View' ) ) {
		return $translated_text;
	}
	
	$view_id = GravityView_View::getInstance()->getViewId();
        if($view_id !== 66){ // Change 66 to your View ID
		return $translated_text;
	}

	if ( $translated_text === 'Disapproved') {
		$translated_text = __( '#######', 'gk-gravityview' );
	}
	if ( $translated_text === 'Disapprove') {
		$translated_text = __( '#######', 'gk-gravityview' );
	}
	if ( $translated_text === 'Approved') {
		$translated_text = __( '#######', 'gk-gravityview' );
	}

	if ( $translated_text === 'Approve') {
		$translated_text = __( '#######', 'gk-gravityview' );
	}
	if ( $translated_text === 'Unapproved') {
		$translated_text = __( '#######', 'gk-gravityview' );
	}
	if ( $translated_text === 'Reset Approval') {
		$translated_text = __( '#######', 'gk-gravityview' );
	}    
	
	return $translated_text;
}

Read here how to add these code samples to your website: Where to put code samples.

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