Forum Replies Created

Viewing 15 replies - 16 through 30 (of 42 total)
  • Thread Starter NicolaCirotto

    (@nicolacirotto)

    Do you have some news??

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    I don’t know if it is the best way :S
    Because, now, in backend I have 2 translatable string in different context.
    the 1st is context “Buddypress Multilingual” and it is created from wpml after the creation of profile field in backend

    the 2nd is context “plugin bp-profile-search” and it is created from wpml after my mofication of your code. Because now is __($label, ‘bps’)

    I think the best way is to translate only one record and not to have 2 record (1 backend and 2 frontend)

    I tried to put __($label, ‘bpml’) but it not work ??

    https://cirotto.net/bps_wpml.jpg

    Maybe is better if you wait the WPML response…

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    ok I have changed bps-search.php to complete (I think) the frontend translation. I have changed from line 99 to 125 (not all lines).
    This is the complete page:

    <?php
    
    add_action ('wp_loaded', 'bps_set_cookie');
    function bps_set_cookie ()
    {
    	global $bps_args;
    
    	if (isset ($_REQUEST['bp_profile_search']))
    	{
    		$bps_args = apply_filters ('bps_request_data', $_REQUEST);
    
    		add_action ('bp_before_directory_members_content', 'bps_filters');
    		setcookie ('bp-profile-search', serialize ($bps_args), 0, COOKIEPATH);
    	}
    	else if (isset ($_COOKIE['bp-profile-search']))
    	{
    		if (defined ('DOING_AJAX'))
    			$bps_args = unserialize (stripslashes ($_COOKIE['bp-profile-search']));
    	}
    }
    
    add_action ('wp', 'bps_del_cookie');
    function bps_del_cookie ()
    {
    	if (isset ($_REQUEST['bp_profile_search']))  return false;
    
    	if (isset ($_COOKIE['bp-profile-search']))
    	{
    		if (is_page (bp_get_members_root_slug ()))
    			setcookie ('bp-profile-search', '', 0, COOKIEPATH);
    	}
    }
    
    function bps_minmax ($posted, $id, $type)
    {
    	$min = (isset ($posted["field_{$id}_min"]) && is_numeric (trim ($posted["field_{$id}_min"])))? trim ($posted["field_{$id}_min"]): '';
    	$max = (isset ($posted["field_{$id}_max"]) && is_numeric (trim ($posted["field_{$id}_max"])))? trim ($posted["field_{$id}_max"]): '';
    
    	if ($type == 'datebox')
    	{
    		if (is_numeric ($min))  $min = (int)$min;
    		if (is_numeric ($max))  $max = (int)$max;
    	}
    
    	return array ($min, $max);
    }
    
    function bps_filters ()
    {
    	global $bps_args;
    
    	$posted = $bps_args;
    	$done = array ();
    	$filters = '';
    	$action = bp_get_root_domain (). '/'. bp_get_members_root_slug (). '/';
    
    	list ($x, $fields) = bps_get_fields ();
    	foreach ($posted as $key => $value)
    	{
    		if ($value === '')  continue;
    
    		$split = explode ('_', $key);
    		if ($split[0] != 'field')  continue;
    
    		$id = $split[1];
    		$op = isset ($split[2])? $split[2]: 'eq';
    		if (isset ($done[$id]) || empty ($fields[$id]))  continue;
    
    		$field = $fields[$id];
    		$field_type = apply_filters ('bps_field_criteria_type', $field->type, $field);
    		$field_label = isset ($posted['label_'. $id])? $posted['label_'. $id]: $field->name;
    
    		if (bps_custom_field ($field_type))
    		{
    			$output = "The search criteria for the <em>$field_type</em> field type go here<br/>\n";
    			$output = apply_filters ('bps_field_criteria', $output, $field, $key, $value, $field_label);
    			$filters .= $output;
    		}
    		else if ($op == 'min' || $op == 'max')
    		{
    			if ($field_type == 'multiselectbox' || $field_type == 'checkbox')  continue;
    
    			list ($min, $max) = bps_minmax ($posted, $id, $field_type);
    			if ($min === '' && $max === '')  continue;
    
    			$filters .= "<strong>$field_label:</strong>";
    			if ($min !== '')
    				$filters .= " <strong>". __('min', 'bps'). "</strong> $min";
    			if ($max !== '')
    				$filters .= " <strong>". __('max', 'bps'). "</strong> $max";
    			$filters .= "<br/>\n";
    		}
    		else if ($op == 'eq')
    		{
    			if ($field_type == 'datebox')  continue;
    
    			switch ($field_type)
    			{
    			case 'textbox':
    			case 'number':
    			case 'textarea':
    				$filters .= "<strong>" . __($field_label, 'bps') . ":</strong> ". esc_html (stripslashes ($value)) . "<br/>\n";
    				break;
    			case 'selectbox':
    			case 'radio':
    				$filters .= "<strong>" . __($field_label, 'bps') . ":</strong> ". esc_html (stripslashes (__($value, 'bps'))) . "<br/>\n";
    				break;
    			case 'multiselectbox':
    			case 'checkbox':
    				$values = $value;
    				$count = 0;
    				$last = count($values) - 1;
    				$new_values = "";
    				foreach($values as $item)
    				{
    					$new_values .= __($item, 'bps');
    					if($count < $last)
    					{
    						$new_values .= ", ";
    					}
    					$count++;
    				}
    				$filters .= "<strong>" . __($field_label, 'bps') . ":</strong> ". esc_html (stripslashes($new_values)) . "<br/>\n";
    				break;
    			}
    		}
    		else continue;
    
    		$done [$id] = true;
    	}
    
    	if (count ($done) == 0)  return false;
    
    	echo "\n";
    	echo "<p class='bps_filters'>\n". $filters;
    	echo "<a href='$action'>". __('Clear', 'buddypress'). "</a><br/>\n";
    	echo "</p>\n";
    
    	return true;
    }
    
    function bps_search ($posted)
    {
    	global $bp, $wpdb;
    
    	$done = array ();
    	$results = array ('users' => array (0), 'validated' => true);
    
    	list ($x, $fields) = bps_get_fields ();
    	foreach ($posted as $key => $value)
    	{
    		if ($value === '')  continue;
    
    		$split = explode ('_', $key);
    		if ($split[0] != 'field')  continue;
    
    		$id = $split[1];
    		$op = isset ($split[2])? $split[2]: 'eq';
    		if (isset ($done[$id]) || empty ($fields[$id]))  continue;
    
    		$field = $fields[$id];
    		$field_type = apply_filters ('bps_field_query_type', $field->type, $field);
    
    		if (bps_custom_field ($field_type))
    		{
    			$found = apply_filters ('bps_field_query', array (), $field, $key, $value);
    		}
    		else
    		{
    			$sql = $wpdb->prepare ("SELECT user_id FROM {$bp->profile->table_name_data} WHERE field_id = %d ", $id);
    			$sql = apply_filters ('bps_field_sql', $sql, $field);
    
    			if ($op == 'min' || $op == 'max')
    			{
    				if ($field_type == 'multiselectbox' || $field_type == 'checkbox')  continue;
    
    				list ($min, $max) = bps_minmax ($posted, $id, $field_type);
    				if ($min === '' && $max === '')  continue;
    
    				switch ($field_type)
    				{
    				case 'textbox':
    				case 'number':
    				case 'textarea':
    				case 'selectbox':
    				case 'radio':
    					if ($min !== '')  $sql .= $wpdb->prepare ("AND value >= %f", $min);
    					if ($max !== '')  $sql .= $wpdb->prepare ("AND value <= %f", $max);
    					break;
    
    				case 'datebox':
    					$time = time ();
    					$day = date ("j", $time);
    					$month = date ("n", $time);
    					$year = date ("Y", $time);
    					$ymin = $year - $max - 1;
    					$ymax = $year - $min;
    
    					if ($max !== '')  $sql .= $wpdb->prepare ("AND DATE(value) > %s", "$ymin-$month-$day");
    					if ($min !== '')  $sql .= $wpdb->prepare ("AND DATE(value) <= %s", "$ymax-$month-$day");
    					break;
    				}
    			}
    			else if ($op == 'eq')
    			{
    				if ($field_type == 'datebox')  continue;
    
    				switch ($field_type)
    				{
    				case 'textbox':
    				case 'textarea':
    					$value = str_replace ('&', '&', $value);
    					$escaped = '%'. bps_esc_like ($value). '%';
    					if (isset ($posted['options']) && in_array ('like', $posted['options']))
    						$sql .= $wpdb->prepare ("AND value LIKE %s", $escaped);
    					else
    						$sql .= $wpdb->prepare ("AND value = %s", $value);
    					break;
    
    				case 'number':
    					$sql .= $wpdb->prepare ("AND value = %d", $value);
    					break;
    
    				case 'selectbox':
    				case 'radio':
    					$value = str_replace ('&', '&', $value);
    					$sql .= $wpdb->prepare ("AND value = %s", $value);
    					break;
    
    				case 'multiselectbox':
    				case 'checkbox':
    					$values = $value;
    					$like = array ();
    					foreach ($values as $value)
    					{
    						$value = str_replace ('&', '&', $value);
    						$escaped = '%'. bps_esc_like ($value). '%';
    						$like[] = $wpdb->prepare ("value = %s OR value LIKE %s", $value, $escaped);
    					}
    					$sql .= 'AND ('. implode (' OR ', $like). ')';
    					break;
    				}
    			}
    			else continue;
    
    			$found = $wpdb->get_col ($sql);
    		}
    
    		$users = isset ($users)? array_intersect ($users, $found): $found;
    		if (count ($users) == 0)  return $results;
    
    		$done [$id] = true;
    	}
    
    	if (count ($done) == 0)
    	{
    		$results['validated'] = false;
    		return $results;
    	}
    
    	$results['users'] = $users;
    	return $results;
    }
    
    add_action ('bp_before_members_loop', 'bps_add_filter');
    add_action ('bp_after_members_loop', 'bps_remove_filter');
    function bps_add_filter ()
    {
    	add_filter ('bp_pre_user_query_construct', 'bps_user_query');
    }
    function bps_remove_filter ()
    {
    	remove_filter ('bp_pre_user_query_construct', 'bps_user_query');
    }
    
    function bps_user_query ($query)
    {
    	global $bps_args;
    
    	if (!isset ($bps_args))  return $query;
    
    	$bps_results = bps_search ($bps_args);
    	if ($bps_results['validated'])
    	{
    		$users = $bps_results['users'];
    
    		if ($query->query_vars['include'] !== false)
    		{
    			$included = $query->query_vars['include'];
    			if (!is_array ($included))
    				$included = explode (',', $included);
    
    			$users = array_intersect ($users, $included);
    			if (count ($users) == 0)  $users = array (0);
    		}
    
    		$users = apply_filters ('bps_results', $users);
    		$query->query_vars['include'] = $users;
    	}
    
    	return $query;
    }
    
    function bps_esc_like ($text)
    {
        return addcslashes ($text, '_%\\');
    }
    ?>
    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Hi Andrea,
    I have changed the code in bps-form.php file and now all work fine.
    This is the complete page you can compare with your original file.
    It was easy. For example for the label of search form (frontend):
    echo “<span class=’label’>” . __($label, ‘bps’) . “</span>”;

    <?php
    
    add_action ('bp_before_directory_members_tabs', 'bps_add_form');
    function bps_add_form ()
    {
    	$args = array (
    		'post_type' => 'bps_form',
    		'orderby' => 'ID',
    		'order' => 'ASC',
    		'nopaging' => true,
    		'meta_query' => array (
    			array ('key' => 'bps_options', 'compare' => 'LIKE', 'value' => 's:9:"directory";s:3:"Yes";')
    		)
    	);
    	$posts = get_posts ($args);
    
    	foreach ($posts as $post)  bps_display_form ($post->ID, 'bps_auto');
    }
    
    add_action ('bps_display_form', 'bps_display_form');
    function bps_display_form ($form, $mode='bps_action')
    {
    	if (!function_exists ('bp_has_profile'))
    	{
    		printf ('<p class="bps_error">'. __('%s: The BuddyPress Extended Profiles component is not active.', 'bps'). '</p>',
    			'<strong>BP Profile Search '. BPS_VERSION. '</strong>');
    		return false;
    	}
    
    	$bps_options = bps_options ($form);
    	if (empty ($bps_options['field_name']))
    	{
    		printf ('<p class="bps_error">'. __('%s: Form %d was not found, or has no fields.', 'bps'). '</p>',
    			'<strong>BP Profile Search '. BPS_VERSION. '</strong>', $form);
    		return false;
    	}
    
    	$action = bp_get_root_domain (). '/'. bp_get_members_root_slug (). '/';
    
    echo "\n<!-- BP Profile Search ". BPS_VERSION. " - start -->\n";
    if ($mode != 'bps_auto')  echo "<div id='buddypress'>";
    
    	if ($mode == 'bps_auto')
    	{
    ?>
    	<div class="item-list-tabs bps_header">
    	<ul>
    	<li><?php echo __($bps_options['header'], 'bps'); ?></li>
    <?php if ($bps_options['toggle'] == 'Enabled') { ?>
    	<li class="last">
    	<input id="bps_toggle<?php echo $form; ?>" type="submit" value="<?php echo __($bps_options['button'], 'bps'); ?>" />
    	</li>
    <?php } ?>
    	</ul>
    <?php if ($bps_options['toggle'] == 'Enabled') { ?>
    <script type="text/javascript">
    	jQuery(document).ready(function($) {
    		$('#<?php echo "$mode$form"; ?>').hide();
    		$('#bps_toggle<?php echo $form; ?>').click(function(){
    			$('#<?php echo "$mode$form"; ?>').toggle();
    		});
    	});
    </script>
    <?php } ?>
    	</div>
    <?php
    	}
    
    	list ($x, $fields) = bps_get_fields ();
    
    echo "<form action='$action' method='$bps_options[method]' id='$mode$form' class='standard-form'>";
    
    	$j = 0;
    	foreach ($bps_options['field_name'] as $k => $id)
    	{
    		if (empty ($fields[$id]))  continue;
    
    		$field = $fields[$id];
    		$field_type = apply_filters ('bps_field_html_type', $field->type, $field);
    
    		$label = $bps_options['field_label'][$k];
    		$desc = $bps_options['field_desc'][$k];
    		$range = isset ($bps_options['field_range'][$k]);
    
    		$fname = 'field_'. $id;
    		$name = sanitize_title ($field->name);
    		$alt = ($j++ % 2)? ' alt': '';
    
    echo "<div class='editfield field_$id field_$name$alt'>";
    
    		if (empty ($label))
    			$label = $field->name;
    		else
    echo "<input type='hidden' name='label_$id' value='$label' />";
    
    		if (empty ($desc))
    			$desc = $field->description;
    
    		if (bps_custom_field ($field_type))
    		{
    			$output = "<p>Your HTML code for the <em>$field_type</em> field type goes here</p>";
    			$output = apply_filters ('bps_field_html', $output, $field, $label, $range);
    echo $output;
    		}
    		else if ($range)
    		{
    			list ($min, $max) = bps_minmax ($_REQUEST, $id, $field_type);
    
    echo "<label for='$fname'>" . __($label, 'bps') . "</label>";
    echo "<input style='width: 10%;' type='text' name='{$fname}_min' id='$fname' value='$min' />";
    echo '&nbsp;-&nbsp;';
    echo "<input style='width: 10%;' type='text' name='{$fname}_max' value='$max' />";
    		}
    		else switch ($field_type)
    		{
    		case 'textbox':
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: '';
    			$value = esc_attr (stripslashes ($posted));
    echo "<label for='$fname'>" . __($label, 'bps') . "</label>";
    echo "<input type='text' name='$fname' id='$fname' value='$value' />";
    			break;
    
    		case 'number':
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: '';
    			$value = esc_attr (stripslashes ($posted));
    echo "<label for='$fname'>" . __($label, 'bps') . "</label>";
    echo "<input type='number' name='$fname' id='$fname' value='$value' />";
    			break;
    
    		case 'textarea':
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: '';
    			$value = esc_textarea (stripslashes ($posted));
    echo "<label for='$fname'>" . __($label, 'bps') . "</label>";
    echo "<textarea rows='5' cols='40' name='$fname' id='$fname'>$value</textarea>";
    			break;
    
    		case 'selectbox':
    echo "<label for='$fname'>" . __($label, 'bps') . "</label>";
    echo "<select name='$fname' id='$fname'>";
    			$selectall = apply_filters ('bps_select_all', '', $field);
    			if (is_string ($selectall))
    echo "<option value='$selectall'></option>";
    
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: '';
    			$options = bps_get_options ($id);
    			foreach ($options as $option)
    			{
    				$option = trim ($option);
    				$value = esc_attr (stripslashes ($option));
    				$selected = ($option == $posted)? "selected='selected'": "";
    echo "<option $selected value='$value'>" . __($value, 'bps') . "</option>";
    			}
    echo "</select>";
    			break;
    
    		case 'multiselectbox':
    echo "<label for='$fname'>" . __($label, 'bps') . "</label>";
    echo "<select name='{$fname}[]' id='$fname' multiple='multiple'>";
    
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: array ();
    			$options = bps_get_options ($id);
    			foreach ($options as $option)
    			{
    				$option = trim ($option);
    				$value = esc_attr (stripslashes ($option));
    				$selected = (in_array ($option, $posted))? "selected='selected'": "";
    echo "<option $selected value='$value'>" . __($value, 'bps') . "</option>";
    			}
    echo "</select>";
    			break;
    
    		case 'radio':
    echo "<div class='radio'>";
    echo "<span class='label'>" . __($label, 'bps') . "</span>";
    echo "<div id='$fname'>";
    
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: '';
    			$options = bps_get_options ($id);
    			foreach ($options as $option)
    			{
    				$option = trim ($option);
    				$value = esc_attr (stripslashes ($option));
    				$selected = ($option == $posted)? "checked='checked'": "";
    echo "<label><input $selected type='radio' name='$fname' value='$value'>" . __($value, 'bps') . "</label>";
    			}
    echo '</div>';
    echo "<a class='clear-value' href='javascript:clear(\"$fname\");'>". __('Clear', 'buddypress'). "</a>";
    echo '</div>';
    			break;
    
    		case 'checkbox':
    echo "<div class='checkbox'>";
    echo "<span class='label'>" . __($label, 'bps') . "</span>";
    
    			$posted = isset ($_REQUEST[$fname])? $_REQUEST[$fname]: array ();
    			$options = bps_get_options ($id);
    			foreach ($options as $option)
    			{
    				$option = trim ($option);
    				$value = esc_attr (stripslashes ($option));
    				$selected = (in_array ($option, $posted))? "checked='checked'": "";
    echo "<label><input $selected type='checkbox' name='{$fname}[]' value='$value'>" . __($value, 'bps') . "</label>";
    			}
    echo '</div>';
    			break;
    		}
    
    	if ($desc != '-')
    echo "<p class='description'>" . __($desc, 'bps') . "</p>";
    echo '</div>';
    	}
    
    echo "<div class='submit'>";
    echo "<input type='submit' value='". __('Search', 'buddypress'). "' />";
    echo '</div>';
    	if ($bps_options['searchmode'] == 'LIKE')
    echo "<input type='hidden' name='options[]' value='like' />";
    echo "<input type='hidden' name='bp_profile_search' value='$form' />";
    echo '</form>';
    if ($mode != 'bps_auto')  echo '</div>';
    echo "\n<!-- BP Profile Search ". BPS_VERSION. " - end -->\n";
    
    	return true;
    }
    
    add_shortcode ('bps_display', 'bps_shortcode');
    function bps_shortcode ($attr, $content)
    {
    	ob_start ();
    	bps_display_form ($attr['form'], 'bps_shortcode');
    	return ob_get_clean ();
    }
    
    class bps_widget extends WP_Widget
    {
    	function bps_widget ()
    	{
    		$widget_ops = array ('description' => __('A Profile Search form.', 'bps'));
    		$this->WP_Widget ('bps_widget', __('Profile Search', 'bps'), $widget_ops);
    	}
    
    	function widget ($args, $instance)
    	{
    		extract ($args);
    		$title = apply_filters ('widget_title', $instance['title']);
    		$form = $instance['form'];
    
    		echo $before_widget;
    		if ($title)
    			echo $before_title. $title. $after_title;
    		bps_display_form ($form, 'bps_widget');
    		echo $after_widget;
    	}
    
    	function update ($new_instance, $old_instance)
    	{
    		$instance = $old_instance;
    		$instance['title'] = $new_instance['title'];
    		$instance['form'] = $new_instance['form'];
    		return $instance;
    	}
    
    	function form ($instance)
    	{
    		$title = isset ($instance['title'])? $instance['title']: '';
    		$form = isset ($instance['form'])? $instance['form']: '';
    ?>
    	<p>
    		<label for="<?php echo $this->get_field_id ('title'); ?>"><?php _e('Title:', 'bps'); ?></label>
    		<input class="widefat" id="<?php echo $this->get_field_id ('title'); ?>" name="<?php echo $this->get_field_name ('title'); ?>" type="text" value="<?php echo esc_attr ($title); ?>" />
    	</p>
    	<p>
    		<label for="<?php echo $this->get_field_id ('form'); ?>"><?php _e('Form:', 'bps'); ?></label>
    <?php
    		$posts = get_posts (array ('post_type' => 'bps_form', 'orderby' => 'ID', 'order' => 'ASC', 'nopaging' => true));
    		if (count ($posts))
    		{
    			echo "<select class='widefat' id='{$this->get_field_id ('form')}' name='{$this->get_field_name ('form')}'>";
    			foreach ($posts as $post)
    			{
    				$id = $post->ID;
    				$name = !empty ($post->post_title)? $post->post_title: __('(no title)');
    				echo "<option value='$id'";
    				if ($id == $form)  echo " selected='selected'";
    				echo ">$name &nbsp;</option>\n";
    			}
    			echo "</select>";
    		}
    		else
    		{
    			echo '<br/>';
    			_e('You have not created any form yet.', 'bps');
    		}
    ?>
    	</p>
    <?php
    	}
    }
    
    add_action ('widgets_init', 'bps_widget_init');
    function bps_widget_init ()
    {
    	register_widget ('bps_widget');
    }
    ?>
    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Perfect!! ??

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Hi Christian,
    I have updated the plugin with new modify but now all the search fields are: Your HTML code for the field type goes here
    I have deleted my modify before the update.

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    for complete guide you can see the official site: https://dontdream.it/bp-profile-search/custom-profile-field-types/

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    I have a good news. Maybe help you.
    The BP Profile Search plugin is very very hot.
    The plugin have hook for custom field for example for richtext.
    With this simple lines code it is possible to integrate richtext in profile search:

    function my_custom_bps($field_type, $field)
    {
        switch ($field->type)
        {
        case 'richtext':
            $field_type = 'textbox';
            break;
        }
        return $field_type;
    }
    add_filter('bps_field_validation_type', 'my_custom_bps', 10, 2);
    add_filter('bps_field_html_type', 'my_custom_bps', 10, 2);
    add_filter('bps_field_criteria_type', 'my_custom_bps', 10, 2);
    add_filter('bps_field_query_type', 'my_custom_bps', 10, 2);

    I decide to convert richtext to textbox (not multiline) because for search is better a single line.

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    ok.. :S
    I’m tired ahahah
    Wrong:
    add_filter(‘bps_field_validation_type’, ‘my_bps_field_validation_type’, 10, 2);
    to
    add_filter(‘bps_field_html_type’, ‘my_bps_field_html_type’, 10, 2);

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    OMG I have found your guide: https://dontdream.it/bp-profile-search/custom-profile-field-types/

    I don’t seen your hook on your page.. I was distracted!
    I have restored your plugin and now I tried to add to my child theme in the functions.php this code:

    function my_bps_field_validation_type($field_type, $field)
    {
    echo "<h1>ENTRO</h1>";
        switch ($field->type)
        {
        case 'richtext':
            $field_type = 'textbox';
            break;
        }
        return $field_type;
    }
    add_filter('bps_field_validation_type', 'my_bps_field_validation_type', 10, 2);

    But not work. The message is: Your HTML code for the richtext field type goes here

    Why the hook not work? What I wrong?

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Perfect! We will wait this function ??
    Thanks

    I have another request but is very easy and maybe interest you too!
    I have installed the “Buddypress xProfile Rich Text Field” plugin. Very beautifull plugin (to format text in textarea) and I have modified your “BP Profile Search” to work with him.
    I have added the ‘richtext’ field_type to your code and all work very well.
    But I had prefered the textbox and not textarea for search. I prefer!
    you can see it on: https://www.cirotto.net/richtext.jpg

    I don’t know maybe you can integrate it.
    Thanks

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Understood… you know some plugin make this option?

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    perfect… thanks a lot!

    Thread Starter NicolaCirotto

    (@nicolacirotto)

    Yes I know… Today I have changed the code of BP Profile Search plugin and I have added the code to work with your ‘richtext’ field type.
    Work very well.
    Now I write to BP Profile Search plugin developer, maybe he update the plugin.
    Thanks

Viewing 15 replies - 16 through 30 (of 42 total)