It’s dangerous to allow code to be entered into profile fields. Why HTML?
My network is a bunch of baby boomers selling crafts. I teach them how to be a merchant more effectively. Their stores on Artfire.com has a widget per seller where they can add a rapid cart, shopping window or a collection. All the code is clean and safe, no other code will be allowed. I’m aware of the spammer risks..been there, done that.
The field should look similar to a blog post editor or text widget. Besides, the rapid cart code won’t work unless a shortcode is made by adding the script to the widget area and then shortcode for it in the field. This is why I’m wondering if the multisite is a better fit, harder, but better fit for what I want to offer.
The Ning sites had pages for members like such. They were drag and drop fields with the ability to accept code. Like a comment box might. This is what I need for members. I already have a member approval mechanism installed. They have to attend the basic instructions of how to blog, to be able to use the field I need made. A sign of who they are.
Is the widget code the same for every user but maybe a different id number to differentiate the widget?
You can do it safer by hard coding the widget and pull in the id number per what ever each user has entered into a text field. Does this make sense?
Any chance this has been addressed some how? i need basic options for bios – so members can make them look nice – not just one big block of text….
p, strong/b, em/i, link, ol/li, maybe h2/3/4, blockquote
that would suffice.
essentially the same options we have here in the forum… sans the code one.
@somethingelse
You can render an editor using the WordPress function wp_editor()
https://codex.wordpress.org/Function_Reference/wp_editor
Also, you might need to remove some BP filters on the member bio content areas – I’m not sure if there are any in place which strip HTML etc.
ahhh! that’s just the answer i was hoping for. much appreciated.
something new to learn!
hi again… hoping for a tiny bit of direction…
i have an editor working… sort of… it doesn’t save… and i know it’s one little tiny bit i’m missing here… just not sure what.
here’s what i’ve got in my theme file in theme>buddypress>members>single>profile>edit.php
<?php if ( 'textarea' == bp_get_the_profile_field_type() ) : ?>
<label for="<?php bp_the_profile_field_input_name(); ?>"><?php bp_the_profile_field_name(); ?> <?php if ( bp_get_the_profile_field_is_required() ) : ?><?php _e( '(required)', 'buddypress' ); ?><?php endif; ?></label>
<?php wp_editor( $listing->bp_the_profile_field_input_name, 'listingeditor', $settings = array('textarea_name' => post_content) ); ?>
<textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>><?php bp_the_profile_field_edit_value(); ?></textarea>
<?php endif; ?>
i realize it’s duplicating… that’s fine… what i need to know is…
what do i need to fix in
<?php wp_editor( $listing->bp_the_profile_field_input_name, 'listingeditor', $settings = array('textarea_name' => post_content) ); ?>
to make it SAVE that data into my xprofile field which by default is this
<textarea rows="5" cols="40" name="<?php bp_the_profile_field_input_name(); ?>" id="<?php bp_the_profile_field_input_name(); ?>" <?php if ( bp_get_the_profile_field_is_required() ) : ?>aria-required="true"<?php endif; ?>><?php bp_the_profile_field_edit_value(); ?></textarea>
i will comment out the latter (or delete it entirely once i have it all working)
it has all stopped making sense…
many thanks in advance…
btw – got THAT little suggestion from this thread which seemed to be exactly what i wanted to do…
https://wordpress.org/support/topic/convert-text-area-into-wp-editor
wp_editor
needs to identify your textarea. It does that through the textarea’s ID.
Usage is this:
wp_editor( $content, $textarea_id, $settings = array() );
I see your textarea uses bp_the_profile_field_input_name()
as it’s ID. So as a very basic (un-working) example, it would be:
wp_editor( $content, bp_the_profile_field_input_name(), $settings = array() );
Hey, did anyone get this working? I too need a WYSIWYG editor for the text areas in the BuddyPress profiles. Can’t live without that.
Henry – I see your notes above, but a little hazy on where to put that in my edit.php file. Would you be able to spell it out more?
Basically, my edit.php file now shows this:
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<div<?php bp_field_css_class( 'editfield' ); ?>>
<?php
$field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
$field_type->edit_field_html();
do_action( 'bp_custom_profile_edit_fields_pre_visibility' );
?>
<?php if ( bp_current_user_can( 'bp_xprofile_change_field_visibility' ) ) : ?>
<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?> <a href="#" class="visibility-toggle-link"><?php _e( 'Change', 'buddypress' ); ?></a>
</p>
<div class="field-visibility-settings" id="field-visibility-settings-<?php bp_the_profile_field_id() ?>">
<fieldset>
<legend><?php _e( 'Who can see this field?', 'buddypress' ) ?></legend>
<?php bp_profile_visibility_radio_buttons() ?>
</fieldset>
<a class="field-visibility-settings-close" href="#"><?php _e( 'Close', 'buddypress' ) ?></a>
</div>
<?php else : ?>
<div class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-<?php bp_the_profile_field_id() ?>">
<?php printf( __( 'This field can be seen by: <span class="current-visibility-level">%s</span>', 'buddypress' ), bp_get_the_profile_field_visibility_level_label() ) ?>
</div>
<?php endif ?>
<?php do_action( 'bp_custom_profile_edit_fields' ); ?>
<p class="description"><?php bp_the_profile_field_description(); ?></p>
</div>
<?php endwhile; ?>