Skip to content

Instantly share code, notes, and snippets.

@svenl77
Last active May 17, 2017 09:37
Show Gist options
  • Save svenl77/e025777e95ba0114180d0100a9f2443d to your computer and use it in GitHub Desktop.
Save svenl77/e025777e95ba0114180d0100a9f2443d to your computer and use it in GitHub Desktop.
BuddyForms Support for Site Origin Page Builder
<?php
add_filter('buddyforms_wp_editor', 'buddyforms_support_siteorigin', 10, 2);
function buddyforms_support_siteorigin($wp_editor, $post_id){
// First let us make sure the siteorigin_panels_render function exists
// Check if the editor content is created by siteorigin and overwrite the variable $wp_editor with a noice.
if (function_exists('siteorigin_panels_render') && siteorigin_panels_render( $post_id )){
// Change this notice to your needs.
$wp_editor = 'This Post is Created with Site Origin Page Builder and can not get changed in the Frontend. How ever, you can still change all other form elements ;)';
// You can add a link to edit the page in the backend for easy access
// If you add a link to the beckend edit screen you need to make sure you set the Edit Submissions -> Overwrite Frontend "Edit Post" Link to "Only in My Posts List". Otherwise the link wil be redirected to the frontrend form.
$wp_editor .= '<a href="' . get_edit_post_link($post_id) . '">Edit in Backend</a>';
}
return $wp_editor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment