Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New version 1.2.0 #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
bp-simple-front-end-post
========================

A simple front end posting plugin for BuddyPress/WordPress

**How to Use this plugin**

If you want to create a form and show it on Front end, You will need to create and Register a form as follows.

**Register a from on/before bp_init action using**
`$form= bp_new_simple_blog_post_form(\'form_name\',$settings);
// Please see @ bp_new_simple_blog_post_form for the settings options`

Now, you can retrieve this form anywhere and render it as below

`$form=bp_get_simple_blog_post_form(\'form_name\');
if($form)
$form->show(); // shows this post form`
2 changes: 1 addition & 1 deletion bp-simple-front-end-post.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

/*
Plugin Name: BP Simple Front End Post
Plugin URI: http://buddydev.com/plugins/bp-simple-front-end-post/
Description: provides the ability to create unlimited post forms and allow users to save the post from front end.It is much powerful than it looks.
Version: 1.1.3
Author: Brajesh Singh
Contributors: CreativeJuiz
Author URI: http://buddydev.com/members/sbrajesh/
License: GPL
*/
Expand Down
199 changes: 110 additions & 89 deletions form.php
Original file line number Diff line number Diff line change
@@ -1,92 +1,113 @@
<?php if($this->current_user_can_post ):

?>
<?php
if ( $this->current_user_can_post ) {
?>
<div class="bp-simple-post-form">
<form class="standard-form bp-simple-post-form" method="post" action="" enctype="multipart/form-data">
<!-- do not modify/remove the line blow -->
<input type="hidden" name="bp_simple_post_form_id" value="<?php echo $this->id;?>" />
<?php wp_nonce_field( 'bp_simple_post_new_post_'.$this->id ); ?>
<input type="hidden" name="action" value="bp_simple_post_new_post_<?php echo $this->id;?>" />
<?php if($post_id) {?>
<input type="hidden" name="post_id" value="<?php echo $post_id;?>" />
<?php } ?>

<?php
/*-----------------------------------------------------------------------------
you can modify these, just make sure to not change the name of the fields
-------------------------------------------------------------------------------*/

<div class="bp-simple-post-form">

<form class="standard-form bp-simple-post-form" method="post" action="" enctype="multipart/form-data">

<!-- do not modify/remove the line blow -->
<input type="hidden" name="bp_simple_post_form_id" value="<?php echo $this->id;?>" />
<?php wp_nonce_field( 'bp_simple_post_new_post_'.$this->id ); ?>
<input type="hidden" name="action" value="bp_simple_post_new_post_<?php echo $this->id;?>" />
<?php if($post_id):?>
<input type="hidden" name="post_id" value="<?php echo $post_id;?>" />
<?php endif;?>

<!-- you can modify these, just make sure to not change the name of the fields -->

<label for="bp_simple_post_title"><?php _e('Title:','bsfep');?>
<input type="text" name="bp_simple_post_title" value="<?php echo $title;?>"/>
</label>

<label for="bp_simple_post_text" ><?php _e('Post:','bsfep');?>
<textarea name="bp_simple_post_text" id="bp_simple_post_text" ><?php echo $content; ?></textarea>
</label>
<!--- generating the file upload box -->
<?php if($this->upload_count):?>

<label> <?php _e('Uploads','bsfep');?></label>

<div class="bp_simple_post_uploads_input">
<?php for($i=0;$i<$this->upload_count;$i++):?>
<label><input type="file" name="bp_simple_post_upload_<?php echo $i;?>" /></label>
<?php endfor;?>

</div>
<?php endif;?>
<!--- generating the file upload box -->
<?php if($this->has_post_thumbnail):?>

<label> <?php _e('Featured Image','bsfep');?></label>

<div class="bp_simple_post_featured_image_input">
<label><input type="file" name="bp_simple_post_upload_thumbnail" /></label>

</div>
<?php endif;?>

<?php if($this->has_tax()):?>
<div class='simple-post-taxonomies-box clearfix'>
<?php $this->render_taxonomies();?>
<div class="clear"></div>
</div>
<?php endif;?>

<?php //custom fields ?>
<?php if($this->has_custom_fields()):?>
<?php echo "<div class='simple-post-custom-fields'>";?>
<h3>Extra Info</h3>
<?php $this->render_custom_fields();?>
<?php echo "</div>";?>
<?php endif;?>

<?php if($this->show_comment_option):?>
<div class="simple-post-comment-option">
<h3>Allow Comments</h3>
<?php $current_status=$this->comment_status;
if($post_id){
$post= get_post($post_id);
$current_status=$post->comment_status;
}
?>

<label for="bp-simple-post-comment-status">
<input id="bp-simple-post-comment-status" name="bp_simple_post_comment_status" type="checkbox" value="open" <?php echo checked('open',$current_status);?> /> Yes
</label>

</div>

<?php endif;?>

<input type="hidden" value="<?php echo $_SERVER['REQUEST_URI']; ?>" name="post_form_url" />
$title_name = 'bp_simple_post_title';
$posttext_name = 'bp_simple_post_text';
$featured_name = 'bp_simple_post_upload_thumbnail';
$comment_name = 'bp_simple_post_comment_status';

<input id="submit" name='bp_simple_post_form_subimitted' type="submit" value="<?php _e('Post','bsfep');?>" />
$h3 = apply_filters('bp_simple_post_title_tag', 'h3');
$h3_class = apply_filters('bp_simple_post_title_classes', '');
$h3_class = $h3_class != '' ? ' '.$h3_class : '';
$div = apply_filters('bp_simple_post_line_tag', 'div');
$bpsp_block_class = apply_filters('bp_simple_post_line_classes', '');
$bpsp_block_class = $bpsp_block_class != '' ? ' '.$bpsp_block_class : '';
?>
<<?php echo $div; ?> class="bp_simple_post_block<?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><label for="<?php echo $title_name; ?>"><?php _e('Title','bsfep');?></label></<?php echo $h3; ?>>
<input type="text" id="<?php echo $title_name; ?>" name="<?php echo $title_name; ?>" value="<?php echo $title;?>"/>
</<?php echo $div; ?>>


</form>
</div>
<?php

endif;
?>
<<?php echo $div; ?> class="bp_simple_post_block<?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><label for="<?php echo $posttext_name; ?>" ><?php _e('Post','bsfep');?></label></<?php echo $h3; ?>>
<textarea name="<?php echo $posttext_name; ?>" id="<?php echo $posttext_name; ?>"><?php echo $content; ?></textarea>
</<?php echo $div; ?>>

<?php
// Generating the file upload box
if ( $this->upload_count ) {
?>
<div class="bp_simple_post_block bp_simple_post_uploads_input<?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><?php _e('Uploads','bsfep');?></<?php echo $h3; ?>>
<?php
for( $i = 0; $i < $this->upload_count; $i++ ) {
?>
<input type="file" name="bp_simple_post_upload_<?php echo $i;?>" />
<?php
}
?>
</div>
<?php
} // end upload box

// Generating the file upload box
if( $this->has_post_thumbnail ) {
?>
<div class="bp_simple_post_block bp_simple_post_featured_image_input<?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><label for="<?php echo $featured_name; ?>"><?php _e('Featured Image','bsfep'); ?></label></<?php echo $h3; ?>>
<input type="file" name="<?php echo $featured_name; ?>" id="<?php echo $featured_name; ?>" />
</div>
<?php
} // end post thumbnail


// taxonomies
if($this->has_tax()) {
?>
<div class="bp_simple_post_block simple-post-taxonomies-box <?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><?php echo __('Categories','bsfep') ?></<?php echo $h3; ?>>
<?php $this->render_taxonomies();?>
</div>
<?php
} // end taxonomies

// custom fields
if($this->has_custom_fields()) {
?>
<div class="bp_simple_post_block simple-post-custom-fields<?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><?php echo __('Extra info','bsfep') ?></<?php echo $h3; ?>>
<?php $this->render_custom_fields(); ?>
</div>
<?php
} // end custom fields

// comments
if ( $this->show_comment_option ) {
?>
<div class="bp_simple_post_block simple-post-comment-option<?php echo $bpsp_block_class; ?>">
<<?php echo $h3; ?> class="bp_simpe_post_title<?php echo $h3_class; ?>"><?php echo __('Allow Comments','bsfep') ?></<?php echo $h3; ?>>
<?php
$current_status = $this->comment_status;

if ( $post_id ) {
$post= get_post($post_id);
$current_status=$post->comment_status;
}
?>
<label for="<?php echo $comment_name; ?>"><input id="<?php echo $comment_name; ?>" name="<?php echo $comment_name; ?>" type="checkbox" value="open" <?php echo checked('open',$current_status);?> /> <?php echo __('Yes') ?></label>
</div><!-- .simple-post-comment-option -->

<?php
} // end if $this->show_comment_option
?>
<input type="hidden" value="<?php echo $_SERVER['REQUEST_URI']; ?>" name="post_form_url" />
<input type="submit" id="submit" name='bp_simple_post_form_subimitted' value="<?php _e('Send post','bsfep');?>" />
</form>
</div>
<?php
}
Binary file modified languages/en_US.mo
Binary file not shown.
84 changes: 84 additions & 0 deletions languages/en_US.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
msgid ""
msgstr ""
"Project-Id-Version: BP Front End Post Editor\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-05-22 23:23+0100\n"
"PO-Revision-Date: 2014-05-22 23:24+0100\n"
"Last-Translator: Geoffrey <[email protected]>\n"
"Language-Team: \n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-KeywordsList: __;_e\n"
"X-Poedit-Basepath: .\n"
"X-Generator: Poedit 1.6.4\n"
"X-Poedit-SearchPath-0: ..\n"
"X-Poedit-SearchPath-1: .\n"

