• Resolved adccmin

    (@adccmin)


    I have a website that uses a number of these display callback functions, and the setting field that lets me adding my custom functions is way too short. For 10 functions just the new mandatory prefix (and the commas) already accounts for 219 characters, and the field is only 255 characters long.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    See the below link for a workaround. I’ll fix that field so it’s a textarea and takes more content too when I do the next release.

    https://wordpress.org/support/topic/display-callbacks-allowed-field-max-length-is-255/#post-19009752

    I tried the link above but can’t get it to work.

    In my templates I do f.e. {@field,custom_function}.
    In my functions.php I have ‘function custom_function’.

    What do I need to adjust in my functions.php and templates to get the functions working again?

    Plugin Support pd

    (@pdclark)

    If you have these in functions.php or defined elsewhere:

    function monkeys_uncle( $input ) {
    return $input . "'s Uncle";
    }
    function monkeys_aunt( $input ) {
    return $input . "'s Aunt";
    }

    And were previously using them with magic tags, like {@field,monkeys_uncle} and {@field,monkeys_aunt} (prior to version 3.3.9.2)

    There are three options for updating (PICK ONE):

    Option 1: If all your functions start with the same words, a prefix such as monkeys_ or custom_, filter the prefix:

    Adding this filter to you theme functions.php, a plugin, or a Code Snippet:

    add_filter(
    'pods_access_callbacks_custom_prefix',
    function( $prefix ) {
    return 'monkeys_';
    }
    );

    …any function which has a name starting with monkeys_ may then be used in templates if they are also added to the comma-separated list of allowed display/callback functions in Pods Admin > Settings, e.g., monkeys_aunt,monkeys_uncle

    Option 2. If there are not a lot of functions already used in templates, update the function definitions and templates so that the function names start with custom_pods_callback_

    e.g.,

    function custom_pods_callback_uncle( $input ) {
    return $input . "'s Uncle";
    }
    function custom_pods_callback_aunt( $input ) {
    return $input . "'s Aunt";
    }

    …then used in a Pods template as {@field,custom_pods_callback_uncle} and {@field,custom_pods_callback_aunt}

    …and added to Pods Admin > Settings comma-separated allow-list as custom_pods_callback_uncle,custom_pods_callback_aunt

    Option 3: If you are able to edit wp-config.php, skip the settings field and prefix, and instead define your allowed function names (of any prefix) in wp-config.php:

    define( 'PODS_DISPLAY_CALLBACKS_ALLOWED', 'monkeys_uncle,monkeys_aunt' );
Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.