WordPress.org

Ready to get started?Download WordPress

Forums

[closed] wp_editor() 'almost' working right (8 posts)

  1. Anointed
    Member
    Posted 2 years ago #

    I have been playing around with the new 3.3beta1 and tried the improved wp_editor() on the front end of my website.

    Long story short, I am using bbPress and replaced the textarea with the editor. This works great when creating topics or replies but has a couple of issues I can't figure out.

    If I create a post on the front end of my site using the editor in visual mode it does indeed work perfectly.

    Problems:
    1. If I click edit on the front end, the editor visual mode ends up showing the code instead of the images.
    2. Once I save the edited post, then the article ends up showing the code and not the images. (only happens on edit)

    3. I have guest posting enabled on the forums. For some reason if the user is not logged in, the visual tab and upload buttons are not displayed. How do I enable visual mode + uploads for everyone including guests?

    Here is the relevant snippet of code that I am using

    $post = get_post($post_id, 'OBJECT');
    $tabindex = bbp_get_tab_index();
    $settings = array(
        'wpautop' => true,
        'media_buttons' => true,
        'tabindex' => $tabindex
    );
    
    wp_editor( esc_html($post->post_content), 'bbp_topic_content', $settings );

    Any help would be greatly appreciated as this is so close to working right :)

    thanks

  2. Anointed
    Member
    Posted 2 years ago #

    removing esc_html removed the issue of the visual editor loading code.

    Still not sure about #3

  3. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Try using esc_textarea() instead of esc_html() in this context? You don't want to remove escaping completely.

  4. Upgrade to SVN if you can? Or Beta 2 which is due out soon. There were some more changes to this.

  5. Anointed
    Member
    Posted 2 years ago #

    I am running trunk 18999 guessing that should include changes?

    Guests still have no ability to see visual editor.
    *I have another forum topic above this one that further describes the issues I am having with the wp_editor. I can provide much more detail if needed, or even links to see the issues if it helps.

    thnx for the advice.

  6. James Edmonston
    Member
    Posted 2 years ago #

    Hi, I have just overcome this problem myself.

    Here's the code that I'm using:

    <?php
    $settings = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true, 'textarea_rows' => '25');
    wp_editor(html_entity_decode($profileuser->description), 'description', $settings);
    ?>

    The html_entity_decode() function converts all HTM entities to their applicable characters.

    **EDIT - Forgot to mention, my code's for the user biography in the user profile section. Should be the same principle, though.

  7. greggo
    Member
    Posted 2 years ago #

    I'm trying to get the media buttons to appear for guests and not having any luck with what you've posted above. The code I'm using is:

    <?php $settings = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true, 'textarea_rows' => '25'); ?>
    <?php wp_editor($EM_Event->post_content, 'em-editor-content', array('textarea_name'=>'content', $settings) ); ?>
  8. Unless you guys are using version 3.4-aortic, please make NEW TOPICS for yourself :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags