Forum Replies Created

Viewing 8 replies - 16 through 23 (of 23 total)
  • Thread Starter yonat

    (@yonat)

    Thanks. Eventually I found a nice hook where I can call the function, so all is well. ??

    Thread Starter yonat

    (@yonat)

    Thanks!

    As for calling the function – my bad. I actually need to call it from javascript, which means I probably need to find an appropriate httprequest.

    Ihusgal2, I have the same issue. I ended up using a combination of subscribe2 and a modified CYC, so that users are subscribed when they register, and yet they never need to select categories or anything like that. As for creating a separate page for subscribe2 – I didn’t and it works fine.

    Another good option (IMO) is Post Notification, in case your subscribers are not your registered users (if they are, PN’s email verification process is redundant).

    Do you mean you want to create posts from a static page?
    If so, you can do that by creating a custom page template (https://codex.www.ads-software.com/Pages#Creating_Your_Own_Page_Templates) with the following code:

    <?php
    /*
    Template Name: Submit Post Form
    */
    ?>
    
    <?php get_header(); ?>
    <div id="main">
    <div id="content" class="narrowcolumn">
    
    <div class="post">
    <h2><?php single_post_title(); ?></h2>
    
    <?php if ( !current_user_can('edit_posts') ) : ?>
    
    To submit posts, first <?php wp_loginout(); ?> or <?php wp_register('', ''); ?>.
    
    <?php else : ?> <!-- user can post -->
    
        <!-- handle post submission -->
        <?php if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action']) && $_POST['action'] == 'post') : ?>
    
            <?php check_admin_referer('submit-post') ?>
    
            <?php $post_id = wp_insert_post( array(
                'post_title'    => strip_tags($_POST['posttitle']),
                'post_content'  => $_POST['posttext'],
                'tags_input'    => $_POST['tags']
            ) ); ?>
    
            <?php if ($post_id > 0) : ?>
                <p>Thank you for submitting your post!</p>
                <p>You can still
                <?php edit_post_link( "edit your post", "", "", $post_id ); ?>
                until it's published by the editors.</p>
            <?php else : ?>
                <p>Error saving your post. You can send it by email instead:
                <?php echo get_option('admin_email'); ?>
                </p>
            <?php endif; ?>
    
        <?php else : ?> <!-- show submission form -->
    
            <form id="new_post" name="new_post" method="post" action="<?php the_permalink() ?>">
            <input type="hidden" name="action" value="post" />
            <?php wp_nonce_field( 'new-post' ); ?>
    
            <p>
            <label for="title"><b>Post Title:</b></label><br />
            <input type="text" name="posttitle" id="posttitle" style="width: 99%; font-size: larger;" />
            </p>
    
            <p><b>Author:</b>
                <?php echo $user_identity; ?> &nbsp;
                (<a href="<?php echo wp_logout_url(get_permalink()); ?>">logout</a>)
            </p>
    
            <p>
            <label for="posttext"><b>Post Text:</b></label><br />
            <textarea name="posttext" id="posttext" rows="30" style="width: 99%; font-size: inherit;"></textarea>
            </p>
    
            <p>
            <label for="tags"><b>Tags:</b></label><br />
            <input type="text" name="tags" id="tags" style="width: 99%;" />
            </p>
    
            <input id="submit" type="submit" value="Submit Post" />
            </form>
    
        <?php endif; ?> <!-- submission form -->
    
    <?php endif; ?> <!-- user can post -->
    
    </div>
    </div>
    <?php get_sidebar(); ?>
    </div>
    <?php get_footer(); ?>
    yonat

    (@yonat)

    No need to change your theme, only to fix CYC…
    Here is a version I fixed, so far only available from my site since I didn’t get a reply from the plugin author.
    https://ootips.org/yonat/cyc.php.gz

    Thread Starter yonat

    (@yonat)

    Also, it seems to send all the emails in a single loop, and that may not scale well if the number of subscribers becomes large.

    Thread Starter yonat

    (@yonat)

    Thanks, this could be exactly what I’m after if it would only show these checkboxes to normal subscribers and not just to admins and editors.

    yonat

    (@yonat)

    I just coded this into CYC (and also made some other fixes and enhancements).
    You can get the modified php at https://ootips.org/yonat/cyc.php.gz
    (I may not keep it there for long, though.)

Viewing 8 replies - 16 through 23 (of 23 total)