• When matching by slug, the plugin currently converts the answer to lowercase, but does not automatically replace the spaces with dashes in the event your field contains multiple words.

    i.e. “Fall 2013” turns into “fall 2013”, not “fall-2013”

    To address this, I replaced the following line of code in bp-gom-matching.php:

    // if method is slug, lower case the value
    if ( $field_meta->method == ‘slug’ ) {
    $field_value = strtolower( $field_value );
    }`

    With this:

    // if method is slug, lower case the value
    	if ( $field_meta->method == 'slug' ) {
    		$field_value = strtolower( $field_value );
        //Make alphanumeric (removes all other characters)
        $field_value = preg_replace("/[^a-z0-9_\s-]/", "", $field_value);
        //Clean up multiple dashes or whitespaces
        $field_value = preg_replace("/[\s-]+/", " ", $field_value);
        //Convert whitespaces and underscore to dash
        $field_value = preg_replace("/[\s_]/", "-", $field_value);
    	}

    http://wordpress.org/plugins/buddypress-groupomatic/

  • The topic ‘Matching slugs where the answer has multiple words.’ is closed to new replies.