diff --git a/build/blocks/icon/index.asset.php b/build/blocks/icon/index.asset.php
index ae3aaff65..4fa15b99b 100644
--- a/build/blocks/icon/index.asset.php
+++ b/build/blocks/icon/index.asset.php
@@ -1 +1 @@
- array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'bde5c36600fbb0593248');
+ array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '2f2688ce878edc670694');
diff --git a/build/blocks/icon/index.js b/build/blocks/icon/index.js
index 2a6a79b01..e396b88e1 100644
--- a/build/blocks/icon/index.js
+++ b/build/blocks/icon/index.js
@@ -1 +1 @@
-(()=>{"use strict";var e,t={8166:()=>{const e=window.wp.blocks,t=window.wp.blockEditor,r=window.wp.components,s=window.wp.i18n,n=window.wp.element,a=window.ReactJSXRuntime,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/icon","version":"1.0.0","title":"Icon","category":"gatherpress","icon":"format-image","example":{},"description":"Adds customizable icons to visually enhance your content.","attributes":{"icon":{"type":"string","default":"nametag"},"iconColor":{"type":"string","default":""},"iconSize":{"type":"number","default":24}},"supports":{"align":["left","center","right"],"anchor":true,"html":false,"spacing":{"margin":true},"shadow":{"__experimentalSkipSerialization":true}},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}');(0,e.registerBlockType)(i,{edit:({attributes:e,setAttributes:i})=>{const o=(0,t.useBlockProps)(),{icon:l,iconColor:c,iconSize:p}=e,[h,u]=(0,n.useState)(""),g=`${function(){if("object"==typeof GatherPress)return"urls.pluginUrl".split(".").reduce(((e,t)=>e&&e[t]),GatherPress)}()}includes/assets/svg/`,d=[{label:(0,s.__)("Calendar","gatherpress"),value:"calendar"},{label:(0,s.__)("Dismiss","gatherpress"),value:"dismiss"},{label:(0,s.__)("Editor Help","gatherpress"),value:"editor-help"},{label:(0,s.__)("Location","gatherpress"),value:"location"},{label:(0,s.__)("Nametag","gatherpress"),value:"nametag"},{label:(0,s.__)("Yes Alt","gatherpress"),value:"yes-alt"}];return(0,n.useEffect)((()=>{l&&fetch(`${g}${l}.svg`).then((e=>e.text())).then((e=>u(e))).catch((()=>u(``)))}),[l,g]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.InspectorControls,{children:(0,a.jsxs)(r.PanelBody,{title:(0,s.__)("Icon Settings","gatherpress"),children:[(0,a.jsx)(r.SelectControl,{label:(0,s.__)("Icon","gatherpress"),value:l,options:d,onChange:e=>i({icon:e})}),(0,a.jsx)(r.ColorPalette,{label:(0,s.__)("Color","gatherpress"),value:c,clearable:!0,onChange:e=>i({iconColor:e})}),(0,a.jsx)(r.RangeControl,{label:(0,s.__)("Size","gatherpress"),value:p,onChange:e=>i({iconSize:e}),min:8,max:240,initialPosition:24})]})}),(0,a.jsx)("div",{...o,children:(0,a.jsx)("div",{style:{fill:c||"inherit",width:`${p}px`,height:`${p}px`,lineHeight:0},dangerouslySetInnerHTML:{__html:h}})})]})},save:()=>null})}},r={};function s(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,s),a.exports}s.m=t,e=[],s.O=(t,r,n,a)=>{if(!r){var i=1/0;for(p=0;p=a)&&Object.keys(s.O).every((e=>s.O[e](r[l])))?r.splice(l--,1):(o=!1,a0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[r,n,a]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={22:0,690:0};s.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,i=r[0],o=r[1],l=r[2],c=0;if(i.some((t=>0!==e[t]))){for(n in o)s.o(o,n)&&(s.m[n]=o[n]);if(l)var p=l(s)}for(t&&t(r);cs(8166)));n=s.O(n)})();
\ No newline at end of file
+(()=>{"use strict";var e,t={8166:()=>{const e=window.wp.blocks,t=window.wp.blockEditor,r=window.wp.components,s=window.wp.i18n,n=window.wp.element,a=window.ReactJSXRuntime,i=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"gatherpress/icon","version":"1.0.0","title":"Icon","category":"gatherpress","icon":"format-image","example":{},"description":"Adds customizable icons to visually enhance your content.","attributes":{"icon":{"type":"string","default":"nametag"},"iconColor":{"type":"string","default":""},"iconSize":{"type":"number","default":24}},"supports":{"align":["left","center","right"],"anchor":true,"html":false,"spacing":{"margin":true},"shadow":{"__experimentalSkipSerialization":true}},"textdomain":"gatherpress","editorScript":"file:./index.js","style":"file:./style-index.css","render":"file:./render.php"}');(0,e.registerBlockType)(i,{edit:({attributes:e,setAttributes:i})=>{const l=(0,t.useBlockProps)(),{icon:o,iconColor:p,iconSize:c}=e,[h,u]=(0,n.useState)(""),g=`${function(){if("object"==typeof GatherPress)return"urls.pluginUrl".split(".").reduce(((e,t)=>e&&e[t]),GatherPress)}()}includes/assets/svg/`,d=[{label:(0,s.__)("Calendar","gatherpress"),value:"calendar"},{label:(0,s.__)("Dismiss","gatherpress"),value:"dismiss"},{label:(0,s.__)("Editor Help","gatherpress"),value:"editor-help"},{label:(0,s.__)("Groups","gatherpress"),value:"groups"},{label:(0,s.__)("Location","gatherpress"),value:"location"},{label:(0,s.__)("Nametag","gatherpress"),value:"nametag"},{label:(0,s.__)("Yes Alt","gatherpress"),value:"yes-alt"}];return(0,n.useEffect)((()=>{o&&fetch(`${g}${o}.svg`).then((e=>e.text())).then((e=>u(e))).catch((()=>u(``)))}),[o,g]),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(t.InspectorControls,{children:(0,a.jsxs)(r.PanelBody,{title:(0,s.__)("Icon Settings","gatherpress"),children:[(0,a.jsx)(r.SelectControl,{label:(0,s.__)("Icon","gatherpress"),value:o,options:d,onChange:e=>i({icon:e})}),(0,a.jsx)(r.ColorPalette,{label:(0,s.__)("Color","gatherpress"),value:p,clearable:!0,onChange:e=>i({iconColor:e})}),(0,a.jsx)(r.RangeControl,{label:(0,s.__)("Size","gatherpress"),value:c,onChange:e=>i({iconSize:e}),min:8,max:240,initialPosition:24})]})}),(0,a.jsx)("div",{...l,children:(0,a.jsx)("div",{style:{fill:p||"inherit",width:`${c}px`,height:`${c}px`,lineHeight:0},dangerouslySetInnerHTML:{__html:h}})})]})},save:()=>null})}},r={};function s(e){var n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,s),a.exports}s.m=t,e=[],s.O=(t,r,n,a)=>{if(!r){var i=1/0;for(c=0;c=a)&&Object.keys(s.O).every((e=>s.O[e](r[o])))?r.splice(o--,1):(l=!1,a0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[r,n,a]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={22:0,690:0};s.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,i=r[0],l=r[1],o=r[2],p=0;if(i.some((t=>0!==e[t]))){for(n in l)s.o(l,n)&&(s.m[n]=l[n]);if(o)var c=o(s)}for(t&&t(r);ps(8166)));n=s.O(n)})();
\ No newline at end of file
diff --git a/includes/assets/svg/groups.svg b/includes/assets/svg/groups.svg
new file mode 100644
index 000000000..5e22992ad
--- /dev/null
+++ b/includes/assets/svg/groups.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/includes/core/classes/blocks/class-general-block.php b/includes/core/classes/blocks/class-general-block.php
new file mode 100644
index 000000000..a0d8969ed
--- /dev/null
+++ b/includes/core/classes/blocks/class-general-block.php
@@ -0,0 +1,109 @@
+setup_hooks();
+ }
+
+ /**
+ * Set up hooks for various purposes.
+ *
+ * This method adds hooks for different purposes as needed.
+ *
+ * @since 1.0.0
+ *
+ * @return void
+ */
+ protected function setup_hooks(): void {
+ add_filter( 'render_block', array( $this, 'remove_block_if_user_logged_in' ), 10, 2 );
+ add_filter( 'render_block', array( $this, 'remove_block_if_registration_disabled' ), 10, 2 );
+ }
+
+ /**
+ * Removes blocks with the `gatherpress--has-login-url` class if the user is logged in.
+ *
+ * This method checks if the block contains the `gatherpress--has-login-url` class
+ * and removes it from rendering if the user is currently logged in.
+ *
+ * @since 1.0.0
+ *
+ * @param string $block_content The HTML content of the block.
+ * @param array $block The parsed block data.
+ *
+ * @return string The modified block content or an empty string if the block should be removed.
+ */
+ public function remove_block_if_user_logged_in( string $block_content, array $block ): string {
+ if (
+ false !== strpos( $block['attrs']['className'] ?? '', 'gatherpress--has-login-url' ) &&
+ is_user_logged_in()
+ ) {
+ return '';
+ }
+
+ return $block_content;
+ }
+
+ /**
+ * Removes blocks with the `gatherpress--has-registration-url` class if user registration is disabled.
+ *
+ * This method checks if the block contains the `gatherpress--has-registration-url` class
+ * and removes it from rendering if the WordPress `users_can_register` option is disabled.
+ *
+ * @since 1.0.0
+ *
+ * @param string $block_content The HTML content of the block.
+ * @param array $block The parsed block data.
+ *
+ * @return string The modified block content or an empty string if the block should be removed.
+ */
+ public function remove_block_if_registration_disabled( string $block_content, array $block ): string {
+ if (
+ false !== strpos( $block['attrs']['className'] ?? '', 'gatherpress--has-registration-url' ) &&
+ ! get_option( 'users_can_register' )
+ ) {
+ return '';
+ }
+
+ return $block_content;
+ }
+}
diff --git a/includes/core/classes/blocks/class-rsvp.php b/includes/core/classes/blocks/class-rsvp.php
index dff2d142e..3d7272b5c 100644
--- a/includes/core/classes/blocks/class-rsvp.php
+++ b/includes/core/classes/blocks/class-rsvp.php
@@ -28,6 +28,14 @@ class Rsvp {
*/
use Singleton;
+ /**
+ * Constant representing the Block Name.
+ *
+ * @since 1.0.0
+ * @var string
+ */
+ const BLOCK_NAME = 'gatherpress/rsvp-v2';
+
/**
* Class constructor.
*
@@ -67,7 +75,7 @@ protected function setup_hooks(): void {
public function transform_block_content( string $block_content, array $block ): string {
$block_instance = Block::get_instance();
- if ( 'gatherpress/rsvp-v2' === $block['blockName'] ) {
+ if ( self::BLOCK_NAME === $block['blockName'] ) {
$inner_blocks = isset( $block['innerBlocks'] ) ? $block['innerBlocks'] : array();
$tag = new WP_HTML_Tag_Processor( $block_content );
$attributes = isset( $block['attrs'] ) ? $block['attrs'] : array();
@@ -145,14 +153,6 @@ public function transform_block_content( string $block_content, array $block ):
$block_content = $tag->get_updated_html();
}
- if (
- isset( $block['attrs']['className'] ) &&
- false !== strpos( $block['attrs']['className'], 'gatherpress--has-registration-url' ) &&
- ! get_option( 'users_can_register' )
- ) {
- return '';
- }
-
return $block_content;
}
}
diff --git a/includes/core/classes/class-block.php b/includes/core/classes/class-block.php
index d03f73cf1..ca10da873 100644
--- a/includes/core/classes/class-block.php
+++ b/includes/core/classes/class-block.php
@@ -110,6 +110,7 @@ public function register_blocks(): void {
*/
public function register_block_classes(): void {
Blocks\Add_To_Calendar::get_instance();
+ Blocks\General_Block::get_instance();
Blocks\Modal::get_instance();
Blocks\Modal_Manager::get_instance();
Blocks\Rsvp::get_instance();
diff --git a/src/blocks/icon/edit.js b/src/blocks/icon/edit.js
index e580ce794..fb94147d3 100644
--- a/src/blocks/icon/edit.js
+++ b/src/blocks/icon/edit.js
@@ -24,6 +24,7 @@ const Edit = ({ attributes, setAttributes }) => {
{ label: __('Calendar', 'gatherpress'), value: 'calendar' },
{ label: __('Dismiss', 'gatherpress'), value: 'dismiss' },
{ label: __('Editor Help', 'gatherpress'), value: 'editor-help' },
+ { label: __('Groups', 'gatherpress'), value: 'groups' },
{ label: __('Location', 'gatherpress'), value: 'location' },
{ label: __('Nametag', 'gatherpress'), value: 'nametag' },
{ label: __('Yes Alt', 'gatherpress'), value: 'yes-alt' },