How to use Prologue's post-from-index-form with other themes (3 posts)

  1. Bruz
    Posted 7 years ago #

    Hi there,

    I was wondering if the posting-box from prologue (see http://wordpress.org/extend/themes/prologue) in other themes as well!

    I tried copying the following part from prologue's index.php into k2's index.php

    if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'post' ) {
    	if ( ! is_user_logged_in() )
    	if( !current_user_can( 'publish_posts' ) ) {
    		wp_redirect( get_bloginfo( 'url' ) . '/' );
    	check_admin_referer( 'new-post' );
    	$user_id		= $current_user->user_id;
    	$post_content	= $_POST['posttext'];
    	$tags			= $_POST['tags'];
    	$char_limit		= 40;
    	$post_title		= strip_tags( $post_content );
    	if( strlen( $post_title ) > $char_limit ) {
    		$post_title = substr( $post_title, 0, $char_limit ) . ' ... ';
    	$post_id = wp_insert_post( array(
    		'post_author'	=> $user_id,
    		'post_title'	=> $post_title,
    		'post_content'	=> $post_content,
    		'tags_input'	=> $tags,
    		'post_status'	=> 'publish'
    	) );
    	wp_redirect( get_bloginfo( 'url' ) . '/' );
    get_header( ); 
    if( current_user_can( 'publish_posts' ) ) {
    	require_once dirname( __FILE__ ) . '/post-form.php';

    and adding the post-form.php to the k2-dir, the form shows up now but if I try to post it redirects me to the admin-login instead of posting (yes, I'm logged in).

    Am I missing something?

    I think this could be very usefull for users who wants to use a different theme but don't want to hassle with the dashboard at all!

  2. Bruz
    Posted 7 years ago #

    Oh snap... It seems that some incompatibility between Prologue and WordPress 2.6 (see http://wordpress.org/support/topic/189242 and http://wordpress.org/support/topic/189905) was the problem and my solution should work just fine - I'll test that later when I'm home from work and post the final code!

  3. smajda
    Posted 7 years ago #

    I wrote a plugin that adds the Prologue box to any theme. (I added a "Title" field as well.)

    Aside from testing it on a few themes on my own WP install, it hasn't been tested at all so I can't guarantee it will work well. If this seems useful to people & actually works properly (I've never written a real plugin before) I'll submit it to the WP plugin directory.

Topic Closed

This topic has been closed to new replies.

About this Topic