#: ../bp-simple-front-end-post.php:397
msgid "The Security check failed!"
msgstr "The Security check failed!"

#: ../bp-simple-front-end-post.php:417
msgid "You are not authorized for the action!"
msgstr "You are not authorized for the action!"

#: ../bp-simple-front-end-post.php:422
msgid "Please make sure to fill the required fields"
msgstr "Please make sure to fill the required fields"

#: ../bp-simple-front-end-post.php:545
#, php-format
msgid "%s Saved as %s successfully."
msgstr "%s Saved as %s successfully."

#: ../bp-simple-front-end-post.php:549
#, php-format
msgid "There was a problem saving your %s. Please try again later."
msgstr "There was a problem saving your %s. Please try again later."

#: ../bp-simple-front-end-post.php:795
#, php-format
msgid "Select %s"
msgstr "Select %s"

#: ../form.php:32
msgid "Title"
msgstr "Title"

#: ../form.php:37
msgid "Post"
msgstr "Post"

#: ../form.php:46
msgid "Uploads"
msgstr "Uploads"

#: ../form.php:62
msgid "Featured Image"
msgstr "Featured Image"

#: ../form.php:73
msgid "Categories"
msgstr "Categories"

#: ../form.php:83
msgid "Extra info"
msgstr "Extra info"

#: ../form.php:93
msgid "Allow Comments"
msgstr "Allow Comments"

#: ../form.php:102
msgid "Yes"
msgstr "Yes"

#: ../form.php:109
msgid "Send post"
msgstr "Send post"

#, fuzzy
#~ msgid "Post:"
#~ msgstr "Share the post"
Binary file added languages/fr_FR.mo
Binary file not shown.
Loading