Skip to content

Commit

Permalink
make updertEntry not loose category associations
Browse files Browse the repository at this point in the history
  • Loading branch information
garvinhicking committed Mar 5, 2014
1 parent 19192b2 commit f1418eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions serendipity_event_freetag/ChangeLog
@@ -1,3 +1,7 @@
3.47:
-----
Make updertEntry not loose possible category associations

3.46:
-----

Expand Down
8 changes: 7 additions & 1 deletion serendipity_event_freetag/serendipity_event_freetag.php
Expand Up @@ -72,7 +72,7 @@ function introspect(&$propbag)
'smarty' => '2.6.7',
'php' => '4.1.0'
));
$propbag->add('version', '3.46');
$propbag->add('version', '3.47');
$propbag->add('event_hooks', array(
'frontend_fetchentries' => true,
'frontend_fetchentry' => true,
Expand Down Expand Up @@ -1715,6 +1715,12 @@ function displayManageTags($event, &$bag, &$eventData, $addData) {
unset($entry['email']);
printf('%d - "%s"<br />', $entry['id'], htmlspecialchars($entry['title']));
$serendipity['POST']['properties']['fake'] = 'fake';
$current_cat = $entry['categories'];
$entry['categories'] = array();
foreach($current_cat AS $categoryidx => $category_data) {
$entry['categories'][$category_data['categoryid']] = $category_data['categoryid'];
}

$up = serendipity_updertEntry($entry);
if (is_string($up)) {
echo "<div>$up</div>\n";
Expand Down
3 changes: 3 additions & 0 deletions serendipity_event_trackback/ChangeLog
@@ -1,3 +1,6 @@
1.16:
* Fixed error when saving an entry, which would loose its category association

1.15:
* Fixed foreach warning in some cases

Expand Down
9 changes: 8 additions & 1 deletion serendipity_event_trackback/serendipity_event_trackback.php
Expand Up @@ -26,7 +26,7 @@ function introspect(&$propbag)
$propbag->add('description', PLUGIN_EVENT_MTRACKBACK_TITLEDESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking, Malte Paskuda');
$propbag->add('version', '1.15');
$propbag->add('version', '1.16');
$propbag->add('requirements', array(
'serendipity' => '0.8',
'smarty' => '2.6.7',
Expand Down Expand Up @@ -286,6 +286,13 @@ function generateDelayed() {
unset($stored_entry['email']);
}

# Convert fetched categories to storable categories.
$current_cat = $stored_entry['categories'];
$stored_entry['categories'] = array();
foreach($current_cat AS $categoryidx => $category_data) {
$stored_entry['categories'][$category_data['categoryid']] = $category_data['categoryid'];
}

ob_start();
serendipity_updertEntry($stored_entry);
ob_end_clean();
Expand Down

0 comments on commit f1418eb

Please sign in to comment.