Hallo zusammen.
Hab mir WP2.0.2 installiert und einige Plugins.
Dank des Forums hier hat auch alles so weit gut geklappt. Ich konnt ja alles nachlesen.
Nun wollte ich punmail01 haben. Denn manche abonnieren ja lieber als RSS zu nutzen. Hoch geladen, aktiviert. Hab auch alles, so weit ich mit meinem kärglichen Englischkenntnissen konnte, geändert. Doch ich hab auf der Seite nicht den normalen Hintergrund und die Sidebar ist auch etwas nach unten verrutscht. Sieht doof aus. Wie kann ich das ändern? :confused:
Schaut selbst: http://blog.wollewelt.de/?page_id=23
<?php
/*
Plugin Name: Page Update Notification
Plugin URI: [url]http://www.yellowswordfish.com[/url]
Description: Allows for subscribed users to receive email notification when a Page is updated
Version: 0.1
Author: Andy Staines
Author URI: [url]http://www.yellowswordfish.com[/url]
*/
/* Copyright 2005/2006 Andy Staines (email: [email]andy@yellowswordfish.com[/email])
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
For a copy of the GNU General Public License, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
add_action('activate_punmail.php', 'punmail_createtable');
add_action('edit_post', 'punmail_notify');
add_filter('the_content', 'punmail_content');
add_action('admin_menu', 'punmail_admin');
// FILTERS AND ACTIONS
// ===================
// create the database table upon plugin activation
// ------------------------------------------------
function punmail_createtable()
{
global $wpdb, $table_prefix;
$wpdb->query("CREATE TABLE IF NOT EXISTS `" . $table_prefix . "punmail` (`id` bigint(20) NOT NULL auto_increment, `post_id` bigint(20) NOT NULL, `email` text, PRIMARY KEY (`id`))");
return;
}
// Add the menu item to Admin Manage menu
// --------------------------------------
function punmail_admin()
{
add_submenu_page('edit.php', 'Page Update Notification', 'Notifications', 9, '/punmail.php', 'punmail_adminpage');
}
// content filter function - do we detect the punmail callback on page display?
// ----------------------------------------------------------------------------
function punmail_content($content)
{
if(!is_page()) return $content;
// are we saving a subscription?
if (isset($_POST['subscribe']))
{
// save the record
if(punmail_saveemail())
{
$form = '<fieldset><strong>' . $_POST['email'] . ' has been subscribed for update notification</strong></fieldset>';
} else {
$form = '<fieldset><strong>Email subscription failed</strong></fieldset>';
}
return preg_replace('|<!--punmail-->|', $form, $content);
}
else
{
if(!strpos($content, '<!--punmail-->')) return $content;
// So yes - there is a punmail callback on display of page
return punmail_constructpage($content);
}
}
// PAGE DISPLAY SUPPORT FUNCTIONS
// ==============================
// constructs the punmail on the displayed page
// --------------------------------------------
function punmail_constructpage($content)
{
global $wp_query;
$form = '<div class="punmailform">';
$form.= '<form action="' . get_permalink() . '" method="post" name="form">';
$form.= '<input type="hidden" name="subscribe" value=' . $wp_query->post->ID . '>';
$form.= '<fieldset><legend><strong>Blog Abonnieren</strong></legend>';
$form.= '<label for="email"> Deine email-Adresse:<br> </label>';
$form.= '<input type="text" size="30" name="email">';
$form.= '<input type="submit" value="Subscribe"></fieldset>';
return preg_replace('|<!--punmail-->|', $form, $content);
}
// saves an email subscription
// ---------------------------
function punmail_saveemail()
{
global $wpdb, $table_prefix;
If (empty($_POST['email'])) return false;
$sql = 'INSERT INTO '. $table_prefix . 'punmail ';
$sql = $sql . '(post_id, email) ';
$sql = $sql . 'VALUES (';
$sql = $sql . $_POST['subscribe'] .', ';
$sql = $sql . '"' . $_POST['email'] . '");';
if(!$wpdb->query($sql))
{
return false;
}
return true;
}
// action run when a post is updated
// ---------------------------------
function punmail_notify($post_id)
{
// first - are there subscriptions?
global $table_prefix, $wpdb;
$maillist = $wpdb->get_results('SELECT * FROM ' . $table_prefix . 'punmail WHERE post_id = ' . $post_id);
if(!$maillist) return;
$results = $wpdb->get_results('SELECT ID, post_title FROM ' . $table_prefix . 'posts WHERE ID = ' . $post_id);
$post_title = $results[0]->post_title;
$subject = 'Page Update Notification: ' . $post_title;
$message = 'There has been an update to an item you are subscribed to at ' . get_bloginfo('url') . "\n\n";
$message.= 'Title: ' . $post_title . "\n\n";
$message.= 'To view the updated item visit:' ."\n";
$message.= get_permalink($post_id);
$message.= "\n\n" . 'If you wish to be removed from future notifications, please reply to this email with this request';
$headers = "From: ". get_bloginfo('name') ." <". get_bloginfo('admin_email') .">\n";
$headers .= "MIME-Version: 1.0\n" . "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\n";
$cnt = count($maillist);
for($i = 0; $i < $cnt; $i++)
{
punmail_send($maillist[$i]->email, $subject, $message, $headers);
}
return;
}
function punmail_send($to, $subject, $message, $headers)
{
return wp_mail($to, $subject, $message, $headers);
}
// ================================================================================
// ADMIN PANEL (MANAGE)
function punmail_adminpage()
{
global $table_prefix, $wpdb;
// are we deleting a record
if ($_GET['action'] == 'delsub')
{
$id = $_GET['id'];
punmail_deletenotification($id);
}
?>
<div class="wrap">
<h2><?php _e('Page Update Notifications') ?></h2>
<?php
$results = $wpdb->get_results('SELECT ' . $table_prefix . 'punmail.id, ' . $table_prefix . 'punmail.post_id, ' . $table_prefix . 'punmail.email, ' . $table_prefix . 'posts.post_title FROM ' . $table_prefix . 'punmail LEFT JOIN ' . $table_prefix . 'posts ON ' . $table_prefix . 'punmail.post_id = ' . $table_prefix . 'posts.ID ORDER BY ' . $table_prefix . 'punmail.post_id');
if ($results)
{
?>
<h3>Current Notifications</h3>
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th align="left">Page Title</th>
<th align="left">EMail Address</th>
<th></th>
</tr>
<?php
$cnt = count($results);
for($i = 0; $i < $cnt; $i++)
{
if (($i % 2) == 1)
{
?> <tr> <?php
} else {
?> <tr class="alternate"> <?php
}
echo('<td>' . $results[$i]->post_title . '</td>');
echo('<td>' . $results[$i]->email . '</td>') ;?>
<td><a href="edit.php?page=/punmail.php&action=delsub&id=<?php echo($results[$i]->id) .'"'; ?> class="delete" onclick="return confirm('Are you sure you want to delete this Notification?')">Delete</a></td>
<tr>
<?php
}
?>
</table>
<hr />
<br />
<?php
}
else
{
?>
<h3>No Notifications Requests Logged</h3>
<hr />
<?php
}
?>
</div>
<?php
return;
}
// delete a notification email
// ---------------------------
function punmail_deletenotification($id)
{
global $table_prefix, $wpdb;
// One job only - to delete an email
$sql = 'DELETE FROM ' . $table_prefix . 'punmail WHERE id = ' . $id .';';
if(!$wpdb->query($sql))
{
punmail_message('Error - Unable to delete Notification');
return;
}
else
{
punmail_message('Notification Email Address Deleted');
}
}
//General Message Display Routine
//-------------------------------
function punmail_message($pmessage)
{
echo "<div id='fg' class='updated fade'>\n<p>" . $pmessage . "</p></div>";
return;
}
?>
Alles anzeigen
Hab schon rum probiert und mir dabei einmal schon den Adminbereich zerschossen. Habs aber gleich wieder flicken können :D
Doch hier weiß ich nicht mehr weiter. Büüütte, helft mir.
Wollewelt
Auf der Hp heißt das Plugin: Page Update Notification 0.1