Loading Visual editor in Add Event screen

Home Forums Calendar Products Community Events Loading Visual editor in Add Event screen

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #69215
    Chris
    Participant

    Hi there Elmalak,
    I’m one of the developers here at Modern Tribe.
    First off, I’d like to thank you for your patience with this issue.

    So, to your issue we go,

    So Community Events does use the regular wp_editor that the backend uses. So you may be wondering, why does say the Viper Plugin’s buttons not show up on the frontend? It’s a very good question actually. So theoretically, actually, when you register a button as a developer to go on the editor, it will go on the editor anywhere.

    So in the case of Viper, for instance, he decided to limit those icons to only show on certain pages, specifically the screen where you can make a new post, or the screen where you can edit a post.

    This logic, found in Viper’s plugin, looks like this:

    
    if ( in_array( basename($_SERVER['PHP_SELF']), apply_filters( 'vvq_editor_pages', array('post-new.php', 'page-new.php', 'post.php', 'page.php') ) ) ) {
    // His code for adding the functions to display the button are here
    }
    
    

    Now that conditional will never return as true for a frontend editor. So even though he used a system to add his button everywhere, and Tribe used the standard editor, his buttons will only appear in the backend.

    So the same thing is happening with your plugin. After spending a bit of time trying to figure out the plugin you were using, I tracked down the same style of code in that one as well:

    add_action('admin_init', 'gmap_add_buttons');
    function gmap_add_buttons() {
    // Don't bother doing this stuff if the current user lacks permissions
    if( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
    return;
    
    // Add only in Rich Editor mode
    if( get_user_option('rich_editing') == 'true') {
    add_filter('mce_external_plugins', 'add_gmap_script');
    add_filter('mce_buttons', 'add_gmap_button');
    }
    }
    

    the admin_init function only runs when you are in the backend of WordPress, so off the bat, this isn’t going to load those buttons on the frontend, since you’d need to hook onto an action that fires on the frontend.
    Further, notice the capability check. He’s only loading the buttons if the user is able to both edit posts and pages. So unless your user role has those permissions via a custom role or an editor or administrator role, you won’t see them either.

    This same cap check is done on every function related to those buttons, from display to saving.

    So to summarize, Events Calendar is using the standard WordPress editor, but the two plugins (the GPX one and the example Viper one) both use code that explicitly prevents them from loading for your users.

    I would suggest talking to that plugins author about changing his code so you can use it on the frontend.

    -Chris

    #69364
    elmalak
    Participant

    Hi Chris.
    Thank you for your detailed and informative reply to my issue.
    That definitely makes more sense and I can see now what you mean.

    I will go ahead and contact the plugin author and hope he responds positively.

    Much appreciated.
    Elmalak

    #69365
    Casey
    Participant

    Great! I’m glad that Chris was able to explain this better than I was and get you the information you were looking for.

    Since it sounds like you’re all set with this, I’m going to go ahead and close out this thread. Please feel free to start a new thread if you have further issues.

    Thanks so much!

    #981306
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 4 posts - 16 through 19 (of 19 total)
  • The topic ‘Loading Visual editor in Add Event screen’ is closed to new replies.