Results 1 to 1 of 1

Thread: How to use add_filter for cp_formbuilder

  1. #1
    Thread Starter
    serno's Avatar
    Join Date
    Apr 2013
    Location
    Denmark
    Posts
    31
    Thanks
    22
    Thanked 1 Time in 1 Post

    How to use add_filter for cp_formbuilder

    Hi,
    I would like to use add_filter on cp_formbuilder so that log on user donīt have to reenter their city, country when posting an ad. I found in classipress/includes/actions.php this filter:
    Code:
    /**
     * Limits characters in the price field.
     * @since 3.3.1
     */
    function cp_limit_characters_in_price_field( $args ) {
    	$args['maxlength'] = 15;
    
    	return $args;
    }
    add_filter( 'cp_formbuilder_cp_price', 'cp_limit_characters_in_price_field' );
    I then tried, based on this to get the userīs city, but it does not work.

    Code:
    function cp_set_default_city( $args ) {  
        global $current_user;   
        get_currentuserinfo(); 
    	$args['value'] = 15;
    
    	return $args;
    }
    add_filter( 'cp_formbuilder_cp_city', 'cp_set_default_city' );
    Hope youīll help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)