I need a help after upgrade wordpress to 3.5 version with uCan Post plugin.
In settings menu the bug is: Warning: Missing argument 2 for wpdb::prepare(), called in /home/xxx/xxx/wp-content/plugins/ucan-post/ucan-post-class.php on line 564 and defined in /home/xxx/xxx/wp-includes/wp-db.php on line 990
In materials/posts menu the bug is: Warning: Missing argument 2 for wpdb::prepare(), called in /home/xxx/xxx/wp-content/plugins/ucan-post/ucan-post-class.php on line 420 and defined in /home/xxx/xxx/wp-includes/wp-db.php on line 990
ucan-post-class.php on line 564 is: return $wpdb->get_results($wpdb->prepare(“SELECT user_login, ID FROM {$wpdb->users} ORDER BY user_login ASC”));
ucan-post-class.php on line 420 is: return $wpdb->get_results($wpdb->prepare(“SELECT * FROM {$this->ucan_db_submissions} ORDER BY id
DESC”));
wp-db.php on line 990 is: function prepare( $query, $args ) {
]]>When a post is added, I want the automatically generated message to be sent to the user instead of the admin … or both people … but I’m more interested in the email being sent to the user. How can I change the code in ucan-post-class.php to make this happen?
I would guess it is around Line 602
//Email the admin when a new post is submitted — maybe
function uCan_Maybe_Email_Admin($link) { if ($this->ucan_options['uCan_Email_Admin']) { $sendername = get_option('blogname'); $sendermail = get_option('admin_email'); //Both to and from $headers = "MIME-Version: 1.0\r\n" . "From: ".$sendername." "."<".$sendermail.">\n" . "Content-Type: text/HTML; charset=\"" . get_settings('blog_charset') . "\"\r\n"; $mailMessage = '<p>'.__('Thank you for your submission.', 'ucan-post').'</p>'; if(!empty($sendermail)) wp_mail($sendermail, __('Your Post', 'ucan-post'), $mailMessage, $headers); } }
Any help would be greatly appreciated
Thanks!
I am using ucan post plugin and need to make the post page submit to different catagories. The current edition of this plugin can only submit post to the default catagory setted on the admin page. So I made a bit change on the shortcode.
[uCan-Post cid=xx] cid represent on the catagory id.
The code I have changed are all located in ucan-post-class.php
Here is the code:
<?php
if (!class_exists("uCanPost"))
{
class uCanPost
{
/***************************SETUP***************************/
//Constructor
function uCanPost()
{
$this->uCan_Set_Admin_Options(); //Init the admin options
$this->uCan_Set_DB_Table_Names();
}
//Define some variables
var $ucan_options_name = "uCan_Post_Options";
var $ucan_options = array();
var $ucan_plugin_dir = "";
var $ucan_plugin_url = "";
var $ucan_page_url = "";
var $ucan_action_url = "";
var $ucan_js_url = "";
var $ucan_views_dir = "";
var $ucan_images_url = "";
var $ucan_wp_admin_url = "";
var $ucan_wp_includes_url = "";
var $ucan_db_submissions = "";
function uCan_Set_DB_Table_Names()
{
global $wpdb;
$this->ucan_db_submissions = $wpdb->prefix.'ucan_post_submissions';
}
//This function is called on Plugin Activation -- it just allows subscribers access to uploads
function uCan_Activate()
{
global $wpdb;
$charset_collate = '';
if($wpdb->has_cap('collation'))
{
if(!empty($wpdb->charset))
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if(!empty($wpdb->collate))
$charset_collate .= " COLLATE $wpdb->collate";
}
$ucan_submissions_sql = "CREATE TABLE ".$this->ucan_db_submissions."(
<code>id</code> int(11) NOT NULL auto_increment,
<code>name</code> varchar(120) NOT NULL,
<code>email</code> varchar(120) NOT NULL,
<code>postid</code> int(11) NOT NULL default '0',
<code>type</code> varchar(60) NOT NULL,
PRIMARY KEY (<code>id</code>))
{$charset_collate};";
require_once(ABSPATH.'wp-admin/includes/upgrade.php');
dbDelta($ucan_submissions_sql);
$role = get_role('contributor');
$role->add_cap('upload_files');
$role = get_role('subscriber');
$role->add_cap('upload_files');
$role->add_cap('unfiltered_html');
}
//Initialize all the above variables
function uCan_Set_Links()
{
$this->ucan_plugin_dir = ABSPATH."wp-content/plugins/ucan-post/";
$this->ucan_plugin_url = WP_CONTENT_URL."/plugins/ucan-post/";
$this->ucan_page_url = get_permalink($this->uCan_Page_ID());
$this->ucan_action_url = $this->ucan_page_url.$this->uCan_Get_Delim()."ucanaction=";
$this->ucan_views_dir = $this->ucan_plugin_dir."views/";
$this->ucan_js_url = $this->ucan_plugin_url."js/";
$this->ucan_images_url = $this->ucan_plugin_url."images/";
$this->ucan_wp_admin_url = get_option('siteurl')."/wp-admin/";
$this->ucan_wp_includes_url = get_option('siteurl')."/wp-includes/";
}
//Get the dilim for use in the action url's
function uCan_Get_Delim()
{
global $wp_rewrite;
if($wp_rewrite->using_permalinks())
return "?";
else
return "&";
}
//Get the page id where the [uCan-Post] shortcode is
function uCan_Page_ID()
{
global $wpdb;
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content LIKE '%[uCan-Post]%' AND post_status = 'publish' AND post_type = 'page'");
}
//Enque the scripts needed for the media uploader
function uCan_Enqueue_Scripts()
{
if($this->ucan_options['uCan_Use_WYSIWYG'] && $this->ucan_options['uCan_Allow_Uploads'] && !$this->ucan_options['uCan_Force_JS'])
{
wp_enqueue_script('jquery');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
}
}
//Add styles and scripts to the <head>
function uCan_Add_To_WP_Head()
{
$this->uCan_Set_Links();
if(is_page($this->uCan_Page_ID()))
{
?>
<link rel="stylesheet" type="text/css" media="all" href="<?php echo $this->ucan_plugin_url.'niceforms/niceforms-default.css'; ?>" />
<?php
if($this->ucan_options['uCan_Use_WYSIWYG']) //Saves js code from being loaded when not needed - preventing more conflicts
{
if($this->ucan_options['uCan_Force_JS'])
echo '<script type="text/javascript" src="'.$this->ucan_wp_admin_url.'load-scripts.php?c=1&load=jquery,utils,thickbox,media-upload"></script>';
?>
<link rel="stylesheet" id="thickbox-css" href="<?php echo $this->ucan_wp_includes_url.'js/thickbox/thickbox.css'; ?>" type="text/css" media="all" />
<script type="text/javascript" src="<?php echo $this->ucan_js_url.'tinymce/tiny_mce.js'; ?>" ></script>
<script type="text/javascript">
tinyMCE.init({
mode : "specific_textareas",
theme : "advanced",
skin : "o2k7",
editor_selector:"theEditor",
remove_script_host : false,
convert_urls : false,
width:"80%",
theme_advanced_buttons1 : "bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontsizeselect,formatselect",
theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,image,media",
theme_advanced_buttons3 : "blockquote,|,forecolor,backcolor,|,emotions,charmap,spellchecker,|,code,preview,|,help",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
plugins : "emotions,preview,safari,spellchecker,media"
});
</script>
<script type="text/javascript">
/* <![CDATA[ */
var thickboxL10n = {
next: "Next >",
prev: "< Prev",
image: "Image",
of: "of",
close: "Close",
noiframes: "This feature requires inline frames. You have iframes disabled or your browser does not support them."
};
try{convertEntities(thickboxL10n);}catch(e){};
/* ]]> */
</script>
<?php
}
}
}
/************************ADMIN SETUP************************/
//Add the admin settings page
function uCan_Add_Admin_Page()
{
$this->uCan_Set_Links();
add_menu_page(__('uCan Post - Options', 'ucan-post'), 'uCan Post', 'administrator', 'ucanmain', array(&$this, 'uCan_Display_Admin_Options_Page'), $this->ucan_images_url.'menu_icon.png');
add_submenu_page( 'ucanmain', __('uCan Post - Options', 'ucan-post'), __('Options', 'ucan-post'), 'administrator', 'ucanmain', array(&$this, 'uCan_Display_Admin_Options_Page'));
add_submenu_page( 'ucanmain', __('uCan Post - Submissions', 'ucan-post'), __('Submissions', 'ucan-post'), 'administrator', 'ucansubmissions', array(&$this, 'uCan_Display_Admin_Submissions_Page'));
}
//Sets up variables and displays the admin page
function uCan_Display_Admin_Options_Page()
{
$categories = $this->uCan_Get_Categories();
$users = $this->uCan_Get_All_Users();
if($this->uCan_Save_Admin_Options())
require($this->ucan_views_dir.'ucan-admin-options-saved.php');
require($this->ucan_views_dir.'ucan-admin-options-form.php');
}
function uCan_Display_Admin_Submissions_Page()
{
if(isset($_GET['ucanaction']) && $_GET['ucanaction'] == 'publish')
{
$pid = $_GET['pid'];
$tomail = stripslashes(urldecode($_GET['tomail']));
$post = array();
$post['ID'] = $pid;
$post['post_status'] = "publish";
if($pid)
{
wp_update_post($post);
$this->uCan_Maybe_Email_User($pid, $tomail);
require($this->ucan_views_dir.'ucan-admin-post-published.php');
}
}
$submissions = $this->uCan_Get_All_Submissions();
require($this->ucan_views_dir.'ucan-admin-submissions-page.php');
}
//Get/Set the admin options
function uCan_Set_Admin_Options()
{
$ucan_old_options = get_option($this->ucan_options_name); //Get any existing options
$this->ucan_options = array('uCan_Post_Level' => '0',
'uCan_Post_Type' => 'post', /*TODO*/
'uCan_Show_Categories' => false,
'uCan_Default_Category' => 1,
'uCan_Exclude_Categories' => '',
'uCan_Allow_Author' => true,
'uCan_Allow_Author_Edits' => false,
'uCan_Append_Guest_Name' => true,
'uCan_Default_Author' => 1,
'uCan_Allow_Tags' => false,
'uCan_Default_Tags' => '',
'uCan_Show_Excerpt' => false,
'uCan_Allow_Comments' => true,
'uCan_Allow_Pings' => true,
'uCan_Email_Admin' => true,
'uCan_Email_User' => false,
'uCan_Moderate_Posts' => true,
'uCan_Allow_Uploads' => true,
'uCan_Show_Captcha' => false,
'uCan_Use_WYSIWYG' => true,
'uCan_Force_JS' => false
);
if(!empty($ucan_old_options))
foreach($ucan_old_options as $key => $value)
$this->ucan_options[$key] = $value;
update_option($this->ucan_options_name, $this->ucan_options);
}
//Check if we're saving -- if so save to the wp_options table
function uCan_Save_Admin_Options()
{
if(isset($_POST['ucan_save_admin_options']) && !empty($_POST['ucan_save_admin_options']))
{
$ucan_save_options = array( 'uCan_Post_Level' => $_POST['ucan_post_level'],
'uCan_Post_Type' => 'post', /*TODO*/
'uCan_Show_Categories' => $_POST['ucan_show_categories'],
'uCan_Default_Category' => $_POST['ucan_default_category'],
'uCan_Exclude_Categories' => $_POST['ucan_exclude_categories'],
'uCan_Allow_Author' => $_POST['ucan_allow_author'],
'uCan_Allow_Author_Edits' => $_POST['ucan_allow_author_edits'],
'uCan_Default_Author' => $_POST['ucan_default_author'],
'uCan_Append_Guest_Name' => $_POST['ucan_append_guest_name'],
'uCan_Allow_Tags' => $_POST['ucan_allow_tags'],
'uCan_Default_Tags' => $_POST['ucan_default_tags'],
'uCan_Show_Excerpt' => $_POST['ucan_show_excerpt'],
'uCan_Allow_Comments' => $_POST['ucan_allow_comments'],
'uCan_Allow_Pings' => $_POST['ucan_allow_pings'],
'uCan_Email_Admin' => $_POST['ucan_email_admin'],
'uCan_Email_User' => $_POST['ucan_email_user'],
'uCan_Moderate_Posts' => $_POST['ucan_moderate_posts'],
'uCan_Allow_Uploads' => $_POST['ucan_allow_uploads'],
'uCan_Show_Captcha' => $_POST['ucan_show_captcha'],
'uCan_Use_WYSIWYG' => $_POST['ucan_use_wysiwyg'],
'uCan_Force_JS' => $_POST['ucan_force_js']
);
update_option($this->ucan_options_name, $ucan_save_options);
$this->uCan_Set_Admin_Options(); //Make sure new options are updated in the class instance
return true;
}
return false;
}
/***********************VALIDATE FORM***********************/
//Validate post submission before committing it to the DB
function uCan_Validate_Submission()
{
global $user_ID;
$errors = array();
if($this->ucan_options['uCan_Show_Captcha'])
{
include_once($this->ucan_plugin_dir.'captcha/shared.php');
$code = ucan_str_decrypt($_POST['ucan_security_check']);
}
if(empty($_POST['ucan_submission_title']))
$errors[] = __('You must enter a title!', 'ucan-post');
if(empty($_POST['ucan_submission_content']))
$errors[] = __('You must enter some content!', 'ucan-post');
if($this->ucan_options['uCan_Show_Captcha'])
if($code != $_POST['ucan_show_captcha'] && !empty($code))
$errors[] = __('Image verification did not match!','ucan-post');
if(empty($_POST['ucan_submission_guest_name']) && !$user_ID)
$errors[] = __('You must enter your name!', 'ucan-post');
if((empty($_POST['ucan_submission_guest_email']) || !$this->uCan_Validate_Email_Address(stripslashes($_POST['ucan_submission_guest_email']))) && !$user_ID)
$errors[] = __('You must enter a valid email address!', 'ucan-post');
return $errors;
}
/***********************PUBLISH POST************************/
//If validation checks out - Publish this PIG
function uCan_Display_Publish()
{
global $user_ID;
$categories = $this->uCan_Get_Categories();
$errors = $this->uCan_Validate_Submission();
$new_post_id = 0;
$maybe_view_new_post = "";
$new_post_permalink = "";
if(empty($errors))
{
$new_post_id = wp_insert_post($this->uCan_Publish_Submission()); //See next function down
if ($new_post_id)
{
$new_post_permalink = get_permalink($new_post_id);
$this->uCan_Maybe_Email_Admin($new_post_permalink);
$this->uCan_Add_DB_Submission($new_post_id);
require($this->ucan_views_dir.'ucan-publish.php');
}
else
require($this->ucan_views_dir.'ucan-unknown-error.php');
}
else
{
require($this->ucan_views_dir.'ucan-errors.php');
require($this->ucan_views_dir.'ucan-submission-form.php');
}
}
function uCan_Display_Publish_M($id)
{
global $user_ID;
$categories = $id;
$errors = $this->uCan_Validate_Submission();
$new_post_id = 0;
$maybe_view_new_post = "";
$new_post_permalink = "";
if(empty($errors))
{
$new_post_id = wp_insert_post($this->uCan_Publish_Submission_M($id)); //See next function down
if ($new_post_id)
{
$new_post_permalink = get_permalink($new_post_id);
$this->uCan_Maybe_Email_Admin($new_post_permalink);
$this->uCan_Add_DB_Submission($new_post_id);
require($this->ucan_views_dir.'ucan-publish.php');
}
else
require($this->ucan_views_dir.'ucan-unknown-error.php');
}
else
{
require($this->ucan_views_dir.'ucan-errors.php');
require($this->ucan_views_dir.'ucan-submission-form.php');
}
}
//Does all the checks and prepares the array for post insertion
function uCan_Publish_Submission()
{
global $user_ID;
$append_name = "";
if($this->ucan_options['uCan_Append_Guest_Name'] && $this->ucan_options['uCan_Post_Level'] == 'guest' && !$user_ID)
$append_name = '<br/>'.__('By:', 'ucan-post').' '.stripslashes($_POST['ucan_submission_guest_name']);
$ucan_new_post = array();
$ucan_new_post['post_type'] = $this->ucan_options['uCan_Post_Type']; //TODO
$ucan_new_post['post_title'] = stripslashes($_POST['ucan_submission_title']);
$ucan_new_post['post_content'] = stripslashes($_POST['ucan_submission_content']).$append_name;
if($this->ucan_options['uCan_Show_Excerpt'])
$ucan_new_post['post_excerpt'] = stripslashes($_POST['ucan_submission_excerpt']);
if($this->ucan_options['uCan_Show_Categories'])
$ucan_new_post['post_category'] = array($this->ucan_options['uCan_Default_Category'], $_POST['ucan_submission_category']);
else
{ $ucan_new_post['post_category'] = array($this->ucan_options['uCan_Default_Category']);}
if($this->ucan_options['uCan_Allow_Author'] && $user_ID)
$ucan_new_post['post_author'] = $user_ID;
else
$ucan_new_post['post_author'] = $this->ucan_options['uCan_Default_Author'];
if($this->ucan_options['uCan_Allow_Tags'])
$ucan_new_post['tags_input'] = $this->ucan_options['uCan_Default_Tags'].', '.stripslashes($_POST['ucan_submission_tags']);
else
$ucan_new_post['tags_input'] = $this->ucan_options['uCan_Default_Tags'];
if($this->ucan_options['uCan_Allow_Comments'])
$ucan_new_post['comment_status'] = 'open';
else
$ucan_new_post['comment_status'] = 'closed';
if($this->ucan_options['uCan_Allow_Pings'])
$ucan_new_post['ping_status'] = 'open';
else
$ucan_new_post['ping_status'] = 'closed';
if($this->ucan_options['uCan_Moderate_Posts'])
$ucan_new_post['post_status'] = 'pending';
else
$ucan_new_post['post_status'] = 'publish';
return $ucan_new_post;
}
function uCan_Publish_Submission_M($cal)
{
global $user_ID;
$append_name = "";
if($this->ucan_options['uCan_Append_Guest_Name'] && $this->ucan_options['uCan_Post_Level'] == 'guest' && !$user_ID)
$append_name = '<br/>'.__('By:', 'ucan-post').' '.stripslashes($_POST['ucan_submission_guest_name']);
$ucan_new_post = array();
$ucan_new_post['post_type'] = $this->ucan_options['uCan_Post_Type']; //TODO
$ucan_new_post['post_title'] = stripslashes($_POST['ucan_submission_title']);
$ucan_new_post['post_content'] = stripslashes($_POST['ucan_submission_content']).$append_name;
if($this->ucan_options['uCan_Show_Excerpt'])
$ucan_new_post['post_excerpt'] = stripslashes($_POST['ucan_submission_excerpt']);
if($cal)
{$ucan_new_post['post_category'] = array($cal);}
//elseif($this->ucan_options['uCan_Show_Categories'])
//$ucan_new_post['post_category'] = array($this->ucan_options['uCan_Default_Category'], $_POST['ucan_submission_category']);
else
{$ucan_new_post['post_category'] = array($this->ucan_options['uCan_Default_Category']);}
if($this->ucan_options['uCan_Allow_Author'] && $user_ID)
$ucan_new_post['post_author'] = $user_ID;
else
$ucan_new_post['post_author'] = $this->ucan_options['uCan_Default_Author'];
if($this->ucan_options['uCan_Allow_Tags'])
$ucan_new_post['tags_input'] = $this->ucan_options['uCan_Default_Tags'].', '.stripslashes($_POST['ucan_submission_tags']);
else
$ucan_new_post['tags_input'] = $this->ucan_options['uCan_Default_Tags'];
if($this->ucan_options['uCan_Allow_Comments'])
$ucan_new_post['comment_status'] = 'open';
else
$ucan_new_post['comment_status'] = 'closed';
if($this->ucan_options['uCan_Allow_Pings'])
$ucan_new_post['ping_status'] = 'open';
else
$ucan_new_post['ping_status'] = 'closed';
if($this->ucan_options['uCan_Moderate_Posts'])
$ucan_new_post['post_status'] = 'pending';
else
$ucan_new_post['post_status'] = 'publish';
return $ucan_new_post;
}
function uCan_Add_DB_Submission($postid)
{
global $wpdb, $user_ID;
if($user_ID)
$user_info = get_userdata($user_ID);
$type = 'guest';
if($user_ID)
$type = 'member';
$name = $wpdb->escape(stripslashes($_POST['ucan_submission_guest_name']));
if($user_ID)
if(!empty($user_info->first_name) || !empty($user_info->last_name))
$name = $user_info->first_name.' '.$user_info->last_name;
else
$name = $user_info->user_login;
$email = $wpdb->escape(stripslashes($_POST['ucan_submission_guest_email']));
if($user_ID)
$email = $user_info->user_email;
$wpdb->query($wpdb->prepare("INSERT INTO {$this->ucan_db_submissions} (<code>type</code>, <code>name</code>, <code>email</code>, <code>postid</code>) VALUES ('{$type}', '{$name}', '{$email}', '{$postid}')"));
}
function uCan_Get_All_Submissions()
{
global $wpdb;
return $wpdb->get_results($wpdb->prepare("SELECT * FROM {$this->ucan_db_submissions} ORDER BY <code>id</code> DESC"));
}
function uCan_Delete_Submission($id)
{
global $wpdb;
$wpdb->query($wpdb->prepare("DELETE FROM {$this->ucan_db_submissions} WHERE <code>postid</code> = {$id}"));
}
/************************UPDATE POST************************/
//Shows the edit post form
function uCan_Display_Edit_Post()
{
global $user_ID;
$pid = $_GET['pid'];
if($pid && $user_ID && $this->ucan_options['uCan_Allow_Author_Edits']) //$user_ID and options check here makes sure guest hackers cannot edit posts
{
$post = get_post($pid);
require($this->ucan_views_dir.'ucan-edit-post-form.php');
}
else
{
require($this->ucan_views_dir.'ucan-unknown-error.php');
}
}
//Updates the post if all checks out ok and notifies user if successful
function uCan_Display_Update_Post()
{
$post = array();
$postid = 0;
$post['ID'] = $_GET['eid'];
$post['post_title'] = stripslashes($_POST['ucan_submission_title']);
$post['post_content'] = stripslashes($_POST['ucan_submission_content']);
$post['post_excerpt'] = stripslashes($_POST['ucan_submission_excerpt']);
if(!empty($post['post_title']) && !empty($post['post_content'])) //Make sure title and content aren't left blank
$postid = wp_update_post($post);
if($postid)
require($this->ucan_views_dir.'ucan-updated-post.php');
else
require($this->ucan_views_dir.'ucan-unknown-error.php');
}
//Displays an edit link at the bottom of the posts if the user is the same as the author
function uCan_Add_Edit_Post_Link($text)
{
global $user_ID;
$this->uCan_Set_Links();
$pid = get_the_ID();
$puid = get_the_author_ID();
$edit = "<a href='".$this->ucan_action_url."editpost&pid=".$pid."'>".__('Edit your submission', 'ucan-post')."</a>";
if(!$this->ucan_options['uCan_Allow_Author_Edits'] || $user_ID != $puid || is_page())
return $text;
return $text."<br/>".$edit;
}
/************************FORM DISPLAY***********************/
//Display the post submission form
function uCan_Display_Form()
{
global $user_ID;
$categories = $this->uCan_Get_Categories();
require($this->ucan_views_dir.'ucan-submission-form.php');
}
function uCan_Display_Form_M($cal)
{
global $user_ID;
$categories = $cal; //$this->uCan_Get_Categories();
require($this->ucan_views_dir.'ucan-submission-form.php');
}
/**********************PREVIEW DISPLAY**********************
//Display a preview of the post before submitting it
function uCan_Display_Preview()
{
$categories = $this->uCan_Get_Categories();
$errors = $this->uCan_Validate_Submission();
if(empty($errors))
{
require($this->ucan_views_dir.'ucan-preview.php');
require($this->ucan_views_dir.'ucan-submission-form.php');
}
else
{
require($this->ucan_views_dir.'ucan-errors.php');
require($this->ucan_views_dir.'ucan-submission-form.php');
}
}
*/
/********************MAIN DISPLAY CONTROL*******************/
//Display the proper page content
function uCan_Display($atts)
{
global $user_level;
extract ( shortcode_atts(array(
'cid' => ''
), $atts));
$out = "";
$logorreg = ' <a href="'.get_option('siteurl').'/wp-login.php?action=login'.'">'.__('login', 'ucan-post').'</a> '.__('or', 'ucan-post').' <a href="'.get_option('siteurl').'/wp-login.php?action=register'.'">'.__('register', 'ucan-post').'</a>.';
$this->uCan_Set_Links(); //This pretty much sets all the links/directories up
ob_start();
if(current_user_can('level_'.$this->ucan_options['uCan_Post_Level']) || $this->ucan_options['uCan_Post_Level'] == 'guest')
switch($_GET['ucanaction'])
{
/*case 'ucanpreview':
$this->uCan_Display_Preview();
break;*/
case 'ucanpublish':
$this->uCan_Display_Publish_M($cid);
break;
/*case 'ucannojs':
$out .= "<strong>".__('Your browser does not support JavaScript', 'ucan-post')."</strong>";
break;*/
case 'editpost':
$this->uCan_Display_Edit_Post();
break;
case 'updatepost':
$this->uCan_Display_Update_Post();
break;
default:
$this->uCan_Display_Form_M($cid);
break;
}
else
echo "<p><strong>".__('Only registered users have permission to view this form. Please', 'ucan-post').$logorreg."</strong></p>";
$out = ob_get_contents();
ob_end_clean();
return $out;
}
/***********************MISC FUNCTIONS**********************/
//Get all user ID's and user login's
function uCan_Get_All_Users()
{
global $wpdb;
return $wpdb->get_results($wpdb->prepare("SELECT user_login, ID FROM {$wpdb->users} ORDER BY user_login ASC"));
}
//Get all post categories whether empty or not
function uCan_Get_Categories()
{
$args = array('type' => $this->ucan_options['uCan_Post_Type'], /*TODO*/
'hide_empty' => 0,
'exclude' => $this->ucan_options['uCan_Exclude_Categories']
);
return get_categories($args);
}
//Email the admin when a new post is submitted -- maybe
function uCan_Maybe_Email_Admin($link)
{
if ($this->ucan_options['uCan_Email_Admin'])
{
$sendername = get_option('blogname');
$sendermail = get_option('admin_email'); //Both to and from
$headers = "MIME-Version: 1.0\r\n" .
"From: ".$sendername." "."<".$sendermail.">\n" .
"Content-Type: text/HTML; charset=\"" . get_settings('blog_charset') . "\"\r\n";
$mailMessage = '<p>'.__('A new post has been submitted on your site. Follow the link below to view it. Do not forget to Publish the post if you are moderating new submissions.', 'ucan-post').'<br/><a href="'.$link.'"><strong>'.__('View Submission', 'ucan-post').'</strong></a></p>';
if(!empty($sendermail))
wp_mail($sendermail, __('New Post Submission', 'ucan-post'), $mailMessage, $headers);
}
}
//Email the user when their post is published
function uCan_Maybe_Email_User($pid, $tomail)
{
if ($this->ucan_options['uCan_Email_User'])
{
$link = get_permalink($pid);
$sendername = get_option('blogname');
$frommail = get_option('admin_email');
$headers = "MIME-Version: 1.0\r\n" .
"From: ".$sendername." "."<".$frommail.">\n" .
"Content-Type: text/HTML; charset=\"" . get_settings('blog_charset') . "\"\r\n";
$mailMessage = '<p>'.__('Your post was published. Follow the link below to view it.', 'ucan-post').'<br/><a href="'.$link.'"><strong>'.__('View Submission', 'ucan-post').'</strong></a></p>';
if(!empty($tomail) && !empty($frommail))
wp_mail($tomail, __('Post Published', 'ucan-post'), $mailMessage, $headers);
}
}
//Validates the guests email address to make sure it's semi-valid
function uCan_Validate_Email_Address($input)
{
$atom = '[a-zA-Z0-9!#$%&\'*+\-\/=?^_
{|}~]+’;
$quoted_string = ‘”([\x1-\x9\xB\xC\xE-\x21\x23-\x5B\x5D-\x7F]|\x5C[\x1-\x9\xB\xC\xE-\x7F])*”‘;
$word = “$atom(\.$atom)*”;
$domain = “$atom(\.$atom)+”;
return strlen($input) < 256 && preg_match(“/^($word|$quoted_string)@${domain}\$/”, $input);
}
/*This will autoembed things like Youtube videos into the posts
function uCan_Auto_Embed($string)
{
global $wp_embed;
if (is_object($wp_embed))
return $wp_embed->autoembed($string);
else
return $string;
}*/
} //END CLASS
} //END IF
?>`
function I changed include:
* uCan_Display now are calling modified function uCan_Display_Publish_M()
* uCan_Display_Publish_M() now extract cid from shortcode and tranfer it to uCan_Publish_Submission_M()
* uCan_Publish_Submission_M() will then put the catagory id into wp_post array.
Please have a try and give me a buzz for how do you think. : )
]]>don’t bother with this plugin.
]]>Getting the following error with WordPress 3.2.1
Notice: get_the_author_ID is deprecated since version 2.8! Use get_the_author_meta(‘ID’) instead. in /home/a1896385/public_html/wp-includes/functions.php on line 3382
]]>I have one page where this plugin is working perfectly, but new pages/posts are not working at all. The WYSIWYG Editor doesn’t show and the fields are showing but are all off in the alignments.
Thank you kindly for your support, ??
]]>Hello,
I’ve been in contact with the lead developer of TinyMCE who has stated that the latest version is compatible with iOS5. Could you please upgrade to the latest TinyMCE version so that my iPad users can use your plugin? Thank you!
]]>Why after i create a new post the thumbnail doesn’t show. I think it because image upload was in page (when we make new post) not in the post. Can you fix this? thanks
]]>I’m having a terrible time getting the formmating to work for the Submit post form. I’ve tried changing settings in the niceforms-default.css and ucan-submission-form.php. No real luck here. This is one of those frustrating cases where I think I have found the right plugin but low and behold and I the formatting for me is so bad it’s unusable. I would love to know where to go and what to do to get this fixed.
Any help would be grealy apprecianted!
Regards,
LC
The plugin is facing serious security issue.
After it’s activated, all subscribers have “Media” tab in their dashboard, allowing to upload and see all the media files.
Even if you deactivate and uninstall the plugin, they can still get access to the Media library.
See more here:
https://www.ads-software.com/support/topic/plugin-wp-hide-dashboard-media-tab-still-visible
No support from the developer though!
How do you actually hide the Media library from subscribers now?!
]]>I have installed the plugin and it has created 441 pending posts for each test of a guest post submission.
Unsure how to correct this.
Assistance greatly appreciated.
Is there a way to adjust the width and height of the text box?
]]>I can upload pictures but I can’t add it to the article…
]]>I just downlaoded and installed the uCan Post plugin for a buddypress site I’m developing. I want to replace the WYSIWYG editor that uCan Post provides with the standard editor that you use in the wp admin area.
I’ve tried just re-pointing to the files in the wp-includes dir, but no luck. I’m running this site on a localhost apache server.
Any help would be very much appreciated.
Thanks.
]]>I am unable to type in the WYSIWYG editor in IE9.
Any suggestions?
]]>First, I’d like to thank the author for this excellent plugin.
Question though, does anybody know how to preload some post content into the form for the user? Hidden or not, either works.
Thank you very much for your time.
]]>Hi,
I have a calendar that uses custom fields to convert posts into events. I’m also using ucan post to get guest event submissions for the calendar but can’t figure out how or where to add/assign the hidden custom fields so WP knows these are event submissions? Is this something I add into the php files?
It would be great if the author could input their URL like they do in the comments section and have their URL linked to their name. Also would be nice if you added styling options to the author name at the end of the post. Thanks for this great plugin.
(PS – the plugin author’s website seems to be down. Is this still being supported?)
]]>When I publish a post that comes through ucan-post, it’s automatically adding some formatting that doesn’t mesh with the rest of my site. The main culprit is background color. It looks like it’s automatically added a background-color: #ffffff style around each block of text that a user submits. This leaves the user’s post surrounded by a white text box, when the background of my site is not white.
Here is an example of what I’m talking about: https://www.vcize.com/images/ucanpost-white.png
Notice the white box surrounding the text of the post. I don’t want that there. How can I eliminate this without having to go through every user post and manually strip out the attribute?
Also, is there a way to set the default font/size in the user’s editor to match the font on my site? It looks really unnatural with all the user posts being a different font than the rest of the site.
]]>how can category shortcode
ex:[uCan-Post category id=72] ….
sorry poor english , thanks
]]>If you’re getting submission notification email messages with raw or “naked” HTML tags in them, this is the fix.
Go into the ucan-post-class.php
file, and look for line 584 which shows:
$headers = "MIME-Version: 1.0\r\n" .
Change it into:
$headers = "MIME-Version: 1.0\r\nContent-Type: text/html; charset=utf-8\r\nContent-Transfer-Encoding: Quoted-printable\r\n" .
Done.
Enjoy! ??
]]>On my site, https://www.yakstand.com, I have added a custom woo_get_image code to the index file to display the thumbnail. However, when I use the uCan post page to submit a post it does not submit the thumbnail as you can see from my test post.
How can I correct this?
]]>Is it possible to submit posts to a custom post type?
]]>Is there any way to set more than 1 category?
I have category blocks, and the user has to choose one in every block.
Or: How can I use the original WP way to choose category in Ucan post?
]]>hi, i love the approach and would like to use the plugin. however when activated, the captcha doesn’t display properly, meaning that an image appears but appart from some smears, no letters or digits to enter get displayed. any help on what to change so i can get rid of all the spam? thanks, martin
]]>When submitting a post using the uCan Post form it creates two duplicate posts. Is there a fix for this?
Cheers,
Lee
I uploaded this plugin but when I tried to activate it I got this error:
———–
Plugin could not be activated because it triggered a fatal error.
Fatal error: Call to a member function add_cap() on a non-object in /home/inkwellu/public_html/wp/wp-content/plugins/ucan-post/ucan-post-class.php on line 67
Line 67 in ucan-post-class.php says this::: $role->add_cap('upload_files');
————
I have plugin version 1.0.09 and wordpress 3.1.1. Any help with this would be appreacited. This is the fourth plugin I’ve tried to allow my users to create content without accessing the backend. I really hope this is an easy fix so I can use it. I really need it for my site.
Thanks so much in advance.
]]>How to add any field on the page add the post. To enter a URL and what would this url show up next to read further comments, this URL” Thank you
]]>When WYSIWYG editor is on, the icons take up half of the page.
Every icon has 24 padding left & right, every line has 24 bottom margin.
I tried to set them to 0, but it did not work.
Please help me, how to set them to look good.
I use Weaver.
For some reason when my users write a post and upload an image their images attach to the page that contains the shortcode for ucan post. I need the images to attach to their post so I can edit their story and post it. Please help as this plugin is exactly what I need!
]]>