submit posts by unregistered users in wordpress

UPDATE – i made a simple plugin for this that adds the functionality: A widget that you can put in your sidebar that enables post to bee saved as pendling A widget that displays the three last submitted and confirmed posts. The plugin have som simple css classes without any styling. Here is the download … Read more

Using WP Category Lists Plugin to Dynamically Display Category (PHP)

I found a much easier way to do this. I called this PHP in the Loop: if ($paged == 0) $offset = 0; else $offset = ($paged – 1) * 11; global $post; $category = get_the_category($post->ID); $category = $category[0]->cat_ID; $myposts = get_posts(array(‘numberposts’ => 11, ‘offset’ => $offset, ‘category__in’ => array($category), ‘post__not_in’ => array($post->ID),’post_status’=>’publish’)); foreach($myposts as … Read more

issues with wp_enqueue_script in my plugin

You need to hook into admin_enqueue_scripts with your add_my_script function. http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts Example: function add_my_script() { wp_enqueue_script(‘qtool-insert-v2’); }add_action( ‘admin_enqueue_scripts’, ‘add_my_script’ );

How to sanitize uploaded file filename from a plugin?

I found a way. Change the lines on wordpress-form-manager plugin direcoty -> types -> file.php (around line 109) From: if($fileNameFormat == “%filename%”){ $newFileName = $pathInfo[‘filename’]; } To: if($fileNameFormat == “%filename%”){ //Sanitize the filename (See note below) $remove_these = array(‘ ‘,’`’,'”‘,’\”,’\\’,”https://wordpress.stackexchange.com/”,’%’); $newFileName = str_replace($remove_these, ”, $pathInfo[‘filename’]); //Make the filename unique $newFileName = time().’-‘.$newFileName; }

Auto activate plugin with unique user settings

I’ve answered a similar Question ( Inherit plugin settings to new site in Multisite ). And, if understood correctly, “auto setup their unique preferences” would be a matter of adding/updating a custom plugin options array into wp_options table. So, following the WP-Pagenavi example. After the plugin auto install/activate run something like: (not tested) function set_my_plugin_options(){ … Read more

How do I pass a post ID to the page URL?

First of all. The question is a little misleading. What you actually want is “post id(s) for current user”. Here we go: // Global variable for current user ID // More information: http://codex.wordpress.org/Function_Reference/get_currentuserinfo $user_ID; // You need to create a new WP query object // More info: http://codex.wordpress.org/Class_Reference/WP_Query $my_query = new WP_Query( array( ‘post_type’ => … Read more

Add column to plugins table screen

First, you have to add the custom column to the plugin column names: function wpa65189_add_plugins_column( $columns ) { $columns[‘wpa65189_column’] = ‘wpa65189 Custom Column’; return $columns; } add_filter( ‘manage_plugins_columns’, ‘wpa65189_add_plugins_column’ ); Then output your column data for your plugin: function wpa65189_render_plugins_column( $column_name, $plugin_file, $plugin_data ) { if ( ‘wpa65189_column’ == $column_name && ‘My Plugin Name’ == … Read more