{"id":1309,"date":"2023-10-27T09:49:04","date_gmt":"2023-10-27T09:49:04","guid":{"rendered":"https:\/\/wpshortcode.org\/?p=1309"},"modified":"2023-10-27T09:49:05","modified_gmt":"2023-10-27T09:49:05","slug":"groups","status":"publish","type":"post","link":"https:\/\/wpshortcode.org\/groups\/","title":{"rendered":"Groups Shortcodes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Below, you&#8217;ll find a detailed guide on how to add the <strong>Groups Shortcodes<\/strong> to your WordPress website, including their <strong>parameters<\/strong>, <strong>examples<\/strong>, and <strong>PHP function code<\/strong>. Additionally, we&#8217;ll assist you with common issues that might cause the Groups Plugin shortcodes not to show or not to work correctly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Before starting, here is an overview of the Groups Plugin and the shortcodes it provides:<\/p>\n\n\n<p>    <div class=\"plugin-info-box\">\n        <div class=\"top-main\">\n            <!-- SVG Image -->\n            <div class=\"plugin-image\">\n                <img decoding=\"async\" src=\"https:\/\/ps.w.org\/groups\/assets\/icon-128x128.png?rev=983146\" alt=\"Plugin Icon\" \/>\n            <\/div>\n            \n            <div class=\"plugin-descriptive-part\">\n                <!-- Plugin Name with Link -->\n\n                    <a class=\"plugin-title\" href=\"https:\/\/wordpress.org\/plugins\/groups\" target=\"_blank\" rel=\"noopener\">\n                        Groups                    <\/a>\n\n\n                <!-- Plugin Description -->\n                <p class=\"plugin-description\">\n                    &quot;Groups is a WordPress plugin that offers efficient group-based user memberships, content access control, and group capabilities management. Ideal for community-driven sites.&quot;                <\/p>\n            <\/div>\n        <\/div>\n\n        <!-- Rating and Additional Info -->\n        <div class=\"plugin-meta\">\n            <span class=\"plugin-rating\">\n                <span class='stars'>\u2605\u2605\u2605\u2605\u2606<\/span> (354)\n            <\/span>\n            <span class=\"plugin-active-installs\">\n                <strong>Active Installs<\/strong>: 20000+\n            <\/span>\n            <span class=\"plugin-tested\">\n                <strong>Tested with<\/strong>: 6.1.4            <\/span>\n            <span class=\"plugin-php-version\">\n                <strong>PHP Version<\/strong>: 5.6.0            <\/span>\n        <\/div>\n\n        <!-- List of Included Shortcodes -->\n        <div class=\"plugin-shortcodes\">\n            <strong>Included Shortcodes:<\/strong>\n            <ul>\n                <li>[groups_member]<\/li><li>[groups_non_member]<\/li><li>[groups_can]<\/li><li>[groups_can_not]<\/li><li>[groups_login]<\/li><li>[groups_logout]<\/li><li>[groups_group_info]<\/li><li>[groups_user_groups]<\/li><li>[groups_groups]<\/li><li>[groups_join]<\/li><li>[groups_leave]<\/li>            <\/ul>\n        <\/div>\n    <\/div>\n    <\/p>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_member] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Groups Member shortcode checks if the current user is a member of a specified group and displays the content accordingly. \n\n\n\nIt uses the Groups_User and Groups_Group classes to verify membership. If the user is part of the group, the content within the shortcode is displayed. If not, the output remains empty.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_member]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_member shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>group<\/code> &#8211; Name or ID of the group to check membership for<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; A simple usage of the groups_member shortcode to check if the current user is a member of a specific group.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_member group=\"GroupName\" \/]<\/code><\/pre>\n\n\n<p>Here, we replace &#8220;GroupName&#8221; with the name of the group we want to check. If the current user is a member of this group, the content inside the shortcode will be displayed.<\/p>\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Using the groups_member shortcode to check if the current user is a member of multiple groups.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_member group=\"GroupName1,GroupName2,GroupName3\" \/]<\/code><\/pre>\n\n\n<p>In this example, we are checking if the current user is a member of any of the groups &#8220;GroupName1&#8221;, &#8220;GroupName2&#8221;, or &#8220;GroupName3&#8221;. We separate each group name with a comma. If the user is a member of any of these groups, the content inside the shortcode will be displayed.<\/p>\n<p>Another advanced usage is to nest the groups_member shortcode inside another shortcode.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[some_shortcode][groups_member group=\"GroupName\" \/][\/some_shortcode]<\/code><\/pre>\n\n\n<p>Here, we are nesting the groups_member shortcode inside the some_shortcode. The groups_member shortcode will first check if the current user is a member of &#8220;GroupName&#8221;. If the user is a member, the content inside the groups_member shortcode will be processed by the some_shortcode.<\/p>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_member]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_member', array( __CLASS__, 'groups_member' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_member( $atts, $content = null ) {\n\t\t$output = &#039;&#039;;\n\t\t$options = shortcode_atts( array( &#039;group&#039; =&gt; &#039;&#039; ), $atts );\n\t\t$show_content = false;\n\t\tif ( $content !== null ) {\n\t\t\t$groups_user = new Groups_User( get_current_user_id() );\n\t\t\t$groups = explode( &#039;,&#039;, $options&#91;&#039;group&#039;] );\n\t\t\tforeach ( $groups as $group ) {\n\t\t\t\t$group = addslashes( trim( $group ) );\n\t\t\t\t$current_group = Groups_Group::read( $group );\n\t\t\t\tif ( !$current_group ) {\n\t\t\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t\t\t}\n\t\t\t\tif ( $current_group ) {\n\t\t\t\t\tif ( Groups_User_Group::read( $groups_user-&gt;user-&gt;ID , $current_group-&gt;group_id ) ) {\n\t\t\t\t\t\t$show_content = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $show_content ) {\n\t\t\t\tremove_shortcode( &#039;groups_member&#039; );\n\t\t\t\t$content = do_shortcode( $content );\n\t\t\t\tadd_shortcode( &#039;groups_member&#039;, array( __CLASS__, &#039;groups_member&#039; ) );\n\t\t\t\t$output = $content;\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/access\/class-groups-access-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_non_member] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;groups_non_member&#8217; shortcode is used to control content visibility based on user group membership in WordPress. \n\n\n\nIt checks if the current user is not a member of a specified group(s). If true, the enclosed content is displayed. If the user is a member, the content remains hidden. This shortcode provides a simple way to customize user experience based on group membership.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_non_member]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_non_member shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>group<\/code> &#8211; Specifies the group(s) to check non-membership for<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; Displays content only to non-members of a specific group.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_non_member group=\"group1\"]Your content here[\/groups_non_member]<\/code><\/pre>\n\n\n<p><strong>Advanced example<\/strong> &#8211; Displays content only to non-members of multiple groups. If the user is a member of any of the specified groups, the content will not be displayed to them.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_non_member group=\"group1,group2,group3\"]Your content here[\/groups_non_member]<\/code><\/pre>\n\n\n<p>In both examples, replace &#8220;Your content here&#8221; with the content you want to display to non-members. Also, replace &#8220;group1&#8221;, &#8220;group2&#8221;, etc., with the actual names of your groups.<\/p>\n<p>Note: If a group name contains spaces, enclose the name in double quotes. For example:<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_non_member group=\"group1,group2,\\\"group three\\\"\"]Your content here[\/groups_non_member]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_non_member]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_non_member', array( __CLASS__, 'groups_non_member' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_non_member( $atts, $content = null ) {\n\t\t$output = &#039;&#039;;\n\t\t$options = shortcode_atts( array( &#039;group&#039; =&gt; &#039;&#039; ), $atts );\n\t\t$show_content = true;\n\t\tif ( $content !== null ) {\n\t\t\t$groups_user = new Groups_User( get_current_user_id() );\n\t\t\t$groups = explode( &#039;,&#039;, $options&#91;&#039;group&#039;] );\n\t\t\tforeach ( $groups as $group ) {\n\t\t\t\t$group = addslashes( trim( $group ) );\n\t\t\t\t$current_group = Groups_Group::read( $group );\n\t\t\t\tif ( !$current_group ) {\n\t\t\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t\t\t}\n\t\t\t\tif ( $current_group ) {\n\t\t\t\t\tif ( Groups_User_Group::read( $groups_user-&gt;user-&gt;ID , $current_group-&gt;group_id ) ) {\n\t\t\t\t\t\t$show_content = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $show_content ) {\n\t\t\t\tremove_shortcode( &#039;groups_non_member&#039; );\n\t\t\t\t$content = do_shortcode( $content );\n\t\t\t\tadd_shortcode( &#039;groups_non_member&#039;, array( __CLASS__, &#039;groups_non_member&#039; ) );\n\t\t\t\t$output = $content;\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/access\/class-groups-access-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_can] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;groups_can&#8217; shortcode checks if a user has certain capabilities. If true, it displays the enclosed content. It uses the &#8216;Groups_User&#8217; class to retrieve the current user&#8217;s capabilities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_can]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_can shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>capability<\/code> &#8211; Specifies user&#8217;s capabilities to access the content<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; A simple usage of the &#8216;groups_can&#8217; shortcode to check if the current user has the &#8216;editor&#8217; capability.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_can capability=\"editor\"]You have the editor capability![\/groups_can]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Using the &#8216;groups_can&#8217; shortcode to check if the current user has either &#8216;editor&#8217; or &#8216;administrator&#8217; capabilities. If the user has either of these capabilities, the enclosed content will be displayed.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_can capability=\"editor,administrator\"]You have either editor or administrator capability![\/groups_can]<\/code><\/pre>\n\n\n<p>Another advanced usage of the &#8216;groups_can&#8217; shortcode where we check for multiple capabilities. Here, the shortcode checks if the current user has the &#8216;editor&#8217;, &#8216;administrator&#8217;, or &#8216;author&#8217; capabilities. If the user has any of these capabilities, the enclosed content will be displayed.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_can capability=\"editor,administrator,author\"]You have either editor, administrator, or author capability![\/groups_can]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_can]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_can', array( __CLASS__, 'groups_can' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_can( $atts, $content = null ) {\n\t\t$output = &#039;&#039;;\n\t\t$options = shortcode_atts( array( &#039;capability&#039; =&gt; &#039;&#039; ), $atts );\n\t\tif ( $content !== null ) {\n\t\t\t$groups_user = new Groups_User( get_current_user_id() );\n\t\t\t$capability = $options&#91;&#039;capability&#039;];\n\t\t\t$capabilities = array_map( &#039;trim&#039;, explode( &#039;,&#039;, $capability ) );\n\t\t\t$show_content = false;\n\t\t\tforeach( $capabilities as $capability ) {\n\t\t\t\tif ( $groups_user-&gt;can( $capability ) ) {\n\t\t\t\t\t$show_content = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $show_content ) {\n\t\t\t\tremove_shortcode( &#039;groups_can&#039; );\n\t\t\t\t$content = do_shortcode( $content );\n\t\t\t\tadd_shortcode( &#039;groups_can&#039;, array( __CLASS__, &#039;groups_can&#039; ) );\n\t\t\t\t$output = $content;\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/access\/class-groups-access-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_can_not] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;groups_can_not&#8217; shortcode is a powerful tool in the Groups plugin. It restricts content visibility based on user capabilities. \n\n\n\nThis shortcode checks if the current user possesses certain capabilities. If they do, the content within the shortcode remains hidden. If the user lacks the specified capabilities, the content becomes visible. \n\nThis ensures a tailored user experience, enhancing the functionality of your WordPress site.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_can_not]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_can_not shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>capability<\/code> &#8211; specifies the user&#8217;s abilities or roles<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic Example<\/strong> &#8211; Displaying content to users who lack a specific capability<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_can_not capability=\"edit_posts\"]You don't have permission to edit posts.[\/groups_can_not]<\/code><\/pre>\n\n\n<p>In this example, the shortcode checks if the current user has the &#8216;edit_posts&#8217; capability. If the user does not have this capability, the message &#8220;You don&#8217;t have permission to edit posts.&#8221; is displayed. This can be useful in informing users of their restrictions or guiding them to upgrade their membership for more capabilities.<\/p>\n<p><strong>Advanced Examples<\/strong> &#8211; Checking for multiple capabilities<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_can_not capability=\"edit_posts, publish_posts\"]You don't have the required permissions.[\/groups_can_not]<\/code><\/pre>\n\n\n<p>In this advanced example, the shortcode checks for multiple capabilities. It checks if the current user has either &#8216;edit_posts&#8217; or &#8216;publish_posts&#8217; capabilities. If the user lacks either of these capabilities, it displays the message &#8220;You don&#8217;t have the required permissions.&#8221; This can be used to inform users when they lack one or more necessary capabilities to perform a certain action.<\/p>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_can_not]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_can_not', array( __CLASS__, 'groups_can_not' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_can_not( $atts, $content = null ) {\n\t\t$output = &#039;&#039;;\n\t\t$options = shortcode_atts( array( &#039;capability&#039; =&gt; &#039;&#039; ), $atts );\n\t\tif ( $content !== null ) {\n\t\t\t$groups_user = new Groups_User( get_current_user_id() );\n\t\t\t$capability = $options&#91;&#039;capability&#039;];\n\t\t\t$capabilities = array_map( &#039;trim&#039;, explode( &#039;,&#039;, $capability ) );\n\t\t\t$show_content = true;\n\t\t\tforeach( $capabilities as $capability ) {\n\t\t\t\tif ( $groups_user-&gt;can( $capability ) ) {\n\t\t\t\t\t$show_content = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( $show_content ) {\n\t\t\t\tremove_shortcode( &#039;groups_can_not&#039; );\n\t\t\t\t$content = do_shortcode( $content );\n\t\t\t\tadd_shortcode( &#039;groups_can_not&#039;, array( __CLASS__, &#039;groups_can_not&#039; ) );\n\t\t\t\t$output = $content;\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/access\/class-groups-access-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_login] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Groups Login shortcode is a useful tool in the Groups plugin for WordPress, allowing users to log in or out directly from any page. \n\n\n\nThe shortcode utilizes the PHP function &#8216;groups_login&#8217; to generate a login form. If &#8216;show_logout&#8217; is set to &#8216;yes&#8217;, it provides a logout option for logged-in users. The &#8216;redirect&#8217; attribute defines the page users are directed to post-login or logout.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_login]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_login shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>redirect<\/code> &#8211; URL where users will be sent after login<\/li>\n<li><code>show_logout<\/code> &#8211; displays logout link if set to &#8216;yes&#8217;<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; The shortcode &#8216;groups_login&#8217; can be used to display a login form on your WordPress site. By default, it will redirect users to the current page after they log in.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_login \/]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>1. Customizing the redirect URL &#8211; You can specify a custom URL to redirect users to after they log in. Simply include the &#8216;redirect&#8217; attribute in the shortcode and specify your desired URL.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_login redirect=\"https:\/\/yourwebsite.com\/yourpage\" \/]<\/code><\/pre>\n\n\n<p>2. Showing Logout Link &#8211; If you want to display a logout link to logged-in users, you can do so by setting the &#8216;show_logout&#8217; attribute to &#8216;yes&#8217;. This can be useful if you want to provide users with a quick way to log out from the same page where they logged in.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_login show_logout=\"yes\" \/]<\/code><\/pre>\n\n\n<p>3. Combining both parameters &#8211; You can also use both &#8216;redirect&#8217; and &#8216;show_logout&#8217; attributes together to customize the login form&#8217;s behavior further. Here&#8217;s an example:<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_login redirect=\"https:\/\/yourwebsite.com\/yourpage\" show_logout=\"yes\" \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_login]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_login', array( __CLASS__, 'groups_login' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_login( $atts, $content = null ) {\n\t\t$current_url = ( is_ssl() ? &#039;https:\/\/&#039; : &#039;http:\/\/&#039; ) . $_SERVER&#91;&#039;HTTP_HOST&#039;] . $_SERVER&#91;&#039;REQUEST_URI&#039;];\n\t\textract(\n\t\t\tshortcode_atts(\n\t\t\t\tarray(\n\t\t\t\t\t&#039;redirect&#039;        =&gt; $current_url,\n\t\t\t\t\t&#039;show_logout&#039;     =&gt; &#039;no&#039;\n\t\t\t\t),\n\t\t\t\t$atts\n\t\t\t)\n\t\t);\n\t\t$redirect    = trim( $redirect );\n\t\t$show_logout = trim( strtolower( $show_logout ) );\n\t\t$output      = &#039;&#039;;\n\t\tif ( !is_user_logged_in() ) {\n\t\t\t$output .= wp_login_form(\n\t\t\t\tarray(\n\t\t\t\t\t&#039;echo&#039;     =&gt; false,\n\t\t\t\t\t&#039;redirect&#039; =&gt; $redirect\n\t\t\t\t)\n\t\t\t);\n\t\t} else {\n\t\t\tif ( $show_logout == &#039;yes&#039; ) {\n\t\t\t\t$output .= self::groups_logout(\n\t\t\t\t\tarray(\n\t\t\t\t\t\t&#039;redirect&#039; =&gt; $redirect\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_logout] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Groups Logout shortcode enables users to log out from a WordPress site. It generates a logout URL, which redirects users to the current page after logging out.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_logout]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; This shortcode allows the user to log out from the current page.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_logout \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_logout]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_logout', array( __CLASS__, 'groups_logout' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_logout( $atts, $content = null ) {\n\t\t$current_url = ( is_ssl() ? &#039;https:\/\/&#039; : &#039;http:\/\/&#039; ) . $_SERVER&#91;&#039;HTTP_HOST&#039;] . $_SERVER&#91;&#039;REQUEST_URI&#039;];\n\t\textract(\n\t\t\tshortcode_atts(\n\t\t\t\tarray(\n\t\t\t\t\t&#039;redirect&#039; =&gt; $current_url\n\t\t\t\t),\n\t\t\t\t$atts\n\t\t\t)\n\t\t);\n\t\t$redirect = trim( $redirect );\n\t\t$output   = &#039;&#039;;\n\t\tif ( is_user_logged_in() ) {\n\t\t\t$output .= sprintf( &#039;&lt;a href=&quot;%s&quot;&gt;&#039;, esc_url( wp_logout_url( $redirect ) ) );\n\t\t\t$output .= __( &#039;Log out&#039;, &#039;groups&#039; );\n\t\t\t$output .= &#039;&lt;\/a&gt;&#039;;\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_group_info] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;Groups Group Info&#8217; shortcode provides detailed information about a specific group. It fetches group data like name, description, count, and users. \n\n \n\nIt allows customization through various attributes. You can specify the group by its name and choose what information to show. The &#8216;show&#8217; attribute can display the group&#8217;s name, description, count of users, or the users themselves. \n\nThe count is the number of users in the group, while &#8216;users&#8217; lists all the users in the group. The output is neatly formatted and sanitized to ensure a clean display.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_group_info]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_group_info shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>group<\/code> &#8211; Specifies the name or ID of the group<\/li>\n<li><code>show<\/code> &#8211; Determines the type of information to display: group name, description, user count, or users<\/li>\n<li><code>format<\/code> &#8211; Defines the output format, not used in this function<\/li>\n<li><code>single<\/code> &#8211; Text to display when group has only one user<\/li>\n<li><code>plural<\/code> &#8211; Format of text to display for groups with multiple users, uses count placeholder<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; Displaying the name of a group using the &#8216;groups_group_info&#8217; shortcode.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_group_info group=\"GroupName\" show=\"name\" \/]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Displaying the description of a group using the &#8216;groups_group_info&#8217; shortcode.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_group_info group=\"GroupName\" show=\"description\" \/]<\/code><\/pre>\n\n\n<p>Displaying the count of users in a group using the &#8216;groups_group_info&#8217; shortcode. The output will be singular or plural based on the count of users.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_group_info group=\"GroupName\" show=\"count\" single=\"1 user\" plural=\"%d users\" \/]<\/code><\/pre>\n\n\n<p>Displaying the list of users in a group using the &#8216;groups_group_info&#8217; shortcode. The output will be a list of usernames.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_group_info group=\"GroupName\" show=\"users\" \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_group_info]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_group_info', array( __CLASS__, 'groups_group_info' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_group_info( $atts, $content = null ) {\n\t\tglobal $wpdb;\n\t\t$output = &quot;&quot;;\n\t\t$options = shortcode_atts(\n\t\t\tarray(\n\t\t\t\t&#039;group&#039; =&gt; &#039;&#039;,\n\t\t\t\t&#039;show&#039; =&gt; &#039;&#039;,\n\t\t\t\t&#039;format&#039; =&gt; &#039;&#039;,\n\t\t\t\t&#039;single&#039; =&gt; &#039;1&#039;,\n\t\t\t\t&#039;plural&#039; =&gt; &#039;%d&#039;\n\t\t\t),\n\t\t\t$atts\n\t\t);\n\t\t$group = trim( $options&#91;&#039;group&#039;] );\n\t\t$current_group = Groups_Group::read( $group );\n\t\tif ( !$current_group ) {\n\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t}\n\t\tif ( $current_group ) {\n\t\t\tswitch( $options&#91;&#039;show&#039;] ) {\n\t\t\t\tcase &#039;name&#039; :\n\t\t\t\t\t$output .= wp_filter_nohtml_kses( $current_group-&gt;name );\n\t\t\t\t\tbreak;\n\t\t\t\tcase &#039;description&#039; :\n\t\t\t\t\t$output .= wp_filter_nohtml_kses( $current_group-&gt;description );\n\t\t\t\t\tbreak;\n\t\t\t\tcase &#039;count&#039; :\n\t\t\t\t\t$user_group_table = _groups_get_tablename( &#039;user_group&#039; );\n\t\t\t\t\t$count = $wpdb-&gt;get_var( $wpdb-&gt;prepare(\n\t\t\t\t\t\t&quot;SELECT COUNT(*) FROM $user_group_table WHERE group_id = %d&quot;,\n\t\t\t\t\t\tGroups_Utility::id( $current_group-&gt;group_id )\n\t\t\t\t\t) );\n\t\t\t\t\tif ( $count === null ) {\n\t\t\t\t\t\t$count = 0;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$count = intval( $count );\n\t\t\t\t\t}\n\t\t\t\t\t$output .= _n( $options&#91;&#039;single&#039;], sprintf( $options&#91;&#039;plural&#039;], $count ), $count, &#039;groups&#039; );\n\t\t\t\t\tbreak;\n\t\t\t\t\/\/ @todo experimental - could use pagination, sorting, link to profile, ...\n\t\t\t\tcase &#039;users&#039; :\n\t\t\t\t\t$user_group_table = _groups_get_tablename( &#039;user_group&#039; );\n\t\t\t\t\t$users = $wpdb-&gt;get_results( $wpdb-&gt;prepare(\n\t\t\t\t\t\t&quot;SELECT * FROM $wpdb-&gt;users LEFT JOIN $user_group_table ON $wpdb-&gt;users.ID = $user_group_table.user_id WHERE $user_group_table.group_id = %d&quot;,\n\t\t\t\t\t\tGroups_Utility::id( $current_group-&gt;group_id )\n\t\t\t\t\t) );\n\t\t\t\t\tif ( $users ) {\n\t\t\t\t\t\t$output .= &#039;&lt;ul&gt;&#039;;\n\t\t\t\t\t\tforeach( $users as $user ) {\n\t\t\t\t\t\t\t$output .= &#039;&lt;li&gt;&#039; . wp_filter_nohtml_kses( $user-&gt;user_login ) . &#039;&lt;\/li&gt;&#039;;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$output .= &#039;&lt;\/ul&gt;&#039;;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_user_groups] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Groups User Groups shortcode is designed to display the groups a user belongs to. It allows customization of output format and sorting.\n\n\n\nIt accepts attributes like &#8216;user_id&#8217;, &#8216;user_login&#8217;, &#8216;user_email&#8217; for user targeting. The &#8216;format&#8217; attribute controls the output format, &#8216;list_class&#8217; and &#8216;item_class&#8217; define CSS classes for list and items respectively.\n\nThe &#8216;order_by&#8217; and &#8216;order&#8217; attributes manage the sorting of groups. &#8216;group&#8217; and &#8216;exclude_group&#8217; attributes allow including or excluding specific groups.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_user_groups]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_user_groups shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>user_id<\/code> &#8211; Identifies the user by their unique ID.<\/li>\n<li><code>user_login<\/code> &#8211; Specifies the user by their login name.<\/li>\n<li><code>user_email<\/code> &#8211; Defines the user by their email address.<\/li>\n<li><code>format<\/code> &#8211; Determines the format of the output, such as list or div.<\/li>\n<li><code>list_class<\/code> &#8211; Sets the CSS class for the list.<\/li>\n<li><code>item_class<\/code> &#8211; Assigns the CSS class for each list item.<\/li>\n<li><code>order_by<\/code> &#8211; Specifies sorting of the list by name or group ID.<\/li>\n<li><code>order<\/code> &#8211; Sets the order of the list, either ascending or descending.<\/li>\n<li><code>group<\/code> &#8211; Defines specific group(s) to be included in the list.<\/li>\n<li><code>exclude_group<\/code> &#8211; Specifies group(s) to be excluded from the list.<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; Displaying the groups of the current user in a list format<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_user_groups \/]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Displaying the groups of a specific user by user ID and excluding a certain group. The groups are displayed in an ordered list format, sorted by name in descending order.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_user_groups user_id=\"2\" exclude_group=\"3\" format=\"ol\" order_by=\"name\" order=\"DESC\" \/]<\/code><\/pre>\n\n\n<p>Displaying the groups of a specific user by user email in a unordered list format, sorted by group ID in ascending order. A specific class is assigned to the list and each item.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_user_groups user_email=\"example@example.com\" format=\"ul\" list_class=\"my-list\" item_class=\"my-item\" order_by=\"group_id\" \/]<\/code><\/pre>\n\n\n<p>Displaying only specific groups of a user by user login. The groups are displayed in a div format.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_user_groups user_login=\"username\" group=\"1,2,3\" format=\"div\" \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_user_groups]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_user_groups', array( __CLASS__, 'groups_user_groups' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_user_groups( $atts, $content = null ) {\n\t\t$output = &#039;&#039;;\n\t\t$options = shortcode_atts(\n\t\t\tarray(\n\t\t\t\t&#039;user_id&#039; =&gt; null,\n\t\t\t\t&#039;user_login&#039; =&gt; null,\n\t\t\t\t&#039;user_email&#039; =&gt; null,\n\t\t\t\t&#039;format&#039; =&gt; &#039;list&#039;,\n\t\t\t\t&#039;list_class&#039; =&gt; &#039;groups&#039;,\n\t\t\t\t&#039;item_class&#039; =&gt; &#039;name&#039;,\n\t\t\t\t&#039;order_by&#039; =&gt; &#039;name&#039;,\n\t\t\t\t&#039;order&#039; =&gt; &#039;ASC&#039;,\n\t\t\t\t&#039;group&#039; =&gt; null,\n\t\t\t\t&#039;exclude_group&#039; =&gt; null\n\t\t\t),\n\t\t\t$atts\n\t\t);\n\t\t$user_id = null;\n\t\tif ( $options&#91;&#039;user_id&#039;] !== null ) {\n\t\t\tif ( $user = get_user_by( &#039;id&#039;, $options&#91;&#039;user_id&#039;] ) ) {\n\t\t\t\t$user_id = $user-&gt;ID;\n\t\t\t}\n\t\t} else if ( $options&#91;&#039;user_id&#039;] !== null ) {\n\t\t\tif ( $user = get_user_by( &#039;login&#039;, $options&#91;&#039;user_login&#039;] ) ) {\n\t\t\t\t$user_id = $user-&gt;ID;\n\t\t\t}\n\t\t} else if ( $options&#91;&#039;user_email&#039;] !== null ) {\n\t\t\tif ( $user = get_user_by( &#039;email&#039;, $options&#91;&#039;user_login&#039;] ) ) {\n\t\t\t\t$user_id = $user-&gt;ID;\n\t\t\t}\n\t\t}\n\t\tif ( $user_id === null ) {\n\t\t\t$user_id = get_current_user_id();\n\t\t}\n\t\tif ( $user_id !== null ) {\n\t\t\t$user = new Groups_User( $user_id );\n\t\t\t$groups = $user-&gt;groups;\n\n\t\t\tif ( !empty( $groups ) ) {\n\t\t\t\/\/ group attr\n\t\t\t\tif ( $options&#91;&#039;group&#039;] !== null ) {\n\t\t\t\t\t$groups = array();\n\t\t\t\t\t$groups_incl = explode( &#039;,&#039;, $options&#91;&#039;group&#039;] );\n\t\t\t\t\tforeach ( $groups_incl as $group_incl ) {\n\t\t\t\t\t\t$group = trim( $group_incl );\n\t\t\t\t\t\t$current_group = Groups_Group::read( $group );\n\t\t\t\t\t\tif ( !$current_group ) {\n\t\t\t\t\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( $current_group ) {\n\t\t\t\t\t\t\tif ( Groups_User_Group::read( $user_id, $current_group-&gt;group_id ) ) {\n\t\t\t\t\t\t\t\t$groups&#91;] = $current_group;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\/\/ exclude_group attr\n\t\t\t\tif ( $options&#91;&#039;exclude_group&#039;] !== null ) {\n\t\t\t\t\t$groups_excl = explode( &#039;,&#039;, $options&#91;&#039;exclude_group&#039;] );\n\t\t\t\t\tforeach ( $groups_excl as $key =&gt; $group_excl ) {\n\t\t\t\t\t\t$group = trim( $group_excl );\n\t\t\t\t\t\t$current_group = Groups_Group::read( $group );\n\t\t\t\t\t\tif ( !$current_group ) {\n\t\t\t\t\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( $current_group ) {\n\t\t\t\t\t\t\t$groups_excl&#91;$key] = $current_group-&gt;group_id;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tunset( $groups_excl&#91;$key] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tforeach ( $groups as $key =&gt; $group ) {\n\t\t\t\t\t\tif ( in_array( $group-&gt;group_id, $groups_excl ) ) {\n\t\t\t\t\t\t\tunset( $groups&#91;$key] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tswitch( $options&#91;&#039;order_by&#039;] ) {\n\t\t\t\t\tcase &#039;group_id&#039; :\n\t\t\t\t\t\tusort( $groups, array( __CLASS__, &#039;sort_id&#039; ) );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault :\n\t\t\t\t\t\tusort( $groups, array( __CLASS__, &#039;sort_name&#039; ) );\n\t\t\t\t}\n\t\t\t\tswitch( $options&#91;&#039;order&#039;] ) {\n\t\t\t\t\tcase &#039;desc&#039; :\n\t\t\t\t\tcase &#039;DESC&#039; :\n\t\t\t\t\t\t$groups = array_reverse( $groups );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tswitch( $options&#91;&#039;format&#039;] ) {\n\t\t\t\t\tcase &#039;list&#039; :\n\t\t\t\t\tcase &#039;ul&#039; :\n\t\t\t\t\t\t$output .= &#039;&lt;ul class=&quot;&#039; . esc_attr( $options&#91;&#039;list_class&#039;] ) . &#039;&quot;&gt;&#039;;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase &#039;ol&#039; :\n\t\t\t\t\t\t$output .= &#039;&lt;ol class=&quot;&#039; . esc_attr( $options&#91;&#039;list_class&#039;] ) . &#039;&quot;&gt;&#039;;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault :\n\t\t\t\t\t\t$output .= &#039;&lt;div class=&quot;&#039; . esc_attr( $options&#91;&#039;list_class&#039;] ) . &#039;&quot;&gt;&#039;;\n\t\t\t\t}\n\t\t\t\tforeach( $groups as $group ) {\n\t\t\t\t\tswitch( $options&#91;&#039;format&#039;] ) {\n\t\t\t\t\t\tcase &#039;list&#039; :\n\t\t\t\t\t\tcase &#039;ul&#039; :\n\t\t\t\t\t\tcase &#039;ol&#039; :\n\t\t\t\t\t\t\t$output .= &#039;&lt;li class=&quot;&#039; . esc_attr( $options&#91;&#039;item_class&#039;] ) . &#039;&quot;&gt;&#039; . $group-&gt;name . &#039;&lt;\/li&gt;&#039;;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault :\n\t\t\t\t\t\t\t$output .= &#039;&lt;div class=&quot;&#039; . esc_attr( $options&#91;&#039;item_class&#039;] ) . &#039;&quot;&gt;&#039; . $group-&gt;name . &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tswitch( $options&#91;&#039;format&#039;] ) {\n\t\t\t\t\tcase &#039;list&#039; :\n\t\t\t\t\tcase &#039;ul&#039; :\n\t\t\t\t\t\t$output .= &#039;&lt;\/ul&gt;&#039;;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase &#039;ol&#039; :\n\t\t\t\t\t\t$output .= &#039;&lt;\/ol&gt;&#039;;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault :\n\t\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_groups] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Groups Plugin shortcode is a tool that retrieves and displays groups from your database. It sorts these groups by &#8216;name&#8217; or &#8216;group_id&#8217;, and displays them in ascending or descending order.\n\n\n\nThis shortcode uses various formats (&#8216;list&#8217;, &#8216;ul&#8217;, &#8216;ol&#8217;) to present the groups. It customizes the display with CSS classes for the list and each item, providing flexibility in styling.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_groups]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_groups shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>format<\/code> &#8211; Determines the layout of the group list (list, ul, ol, or div).<\/li>\n<li><code>list_class<\/code> &#8211; Specifies the CSS class for the list container.<\/li>\n<li><code>item_class<\/code> &#8211; Specifies the CSS class for each list item.<\/li>\n<li><code>order_by<\/code> &#8211; Defines the group list order (by name or group_id).<\/li>\n<li><code>order<\/code> &#8211; Sets the direction of the order (ASC for ascending or DESC for descending).<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic Example<\/strong> &#8211; Display a list of groups in ascending order by name.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_groups format=\"list\" list_class=\"groups\" item_class=\"name\" order_by=\"name\" order=\"ASC\"]<\/code><\/pre>\n\n\n<p><strong>Advanced Examples<\/strong><\/p>\n<p>Display a list of groups in descending order by group ID, using ordered list format.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_groups format=\"ol\" list_class=\"groups\" item_class=\"name\" order_by=\"group_id\" order=\"DESC\"]<\/code><\/pre>\n\n\n<p>Display groups in a div format, ordered in ascending order by name.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_groups format=\"div\" list_class=\"groups\" item_class=\"name\" order_by=\"name\" order=\"ASC\"]<\/code><\/pre>\n\n\n<p>Display groups as an unordered list, ordered in ascending order by group ID.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_groups format=\"ul\" list_class=\"groups\" item_class=\"name\" order_by=\"group_id\" order=\"ASC\"]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_groups]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_groups',  array( __CLASS__, 'groups_groups' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_groups( $atts, $content = null ) {\n\t\tglobal $wpdb;\n\t\t$output = &#039;&#039;;\n\t\t$options = shortcode_atts(\n\t\t\tarray(\n\t\t\t\t&#039;format&#039; =&gt; &#039;list&#039;,\n\t\t\t\t&#039;list_class&#039; =&gt; &#039;groups&#039;,\n\t\t\t\t&#039;item_class&#039; =&gt; &#039;name&#039;,\n\t\t\t\t&#039;order_by&#039; =&gt; &#039;name&#039;,\n\t\t\t\t&#039;order&#039; =&gt; &#039;ASC&#039;\n\t\t\t),\n\t\t\t$atts\n\t\t);\n\t\tswitch( $options&#91;&#039;order_by&#039;] ) {\n\t\t\tcase &#039;group_id&#039; :\n\t\t\tcase &#039;name&#039; :\n\t\t\t\t$order_by = $options&#91;&#039;order_by&#039;];\n\t\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\t$order_by = &#039;name&#039;;\n\t\t}\n\t\tswitch( $options&#91;&#039;order&#039;] ) {\n\t\t\tcase &#039;asc&#039; :\n\t\t\tcase &#039;ASC&#039; :\n\t\t\tcase &#039;desc&#039; :\n\t\t\tcase &#039;DESC&#039; :\n\t\t\t\t$order = strtoupper( $options&#91;&#039;order&#039;] );\n\t\t\t\tbreak;\n\t\t\tdefault :\n\t\t\t\t$order = &#039;ASC&#039;;\n\t\t}\n\t\t$group_table = _groups_get_tablename( &#039;group&#039; );\n\t\tif ( $groups = $wpdb-&gt;get_results(\n\t\t\t&quot;SELECT group_id FROM $group_table ORDER BY $order_by $order&quot;\n\t\t) ) {\n\t\t\tswitch( $options&#91;&#039;format&#039;] ) {\n\t\t\t\tcase &#039;list&#039; :\n\t\t\t\tcase &#039;ul&#039; :\n\t\t\t\t\t$output .= &#039;&lt;ul class=&quot;&#039; . esc_attr( $options&#91;&#039;list_class&#039;] ) . &#039;&quot;&gt;&#039;;\n\t\t\t\t\tbreak;\n\t\t\t\tcase &#039;ol&#039; :\n\t\t\t\t\t$output .= &#039;&lt;ol class=&quot;&#039; . esc_attr( $options&#91;&#039;list_class&#039;] ) . &#039;&quot;&gt;&#039;;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault :\n\t\t\t\t\t$output .= &#039;&lt;div class=&quot;&#039; . esc_attr( $options&#91;&#039;list_class&#039;] ) . &#039;&quot;&gt;&#039;;\n\t\t\t}\n\t\t\tforeach( $groups as $group ) {\n\t\t\t\t$group = new Groups_Group( $group-&gt;group_id );\n\t\t\t\tswitch( $options&#91;&#039;format&#039;] ) {\n\t\t\t\t\tcase &#039;list&#039; :\n\t\t\t\t\tcase &#039;ul&#039; :\n\t\t\t\t\tcase &#039;ol&#039; :\n\t\t\t\t\t\t$output .= &#039;&lt;li class=&quot;&#039; . esc_attr( $options&#91;&#039;item_class&#039;] ) . &#039;&quot;&gt;&#039; . $group-&gt;name . &#039;&lt;\/li&gt;&#039;;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault :\n\t\t\t\t\t\t$output .= &#039;&lt;div class=&quot;&#039; . esc_attr( $options&#91;&#039;item_class&#039;] ) . &#039;&quot;&gt;&#039; . $group-&gt;name . &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch( $options&#91;&#039;format&#039;] ) {\n\t\t\t\tcase &#039;list&#039; :\n\t\t\t\tcase &#039;ul&#039; :\n\t\t\t\t\t$output .= &#039;&lt;\/ul&gt;&#039;;\n\t\t\t\t\tbreak;\n\t\t\t\tcase &#039;ol&#039; :\n\t\t\t\t\t$output .= &#039;&lt;\/ol&gt;&#039;;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault :\n\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_join] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;groups_join&#8217; shortcode from the Groups plugin allows users to join a specific group. It uses the &#8216;groups_join&#8217; function to display a join form or a message if the user is already a member.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_join]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_join shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>group<\/code> &#8211; identifies the group a user wishes to join<\/li>\n<li><code>display_message<\/code> &#8211; controls if a message is displayed after joining a group<\/li>\n<li><code>display_is_member<\/code> &#8211; shows a message if the user is already a member of the group<\/li>\n<li><code>submit_text<\/code> &#8211; customizes the text displayed on the join button<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; A simple shortcode for a user to join a group. The group name is specified as an attribute in the shortcode.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_join group=\"GroupName\" \/]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Using the shortcode with an option to display a message after a user joins a group. The message will be displayed if &#8216;display_message&#8217; attribute is set to true.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_join group=\"GroupName\" display_message=true \/]<\/code><\/pre>\n\n\n<p>Using the shortcode with an option to display a custom submit button text. The text will replace the default &#8216;Join the %s group&#8217; text.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_join group=\"GroupName\" submit_text=\"Click here to join the %s group\" \/]<\/code><\/pre>\n\n\n<p>Using the shortcode with multiple attributes. This example includes a group name to join, a custom submit button text, and an option to display a message after a user joins a group.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_join group=\"GroupName\" display_message=true submit_text=\"Click here to join the %s group\" \/]<\/code><\/pre>\n\n\n<p>Using the shortcode with an option to display a message if a user is already a member of the group. The message will be displayed if &#8216;display_is_member&#8217; attribute is set to true.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_join group=\"GroupName\" display_is_member=true \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_join]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_join',  array( __CLASS__, 'groups_join' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_join( $atts, $content = null ) {\n\t\t$nonce_action = &#039;groups_action&#039;;\n\t\t$nonce        = &#039;nonce_join&#039;;\n\t\t$output       = &#039;&#039;;\n\n\t\t$options = shortcode_atts(\n\t\t\tarray(\n\t\t\t\t&#039;group&#039;             =&gt; &#039;&#039;,\n\t\t\t\t&#039;display_message&#039;   =&gt; true,\n\t\t\t\t&#039;display_is_member&#039; =&gt; false,\n\t\t\t\t&#039;submit_text&#039;       =&gt; __( &#039;Join the %s group&#039;, &#039;groups&#039; )\n\t\t\t),\n\t\t\t$atts\n\t\t);\n\t\textract( $options );\n\n\t\tif ( $display_message === &#039;false&#039; ) {\n\t\t\t$display_message = false;\n\t\t}\n\t\tif ( $display_is_member === &#039;true&#039; ) {\n\t\t\t$display_is_member = true;\n\t\t}\n\n\t\t$group = trim( $options&#91;&#039;group&#039;] );\n\t\t$current_group = Groups_Group::read( $group );\n\t\tif ( !$current_group ) {\n\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t}\n\t\tif ( $current_group ) {\n\t\t\tif ( $user_id = get_current_user_id() ) {\n\t\t\t\t$submitted     = false;\n\t\t\t\t$invalid_nonce = false;\n\t\t\t\tif ( !empty( $_POST&#91;&#039;groups_action&#039;] ) &amp;&amp; $_POST&#91;&#039;groups_action&#039;] == &#039;join&#039; ) {\n\t\t\t\t\t$submitted = true;\n\t\t\t\t\tif ( !wp_verify_nonce( $_POST&#91;$nonce], $nonce_action ) ) {\n\t\t\t\t\t\t$invalid_nonce = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( $submitted &amp;&amp; !$invalid_nonce ) {\n\t\t\t\t\t\/\/ add user to group\n\t\t\t\t\tif ( isset( $_POST&#91;&#039;group_id&#039;] ) ) {\n\t\t\t\t\t\t$join_group = Groups_Group::read( $_POST&#91;&#039;group_id&#039;] );\n\t\t\t\t\t\tGroups_User_Group::create(\n\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t&#039;group_id&#039; =&gt; $join_group-&gt;group_id,\n\t\t\t\t\t\t\t\t&#039;user_id&#039; =&gt; $user_id\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( !Groups_User_Group::read( $user_id, $current_group-&gt;group_id ) ) {\n\t\t\t\t\t$submit_text = sprintf( $options&#91;&#039;submit_text&#039;], wp_filter_nohtml_kses( $current_group-&gt;name ) );\n\t\t\t\t\t$output .= &#039;&lt;div class=&quot;groups-join&quot;&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;form action=&quot;#&quot; method=&quot;post&quot;&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;input type=&quot;hidden&quot; name=&quot;groups_action&quot; value=&quot;join&quot; \/&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;input type=&quot;hidden&quot; name=&quot;group_id&quot; value=&quot;&#039; . esc_attr( $current_group-&gt;group_id ) . &#039;&quot; \/&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;input type=&quot;submit&quot; value=&quot;&#039; . $submit_text . &#039;&quot; \/&gt;&#039;;\n\t\t\t\t\t$output .=  wp_nonce_field( $nonce_action, $nonce, true, false );\n\t\t\t\t\t$output .= &#039;&lt;\/form&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t} else if ( $display_message ) {\n\t\t\t\t\tif ( $submitted &amp;&amp; !$invalid_nonce &amp;&amp; isset( $join_group ) &amp;&amp; $join_group-&gt;group_id === $current_group-&gt;group_id ) {\n\t\t\t\t\t\t$output .= &#039;&lt;div class=&quot;groups-join joined&quot;&gt;&#039;;\n\t\t\t\t\t\t$output .= sprintf( __( &#039;You have joined the %s group.&#039;, &#039;groups&#039; ), wp_filter_nohtml_kses( $join_group-&gt;name ) );\n\t\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t\t}\n\t\t\t\t\telse if ( $display_is_member &amp;&amp; isset( $current_group ) &amp;&amp; $current_group !== false ) {\n\t\t\t\t\t\t$output .= &#039;&lt;div class=&quot;groups-join member&quot;&gt;&#039;;\n\t\t\t\t\t\t$output .= sprintf( __( &#039;You are a member of the %s group.&#039;, &#039;groups&#039; ), wp_filter_nohtml_kses( $current_group-&gt;name ) );\n\t\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Groups [groups_leave] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Groups_Leave shortcode is a functional tool in WordPress that allows users to leave a specific group. It&#8217;s part of the Groups plugin.\n\n\n\nThe shortcode works by verifying the current user and the group they intend to leave. If the user is indeed part of the group and the nonce verification passes, the user is successfully removed from the group. The shortcode also provides an option to display a message upon successful departure from the group.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[groups_leave]<\/code><\/p>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Parameters<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a list of all possible groups_leave shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>group<\/code> &#8211; specifies the name of the group to leave<\/li>\n<li><code>display_message<\/code> &#8211; controls if a message is shown after leaving the group<\/li>\n<li><code>submit_text<\/code> &#8211; sets the text displayed on the &#8220;leave group&#8221; button<\/li>\n<\/ul>\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; This shortcode allows a user to leave a specific group. The group is identified by its name.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[groups_leave group=\"Group Name\" \/]<\/code><\/pre>\n\n\n\n<div style=\"height:5px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">PHP Function Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In case you have difficulties debugging what causing issues with <code>[groups_leave]<\/code> shortcode, check below the related PHP functions code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode line<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_shortcode( 'groups_leave',  array( __CLASS__, 'groups_leave' ) );<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode PHP function<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nfunction groups_leave( $atts, $content = null ) {\n\t\t$nonce_action = &#039;groups_action&#039;;\n\t\t$nonce        = &#039;nonce_leave&#039;;\n\t\t$output       = &#039;&#039;;\n\n\t\t$options = shortcode_atts(\n\t\t\tarray(\n\t\t\t\t&#039;group&#039;           =&gt; &#039;&#039;,\n\t\t\t\t&#039;display_message&#039; =&gt; true,\n\t\t\t\t&#039;submit_text&#039;     =&gt; __( &#039;Leave the %s group&#039;, &#039;groups&#039; ),\n\t\t\t),\n\t\t\t$atts\n\t\t);\n\t\textract( $options );\n\n\t\tif ( $display_message === &#039;false&#039; ) {\n\t\t\t$display_message = false;\n\t\t}\n\n\t\t$group = trim( $options&#91;&#039;group&#039;] );\n\t\t$current_group = Groups_Group::read( $group );\n\t\tif ( !$current_group ) {\n\t\t\t$current_group = Groups_Group::read_by_name( $group );\n\t\t}\n\t\tif ( $current_group ) {\n\t\t\tif ( $user_id = get_current_user_id() ) {\n\t\t\t\t$submitted     = false;\n\t\t\t\t$invalid_nonce = false;\n\t\t\t\tif ( !empty( $_POST&#91;&#039;groups_action&#039;] ) &amp;&amp; $_POST&#91;&#039;groups_action&#039;] == &#039;leave&#039; ) {\n\t\t\t\t\t$submitted = true;\n\t\t\t\t\tif ( !wp_verify_nonce( $_POST&#91;$nonce], $nonce_action ) ) {\n\t\t\t\t\t\t$invalid_nonce = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( $submitted &amp;&amp; !$invalid_nonce ) {\n\t\t\t\t\t\/\/ remove user from group\n\t\t\t\t\tif ( isset( $_POST&#91;&#039;group_id&#039;] ) ) {\n\t\t\t\t\t\t$leave_group = Groups_Group::read( $_POST&#91;&#039;group_id&#039;] );\n\t\t\t\t\t\tGroups_User_Group::delete( $user_id, $leave_group-&gt;group_id );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( Groups_User_Group::read( $user_id, $current_group-&gt;group_id ) ) {\n\t\t\t\t\t$submit_text = sprintf( $options&#91;&#039;submit_text&#039;], wp_filter_nohtml_kses( $current_group-&gt;name ) );\n\t\t\t\t\t$output .= &#039;&lt;div class=&quot;groups-join&quot;&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;form action=&quot;#&quot; method=&quot;post&quot;&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;input type=&quot;hidden&quot; name=&quot;groups_action&quot; value=&quot;leave&quot; \/&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;input type=&quot;hidden&quot; name=&quot;group_id&quot; value=&quot;&#039; . esc_attr( $current_group-&gt;group_id ) . &#039;&quot; \/&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;input type=&quot;submit&quot; value=&quot;&#039; . $submit_text . &#039;&quot; \/&gt;&#039;;\n\t\t\t\t\t$output .=  wp_nonce_field( $nonce_action, $nonce, true, false );\n\t\t\t\t\t$output .= &#039;&lt;\/form&gt;&#039;;\n\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t} else if ( $display_message ) {\n\t\t\t\t\tif ( $submitted &amp;&amp; !$invalid_nonce &amp;&amp; isset( $leave_group ) &amp;&amp; $leave_group-&gt;group_id === $current_group-&gt;group_id ) {\n\t\t\t\t\t\t$output .= &#039;&lt;div class=&quot;groups-join left&quot;&gt;&#039;;\n\t\t\t\t\t\t$output .= sprintf( __( &#039;You have left the %s group.&#039;, &#039;groups&#039; ), wp_filter_nohtml_kses( $leave_group-&gt;name ) );\n\t\t\t\t\t\t$output .= &#039;&lt;\/div&gt;&#039;;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $output;\n\t}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Code file location<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">groups\/groups\/lib\/views\/class-groups-shortcodes.php<\/code><\/pre>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you&#8217;ve learned how to embed the <strong>Groups Plugin shortcodes<\/strong>, understood the parameters, and seen code examples, it&#8217;s easy to use and debug any issue that might cause it to &#8216;not work&#8217;. If you still have difficulties with it, don&#8217;t hesitate to leave a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Below, you&#8217;ll find a detailed guide on how to add the Groups Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we&#8217;ll assist you with common issues that might cause the Groups Plugin shortcodes not to show or not to work correctly. Before starting, here is an overview of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"name":"Groups","slug":"","version":"2.18.0","author":"<a href=\"https:\/\/www.itthinx.com\">itthinx<\/a>","icons":"https:\/\/ps.w.org\/groups\/assets\/icon-128x128.png?rev=983146","plugin_tags":"{\"access\":\"access\",\"access-control\":\"access-control\",\"groups\":\"groups\",\"membership\":\"membership\",\"memberships\":\"memberships\"}","author_profile":"https:\/\/profiles.wordpress.org\/itthinx\/","requires":"5.5","tested":"6.1.4","requires_php":"5.6.0","rating":96,"num_ratings":354,"active_installs":20000,"downloaded":789122,"last_updated":"2023-02-08 6:53pm GMT","added":"2012-01-12","homepage":"https:\/\/www.itthinx.com\/plugins\/groups","short_description":"Groups is an efficient and powerful solution, providing group-based user membership management, group-based capabilities and content access control.","description":"\"Groups is a WordPress plugin that offers efficient group-based user memberships, content access control, and group capabilities management. Ideal for community-driven sites.\"","shortcodes":"[\"groups_member\",\"groups_non_member\",\"groups_can\",\"groups_can_not\",\"groups_login\",\"groups_logout\",\"groups_group_info\",\"groups_user_groups\",\"groups_groups\",\"groups_join\",\"groups_leave\"]","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1309","post","type-post","status-publish","format-standard","hentry","category-plugins"],"_links":{"self":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/comments?post=1309"}],"version-history":[{"count":1,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1309\/revisions"}],"predecessor-version":[{"id":1588,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1309\/revisions\/1588"}],"wp:attachment":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/media?parent=1309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/categories?post=1309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/tags?post=1309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}