Skip to content

Commit

Permalink
Merge pull request #99 from sesamyab/fixed-attribute-count-issue
Browse files Browse the repository at this point in the history
Fixed Sesamy Attribute count issue
  • Loading branch information
PradeepWeb77 authored Apr 3, 2024
2 parents 9eaca7d + a1decd1 commit 33caa7f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: sesamy, paywall
Requires at least: 5.0.1
Requires PHP: 7.4
Tested up to: 6.4.2
Stable tag: 1.0.8
Stable tag: 1.0.9
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -102,6 +102,9 @@ The following filters can be used to modify the default output from the plugin:

== Changelog ==

= 1.0.9 =
* Fixed Sesamy Attribute count issue

= 1.0.8 =
* Added sesamy attribute support

Expand Down
2 changes: 2 additions & 0 deletions src/admin/class-sesamy-admin-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,10 @@ public function sesamy_postmeta_edit_save( $post_id ) {
$sesamy_tag = wp_unslash( $_POST['sesamy-post-tags'] );
$sesamy_tag = implode("|", $sesamy_tag);
update_post_meta( $post_id, "_sesamy_tags", $sesamy_tag );
wp_set_post_terms( $post_id, $_POST['sesamy-post-tags'], 'sesamy_tags' );
} else {
update_post_meta( $post_id, "_sesamy_tags", "" );
wp_set_post_terms( $post_id, array(), 'sesamy_tags' );
}

// Save Access Level.
Expand Down
12 changes: 12 additions & 0 deletions src/admin/gutenberg/sesamy-post-editor/src/sesamyPostEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const SesamyPostEditor = () => {
//const sesamyTiersTaxonomy = wp.data.select('core').getEntityRecords('taxonomy', 'sesamy_passes');
const currentPost = useSelect(select => select('core/editor').getCurrentPost());
const sesamy_passes = useSelect(select => select('core/editor').getEditedPostAttribute('sesamy_passes'));
const sesamy_tag = useSelect(select => select('core/editor').getEditedPostAttribute('sesamy_tags'));
const dispatch = useDispatch();
wp.data.dispatch( 'core/edit-post').removeEditorPanel( 'taxonomy-panel-sesamy_tags' ) ; //Hide sesamy_tags taxonomy panel from sidebar

Expand Down Expand Up @@ -97,6 +98,17 @@ const SesamyPostEditor = () => {
tag_string = tag_array.toString();
}
setMeta({ '_sesamy_tags': tag_string });


// Store data in default DB table
var newTag = [];
if (included && !sesamy_tag.includes(tag.id)) {
newTag = [...sesamy_tag, tag.id];
} else if (!included) {
newTag = [...sesamy_tag.filter(id => id !== tag.id)]
}

dispatch('core').editEntityRecord('postType', currentPost.type, currentPost.id, { 'sesamy_tags': newTag });
}

// Enable tiers if there is at least one
Expand Down
4 changes: 2 additions & 2 deletions src/sesamy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: Sesamy
* Plugin URI: https://sesamy.com
* Description: Add paywall functionality with Sesamy (sesamy.com) to your WordPress website.
* Version: 1.0.8
* Version: 1.0.9
* Author: Sesamy AB
* Author URI: https://sesamy.com
* License: GPL-2.0+
Expand All @@ -34,7 +34,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'SESAMY_VERSION', '1.0.6' );
define( 'SESAMY_VERSION', '1.0.9' );

/**
* The code that runs during plugin activation.
Expand Down

0 comments on commit 33caa7f

Please sign in to comment.