• Resolved michaelpersch

    (@michaelpersch)


    Hello, today I found this code snipped which shows, how I can add a custom field to the general account tab.

    But what if I want to add a custom field to the ,,privacy” tab?
    Is this also possible?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • @michaelpersch

    You can try using this filter hook where the Privacy tab initial values are comma separated fields and you can add your custom fields like in my example:

    $args = 'profile_privacy,profile_noindex,hide_in_members';

    Example:

    add_filter( 'um_account_tab_privacy_fields', 'my_account_tab_privacy_fields', 10, 2 );
    function my_account_tab_privacy_fields( $args, $shortcode_args ) {
       $args .= ',custom_field_1,custom_field_2';
       return $args;
    }

    Add your code snippet to your active theme’s functions.php file
    or use the “Code Snippets” plugin.

    Filter hook definition:

    /**
     * UM hook
     *
     * @type filter
     * @title um_account_tab_privacy_fields
     * @description Extend Account Tab Privacy
     * @input_vars
     * [{"var":"$args","type":"array","desc":"Account Arguments"},
     * {"var":"$shortcode_args","type":"array","desc":"Account Shortcode Arguments"}]
     * @change_log
     * ["Since: 2.0"]
     * @usage add_filter( 'um_account_tab_privacy_fields', 'function_name', 10, 2 );
     * @example
     * <?php
     * add_filter( 'um_account_tab_privacy_fields', 'my_account_tab_privacy_fields', 10, 2 );
     * function my_account_tab_privacy_fields( $args, $shortcode_args ) {
     *     // your code here
     *     return $args;
     * }
     * ?>
     */
    • This reply was modified 1 year, 12 months ago by missveronica.
    Plugin Support andrewshu

    (@andrewshu)

    Hi @michaelpersch

    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 if any other questions come up and we’d be happy to help. ??

    Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can I add a custom field into the privacy tab?’ is closed to new replies.