Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP XProfile Number Field


  • AR2015
    Participant

    @ar2015

    BP XProfile Number Field

    how can i write an action to hook into this field so that its limited by an integer (of say 20) and non-negative?

    /**
     * Number xprofile field type.
     *
     * @since BuddyPress (2.0.0)
     */
    class BP_XProfile_Field_Type_Number extends BP_XProfile_Field_Type {
    
    	/**
    	 * Constructor for the number field type
    	 *
    	 * @since BuddyPress (2.0.0)
     	 */
    	public function __construct() {
    		parent::__construct();
    
    		$this->category = _x( 'Single Fields', 'xprofile field type category', 'buddypress' );
    		$this->name     = _x( 'Number', 'xprofile field type', 'buddypress' );
    
    		$this->set_format( '/^\d+|-\d+$/', 'replace' );
    		do_action( 'bp_xprofile_field_type_number', $this );
    	}
    function bp_xprofile_get_field_types() {
    	$fields = array(
    		'checkbox'       => 'BP_XProfile_Field_Type_Checkbox',
    		'datebox'        => 'BP_XProfile_Field_Type_Datebox',
    		'multiselectbox' => 'BP_XProfile_Field_Type_Multiselectbox',
    		'number'         => 'BP_XProfile_Field_Type_Number',
    		'url'            => 'BP_XProfile_Field_Type_URL',
    		'radio'          => 'BP_XProfile_Field_Type_Radiobutton',
    		'selectbox'      => 'BP_XProfile_Field_Type_Selectbox',
    		'textarea'       => 'BP_XProfile_Field_Type_Textarea',
    		'textbox'        => 'BP_XProfile_Field_Type_Textbox',
    	);
  • The topic ‘BP XProfile Number Field’ is closed to new replies.
Skip to toolbar