Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter abonne

    (@abonne)

    Where can I get some support? I need help!

    Thread Starter abonne

    (@abonne)

    Anybody?………………………

    abonne

    (@abonne)

    I believe you need WordPressMU () to have more than one site.

    Thread Starter abonne

    (@abonne)

    By the way, my plugin works outside of the loop: it is a very basic email trigger.

    <?php
    /*
    Plugin Name: ...
     */
    
    define('WP_USE_THEMES', false);
    require('/var/www/html/wordpress/wp-blog-header.php');
    
    add_action('publish_post', 'email_team' );
    
    global $wp_query;
    $post_ID = $wp_query->post->ID;
    
    function get_post_data($post_ID) {
        $my_id = $post_ID;
        $post_id = get_post($my_id);
        $post_title = $post_id->post_title;
        return $post_title;
    }
    
    /* that's where things get confusing...for me, anyway */
    $xmy_id = $post_ID;
    $xpost_id = get_post($xmy_id);
    $author = $xpost_id->post_author;
    $user_info = get_userdata($author);
    $d_name = $user_info->display_name ;
    
    function email_team($post_ID) {
        global $email_list;
        $to = $email_list;
        $subject = 'Blog Update';
        $message = 'There is a new post authored by '.$d_name.' titled "'. get_post_data($post_ID) .'" on the blog ' . get_bloginfo('url') .    '.';
        $headers = 'From: [email protected]' . "\r\n" .
                'Reply-To: [email protected]' . "\r\n" .
                'X-Mailer: PHP/' . phpversion();
        mail($to, $subject, $message, $headers);
        return $post_ID;
    }
    ?>
    
    <?php
    register_activation_hook(__FILE__,'email_team_install');
    register_deactivation_hook( __FILE__, 'email_team_remove' );
    
    function email_team_install() {
        add_option("email_list", 'Default', '', 'yes');
    }
    function email_team_remove() {
        delete_option('email_list');
    }
    ?>
    
    <?php
    if ( is_admin() ) {
        add_action('admin_menu', 'email_team_admin_menu');
        function email_team_admin_menu() {
            add_options_page('Email Team', 'Email Team', 'administrator','email-team', 'email_team_html_page');
        }
    }
    ?>
    
    <?php
    $email_list=get_option('email_list');
    function email_team_html_page() {
        ?>
    <div>
        <h2>Email Team - Options</h2>
        <form method="post" action="options.php">
                <?php wp_nonce_field('update-options'); ?>
            <table width="510">
                <tr valign="top">
                    <th scope="row"></th>
                    <td>Enter email addresses (separated by commas)
                        <input name="email_list" type="text" size="100" id="email_list"
                               value="<?php echo get_option('email_list'); ?>" /></td>
                </tr>
            </table>
            <input type="hidden" name="action" value="update" />
            <input type="hidden" name="page_options" value="email_list" />
            <p>
                <input type="submit" value="<?php _e('Save Changes') ?>" />
            </p>
        </form>
    </div>
        <?php
    }
    ?>

    If I remove the block of code with get_userdata, everything works as expected.

    Any help is welcome.

    abonne

    (@abonne)

    I am having the same problem with my plug-in. It works as I expect but it throws a blank page.

    Just like you, I followed the example of the codex page.

    I am running v2.9.2.

    abonne

    (@abonne)

    Sorry to hear about your site. I found this url (plenty of good info):

    https://codex.www.ads-software.com/FAQ_My_site_was_hacked

    Good luck.

    abonne

    (@abonne)

    Sounds like it could be done with Ajax……………..

    Thread Starter abonne

    (@abonne)

    AWESOME! Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)