abonne
Forum Replies Created
Viewing 8 replies - 1 through 8 (of 8 total)
-
Forum: Fixing WordPress
In reply to: Why get_userdata() works ONLY in page but not in plugin??Where can I get some support? I need help!
Forum: Fixing WordPress
In reply to: Why get_userdata() works ONLY in page but not in plugin??Anybody?………………………
Forum: Fixing WordPress
In reply to: I have 1 site – how do I add another?I believe you need WordPressMU () to have more than one site.
Forum: Fixing WordPress
In reply to: Why get_userdata() works ONLY in page but not in plugin??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.
Forum: Plugins
In reply to: Plugin is throwing blank pages on plugin option admin and options.phpI 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.
Forum: Fixing WordPress
In reply to: Site Hacked and now automatically redirectsSorry 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.
Forum: Plugins
In reply to: Updating a Page through commentsSounds like it could be done with Ajax……………..
Forum: Fixing WordPress
In reply to: Database query….in new page?AWESOME! Thank you.
Viewing 8 replies - 1 through 8 (of 8 total)