Account Filters

Filters


charitable_disable_admin_bar

Sets whether the admin bar should be disabled for everyone who does not have edit_posts or manage_charitable_settings caps.

Returns: Boolean. true by default. Return false to enable the admin bar for everyone.
Arguments: None.

Usage:

add_filter( 'charitable_disable_admin_bar', '__return_false' );

charitable_disable_admin_access

Sets whether admin access should be disabled for everyone who does not have edit_posts or manage_charitable_settings caps.

Returns:
Boolean. true by default. Return false to enable the admin bar for everyone.

Arguments:
None.

Usage:

add_filter( 'charitable_disable_admin_access', '__return_false' );

charitable_admin_redirect_url

Sets the URL that users should be redirected to when they attempt to access the admin without permission.

Returns:
String or false. If false (which is the default), the user will be redirected to the Profile page or the homepage, if no profile page has been set. Any returned URL must be one the same domain.

Arguments:
None.

Usage:

add_filter( 'charitable_admin_redirect_url', function() {
    return 'https://www.mysite.com/custom-url/';
} );

charitable_user_has_admin_access

Sets whether a particular user has admin access.

Returns:
Boolean. true by default for users with edit_posts or manage_charitable_settings caps.

Arguments:
None.

Usage:

add_filter( 'charitable_user_has_admin_access', function( $ret ) {
    if ( $ret ) {
        return $ret;
    }

    return current_user_can( 'edit_products' );
} );

charitable_disable_wp_login

Sets whether to completely disable the WordPress login and use the Charitable login page instead.

Returns:
Boolean. false by default. Return true to remove wp-login access and forward people to the Charitable login. Note: This will be ignored if no Charitable login page has been set.

Arguments:
None.

Usage:

add_filter( 'charitable_disable_admin_access', '__return_true' );