{"id":1014,"date":"2023-10-24T17:04:10","date_gmt":"2023-10-24T17:04:10","guid":{"rendered":"https:\/\/wpshortcode.org\/?p=1014"},"modified":"2023-10-24T17:04:11","modified_gmt":"2023-10-24T17:04:11","slug":"wp-user-frontend-2","status":"publish","type":"post","link":"https:\/\/wpshortcode.org\/wp-user-frontend-2\/","title":{"rendered":"Wp User Frontend Shortcodes"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Below, you&#8217;ll find a detailed guide on how to add the <strong>Wp User Frontend 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 Wp User Frontend 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 Wp User Frontend 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\/wp-user-frontend\/assets\/icon-128x128.gif?rev=2818776\" 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\/wp-user-frontend-2\" target=\"_blank\" rel=\"noopener\">\n                        WP User Frontend &#8211; Registration, User Profile, Membership, Content Restriction, User Directory, and Frontend Post Submission Plugin                    <\/a>\n\n\n                <!-- Plugin Description -->\n                <p class=\"plugin-description\">\n                    &quot;WP User Frontend is a comprehensive plugin that provides user registration, profile creation, membership management, content restriction, user directory, and frontend post submission capabilities.&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\u2729<\/span> (476)\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.3.2            <\/span>\n            <span class=\"plugin-php-version\">\n                <strong>PHP Version<\/strong>: 5.6            <\/span>\n        <\/div>\n\n        <!-- List of Included Shortcodes -->\n        <div class=\"plugin-shortcodes\">\n            <strong>Included Shortcodes:<\/strong>\n            <ul>\n                <li>[wpuf_account]<\/li><li>[wpuf_sub_info]<\/li><li>[wpuf_sub_pack]<\/li><li>[wpuf_form]<\/li><li>[wpuf_edit]<\/li><li>[wpuf-login]<\/li><li>[wpuf-registration]<\/li><li>[wpuf-edit-users]<\/li><li>[wpuf-meta]<\/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\">Wp User Frontend [wpuf_account] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend shortcode &#8216;wpuf_account&#8217; is designed to manage user account sections. It checks if the user is logged in, fetches the active tab, and initiates the account sections. \n\n\n\nIt then identifies the current section based on the user&#8217;s request. If the user is not logged in, an unauthorized message is displayed. The function ends by returning the content.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf_account]<\/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; Displays the user account section if the user is logged in, otherwise, it shows an unauthorized message.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_account]<\/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>[wpuf_account]<\/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( 'wpuf_account', [ $this, 'shortcode' ] );<\/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 shortcode( $atts ) {\n        \/\/phpcs:ignore\n        extract( shortcode_atts( &#91;], $atts ) );\n\n        ob_start();\n\n        if ( is_user_logged_in() ) {\n            $default_active_tab = wpuf_get_option( &#039;account_page_active_tab&#039;, &#039;wpuf_my_account&#039;, &#039;dashboard&#039; );\n            $section            = isset( $_REQUEST&#91;&#039;section&#039;] ) ? sanitize_text_field( wp_unslash( $_REQUEST&#91;&#039;section&#039;] ) ) : $default_active_tab;\n            $sections           = wpuf_get_account_sections();\n            $current_section    = &#91;];\n\n            foreach ( $sections as $slug =&gt; $label ) {\n                if ( $section === $slug ) {\n                    $current_section = $slug;\n                    break;\n                }\n            }\n\n            wpuf_load_template(\n                &#039;account.php&#039;, &#91;\n                    &#039;sections&#039; =&gt; $sections,\n                    &#039;current_section&#039; =&gt; $current_section,\n                ]\n            );\n        } else {\n            $message = wpuf_get_option( &#039;un_auth_msg&#039;, &#039;wpuf_dashboard&#039; );\n            wpuf_load_template( &#039;unauthorized.php&#039;, &#91; &#039;message&#039; =&gt; $message ] );\n        }\n\n        $content = ob_get_contents();\n        ob_end_clean();\n\n        return $content;\n    }\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\">wp-user-frontend\/wp-user-frontend\/class\/frontend-account.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\">Wp User Frontend [wpuf_sub_info] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend shortcode &#8216;wpuf_sub_info&#8217; retrieves the subscription information for the user. It fetches the user&#8217;s account sections and triggers the &#8216;wpuf_account_content_subscription&#8217; action.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf_sub_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\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; A simple usage of the shortcode to display subscription information.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_sub_info \/]<\/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>[wpuf_sub_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( 'wpuf_sub_info', [ $this, 'subscription_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 subscription_info() {\n        \/\/ _deprecated_function( __FUNCTION__, &#039;2.6.0&#039;, &#039;wpuf_get_user()-&gt;subscription()-&gt;pack_info( $form_id );&#039; );\n        \/\/ wpuf_get_user()-&gt;subscription()-&gt;pack_info( $form_id );\n        $sections = wpuf_get_account_sections();\n        do_action( &#039;wpuf_account_content_subscription&#039;, $sections, &#039;subscription&#039; );\n    }\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\">wp-user-frontend\/wp-user-frontend\/class\/subscription.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\">Wp User Frontend [wpuf_sub_pack] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend shortcode is used to manage subscription packs. \n\n\n\nIt fetches subscription details, checks the user&#8217;s current pack, and provides options to cancel. It also handles subscription-related messages and actions, ensuring a seamless user experience.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf_sub_pack]<\/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 wpuf_sub_pack shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>include<\/code> &#8211; IDs of the subscription packs to include<\/li>\n<li><code>exclude<\/code> &#8211; IDs of the subscription packs to exclude<\/li>\n<li><code>order<\/code> &#8211; Sorting order of the subscription packs, &#8216;ASC&#8217; or &#8216;DESC&#8217;<\/li>\n<li><code>orderby<\/code> &#8211; Parameter to sort the subscription packs by<\/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 the subscription packs available in ascending order.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_sub_pack order=\"ASC\" \/]<\/code><\/pre>\n\n\n<p><strong>Advanced Examples<\/strong><\/p>\n<p>Displays subscription packs in a specific order as per the IDs provided in the &#8216;include&#8217; attribute. The &#8216;include&#8217; attribute takes a comma-separated list of subscription pack IDs.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_sub_pack include=\"1,2,3\" \/]<\/code><\/pre>\n\n\n<p>Excludes certain subscription packs from being displayed using the &#8216;exclude&#8217; attribute. The &#8216;exclude&#8217; attribute takes a comma-separated list of subscription pack IDs.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_sub_pack exclude=\"4,5\" \/]<\/code><\/pre>\n\n\n<p>Displays subscription packs in a specific order based on the &#8216;orderby&#8217; attribute. The &#8216;orderby&#8217; attribute can take values such as &#8216;title&#8217;, &#8216;date&#8217;, &#8216;ID&#8217;, etc. In this example, the packs are ordered by their title in ascending order.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_sub_pack orderby=\"title\" order=\"ASC\" \/]<\/code><\/pre>\n\n\n<p>Combining multiple attributes to display subscription packs in a specific order, excluding certain packs, and ordering them by their title.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_sub_pack include=\"1,2,3\" exclude=\"4,5\" orderby=\"title\" 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>[wpuf_sub_pack]<\/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( 'wpuf_sub_pack', [ $this, 'subscription_packs' ] );<\/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 subscription_packs( $atts = null ) {\n        \/\/$cost_per_post = isset( $form_settings&#91;&#039;pay_per_post_cost&#039;] ) ? $form_settings&#91;&#039;pay_per_post_cost&#039;] : 0;\n\n        $action   = isset( $_GET&#91;&#039;action&#039;] ) ? sanitize_text_field( wp_unslash( $_GET&#91;&#039;action&#039;] ) ) : &#039;&#039;;\n        $pack_msg = isset( $_GET&#91;&#039;pack_msg&#039;] ) ? sanitize_text_field( wp_unslash( $_GET&#91;&#039;pack_msg&#039;] ) ) : &#039;&#039;;\n        $ppp_msg  = isset( $_GET&#91;&#039;ppp_msg&#039;] ) ? sanitize_text_field( wp_unslash( $_GET&#91;&#039;ppp_msg&#039;] ) ) : &#039;&#039;;\n\n        $defaults = &#91;\n            &#039;include&#039; =&gt; &#039;&#039;,\n            &#039;exclude&#039; =&gt; &#039;&#039;,\n            &#039;order&#039;   =&gt; &#039;&#039;,\n            &#039;orderby&#039; =&gt; &#039;&#039;,\n        ];\n\n        $arranged = &#91;];\n        $args     = wp_parse_args( $atts, $defaults );\n\n        if ( $args&#91;&#039;include&#039;] !== &#039;&#039; ) {\n            $pack_order = explode( &#039;,&#039;, $args&#91;&#039;include&#039;] );\n        } else {\n            $args&#91;&#039;order&#039;] = isset( $args&#91;&#039;order&#039;] ) ? $args&#91;&#039;order&#039;] : &#039;ASC&#039;;\n        }\n\n        $packs = $this-&gt;get_subscriptions( $args );\n\n        $details_meta = $this-&gt;get_details_meta_value();\n\n        ob_start();\n\n        if ( $action === &#039;wpuf_paypal_success&#039; ) {\n            printf( &#039;&lt;h1&gt;%1$s&lt;\/h1&gt;&lt;p&gt;%2$s&lt;\/p&gt;&#039;, esc_html( __( &#039;Payment is complete&#039;, &#039;wp-user-frontend&#039; ) ), esc_html( __( &#039;Congratulations, your payment has been completed!&#039;, &#039;wp-user-frontend&#039; ) ) );\n        }\n\n        if ( $pack_msg === &#039;buy_pack&#039; ) {\n            esc_html_e( &#039;Please buy a subscription pack to post&#039;, &#039;wp-user-frontend&#039; );\n        }\n\n        if ( $ppp_msg === &#039;pay_per_post&#039; ) {\n            esc_html_e( &#039;Please buy a subscription pack to post&#039;, &#039;wp-user-frontend&#039; );\n        }\n\n        $current_pack = self::get_user_pack( get_current_user_id() );\n\n        if (\n            isset( $current_pack&#91;&#039;pack_id&#039;] ) &amp;&amp;\n            ! empty( $current_pack&#91;&#039;pack_id&#039;] ) &amp;&amp;\n            isset( $current_pack&#91;&#039;status&#039;] ) &amp;&amp;\n            $current_pack&#91;&#039;status&#039;] === &#039;completed&#039;\n         ) {\n            global $wpdb;\n\n            $user_id         = get_current_user_id();\n            $payment_gateway = $wpdb-&gt;get_var( $wpdb-&gt;prepare( &quot;SELECT payment_type FROM {$wpdb-&gt;prefix}wpuf_transaction WHERE user_id = %s AND status = &#039;completed&#039; ORDER BY created DESC&quot;, $user_id ) );\n\n            $payment_gateway = strtolower( $payment_gateway );\n            ?&gt;\n\n            &lt;?php echo wp_kses_post( __( &#039;&lt;p&gt;&lt;i&gt;You have a subscription pack activated. &lt;\/i&gt;&lt;\/p&gt;&#039;, &#039;wp-user-frontend&#039; ) ); ?&gt;\n            &lt;?php \/* translators: %s: pack title *\/ ?&gt;\n            &lt;?php echo sprintf( wp_kses_post( __( &#039;&lt;p&gt;&lt;i&gt;Pack name: %s &lt;\/i&gt;&lt;\/p&gt;&#039;, &#039;wp-user-frontend&#039; ) ), esc_html( get_the_title( $current_pack&#91;&#039;pack_id&#039;] ) ) ); ?&gt;\n\n            &lt;?php echo &#039;&lt;p&gt;&lt;i&gt;&#039; . esc_html__( &#039;To cancel the pack, press the following cancel button&#039;, &#039;wp-user-frontend&#039; ) . &#039;&lt;\/i&gt;&lt;\/p&gt;&#039;; ?&gt;\n\n            &lt;form action=&quot;&quot; id=&quot;wpuf_cancel_subscription&quot; method=&quot;post&quot;&gt;\n                &lt;?php wp_nonce_field( &#039;wpuf-sub-cancel&#039; ); ?&gt;\n                &lt;input type=&quot;hidden&quot; name=&quot;user_id&quot; value=&quot;&lt;?php echo esc_attr( get_current_user_id() ); ?&gt;&quot;&gt;\n                &lt;input type=&quot;hidden&quot; name=&quot;gateway&quot; value=&quot;&lt;?php echo esc_attr( $payment_gateway ); ?&gt;&quot;&gt;\n                &lt;input type=&quot;hidden&quot; name=&quot;wpuf_cancel_subscription&quot; value=&quot;Cancel&quot;&gt;\n                &lt;input type=&quot;submit&quot; name=&quot;wpuf_user_subscription_cancel&quot; class=&quot;btn btn-sm btn-danger&quot; value=&quot;&lt;?php esc_html_e( &#039;Cancel&#039;, &#039;wp-user-frontend&#039; ); ?&gt;&quot;&gt;\n            &lt;\/form&gt;\n            &lt;?php\n        }\n\n        wpuf_load_template(\n            &#039;subscriptions\/listing.php&#039;, apply_filters(\n                &#039;wpuf_subscription_listing_args&#039;, &#91;\n                    &#039;subscription&#039; =&gt; $this,\n                    &#039;args&#039;         =&gt; $args,\n                    &#039;packs&#039;        =&gt; $packs,\n                    &#039;pack_order&#039;   =&gt; isset( $pack_order ) ? $pack_order : &#039;&#039;,\n                    &#039;details_meta&#039; =&gt; $details_meta,\n                    &#039;current_pack&#039; =&gt; $current_pack,\n                ]\n            )\n        );\n\n        $contents = ob_get_clean();\n\n        return apply_filters( &#039;wpuf_subscription_packs&#039;, $contents, $packs );\n    }\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\">wp-user-frontend\/wp-user-frontend\/class\/subscription.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\">Wp User Frontend [wpuf_form] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;wpuf_form&#8217; shortcode from the WP User Frontend plugin is designed to generate and display a form on your WordPress site. \n\n\n\nIt fetches form fields and settings based on the ID provided, checks if the user can post, and renders the form. If the user can&#8217;t post, it displays a notice.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf_form]<\/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 wpuf_form shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>id<\/code> &#8211; The unique number for each form created.<\/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 user frontend form using the form&#8217;s ID<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_form id=1 \/]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Displaying a user frontend form by referencing the form&#8217;s ID. If the form is not found by ID, it will display a message to the user.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_form id=2 \/]<\/code><\/pre>\n\n\n<p>Displaying a user frontend form by referencing the form&#8217;s ID and adding custom attributes. These attributes can be used to add additional functionality or customizations to the form.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_form id=3 attr1='value1' attr2='value2' \/]<\/code><\/pre>\n\n\n<p>Note: Replace &#8216;attr1&#8217; and &#8216;attr2&#8217; with the actual attribute names and &#8216;value1&#8217; and &#8216;value2&#8217; with the actual values you want to use. The &#8216;id&#8217; should be replaced with the actual form ID.<\/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>[wpuf_form]<\/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( 'wpuf_form', [ $this, 'add_post_shortcode' ] );<\/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 add_post_shortcode( $atts ) {\n        add_filter( &#039;wpuf-form-fields&#039;, &#91; $this, &#039;add_field_settings&#039; ] );\n\n        \/\/ @codingStandardsIgnoreStart\n        extract( shortcode_atts( &#91; &#039;id&#039; =&gt; 0 ], $atts ) );\n\n        \/\/ @codingStandardsIgnoreEnd\n        ob_start();\n        $form                         = new WPUF_Form( $id );\n        $this-&gt;form_fields            = $form-&gt;get_fields();\n        $this-&gt;form_settings          = $form-&gt;get_settings();\n        $this-&gt;generate_auth_link(); \/\/ Translate tag %login% %registration% to login registartion url\n        &#91; $user_can_post, $info ] = $form-&gt;is_submission_open( $form, $this-&gt;form_settings );\n        $info                         = apply_filters( &#039;wpuf_addpost_notice&#039;, $info, $id, $this-&gt;form_settings );\n        $user_can_post                = apply_filters( &#039;wpuf_can_post&#039;, $user_can_post, $id, $this-&gt;form_settings );\n\n        if ( $user_can_post === &#039;yes&#039; ) {\n            $this-&gt;render_form( $id, null, $atts, $form );\n        } else {\n            echo wp_kses_post( &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . $info . &#039;&lt;\/div&gt;&#039; );\n        }\n        $content = ob_get_contents();\n        ob_end_clean();\n\n        return $content;\n    }\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\">wp-user-frontend\/wp-user-frontend\/includes\/class-frontend-form-post.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\">Wp User Frontend [wpuf_edit] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The &#8216;wpuf_edit&#8217; shortcode from the WP User Frontend plugin allows users to edit their posts. It checks if a user is logged in, validates the post ID, and verifies edit permissions. If all checks pass, it renders the edit form.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf_edit]<\/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 wpuf_edit shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>id<\/code> &#8211; Identifies the form to be used for editing<\/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 basic usage of the wpuf_edit shortcode that allows editing of a post with a specific ID.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=2 \/]<\/code><\/pre>\n\n\n<p>Advanced examples<\/p>\n<p>Using the shortcode to edit a post by referencing the post ID. If the user is not logged in, it will display a login form.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=3 \/]<\/code><\/pre>\n\n\n<p>Using the shortcode to edit a post by referencing the post ID. If the user is not logged in or does not have the necessary permissions to edit the post, it will display an appropriate message.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=4 \/]<\/code><\/pre>\n\n\n<p>Using the shortcode to edit a post by referencing the post ID. If the post does not exist, it will display an error message.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=5 \/]<\/code><\/pre>\n\n\n<p>Using the shortcode to edit a post by referencing the post ID. If the post is locked for editing by an administrator, it will display a lock notice.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=6 \/]<\/code><\/pre>\n\n\n<p>Using the shortcode to edit a post by referencing the post ID. If the post is pending and editing is disabled, it will display a notice.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=7 \/]<\/code><\/pre>\n\n\n<p>Using the shortcode to edit a post by referencing the post ID. If the post is published and editing is disabled, it will display a notice.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf_edit id=8 \/]<\/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>[wpuf_edit]<\/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( 'wpuf_edit', [ $this, 'edit_post_shortcode' ] );<\/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 edit_post_shortcode( $atts ) {\n        add_filter( &#039;wpuf-form-fields&#039;, &#91; $this, &#039;add_field_settings&#039; ] );\n        \/\/ @codingStandardsIgnoreStart\n        extract( shortcode_atts( &#91; &#039;id&#039; =&gt; 0 ], $atts ) );\n\n        \/\/ @codingStandardsIgnoreEnd\n        ob_start();\n\n        global $userdata;\n\n        ob_start();\n\n        if ( ! is_user_logged_in() ) {\n            echo wp_kses_post( &#039;&lt;div class=&quot;wpuf-message&quot;&gt;&#039; . __( &#039;You are not logged in&#039;, &#039;wp-user-frontend&#039; ) . &#039;&lt;\/div&gt;&#039; ),\n\n            wp_login_form();\n\n            return;\n        }\n\n        $post_id = isset( $_GET&#91;&#039;pid&#039;] ) ? intval( wp_unslash( $_GET&#91;&#039;pid&#039;] ) ) : 0;\n\n        if ( ! $post_id ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &#039;Invalid post&#039;, &#039;wp-user-frontend&#039; ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        $edit_post_lock      = get_post_meta( $post_id, &#039;_wpuf_lock_editing_post&#039;, true );\n        $edit_post_lock_time = get_post_meta( $post_id, &#039;_wpuf_lock_user_editing_post_time&#039;, true );\n\n        if ( $edit_post_lock === &#039;yes&#039; ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . apply_filters( &#039;wpuf_edit_post_lock_user_notice&#039;, __( &#039;Your edit access for this post has been locked by an administrator.&#039;, &#039;wp-user-frontend&#039; ) ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        if ( ! empty( $edit_post_lock_time ) &amp;&amp; $edit_post_lock_time &lt; time() ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . apply_filters( &#039;wpuf_edit_post_lock_expire_notice&#039;, __( &#039;Your allocated time for editing this post has been expired.&#039;, &#039;wp-user-frontend&#039; ) ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        if ( wpuf_get_user()-&gt;edit_post_locked() ) {\n            if ( wpuf_get_user()-&gt;edit_post_lock_reason() ) {\n                return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . wpuf_get_user()-&gt;edit_post_lock_reason() . &#039;&lt;\/div&gt;&#039;;\n            }\n\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . apply_filters( &#039;wpuf_user_edit_post_lock_notice&#039;, __( &#039;Your post edit access has been locked by an administrator.&#039;, &#039;wp-user-frontend&#039; ) ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        \/\/is editing enabled?\n        if ( wpuf_get_option( &#039;enable_post_edit&#039;, &#039;wpuf_dashboard&#039;, &#039;yes&#039; ) !== &#039;yes&#039; ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &#039;Post Editing is disabled&#039;, &#039;wp-user-frontend&#039; ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        $curpost = get_post( $post_id );\n\n        if ( ! $curpost ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &#039;Invalid post&#039;, &#039;wp-user-frontend&#039; );\n        }\n\n        \/\/ has permission?\n        if ( ! current_user_can( &#039;delete_others_posts&#039; ) &amp;&amp; ( $userdata-&gt;ID !== (int) $curpost-&gt;post_author ) ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &#039;You are not allowed to edit&#039;, &#039;wp-user-frontend&#039; ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        $form_id = get_post_meta( $post_id, self::$config_id, true );\n\n        \/\/ fallback to default form\n        if ( ! $form_id ) {\n            $form_id = wpuf_get_option( &#039;default_post_form&#039;, &#039;wpuf_frontend_posting&#039; );\n        }\n\n        if ( ! $form_id ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &quot;I don&#039;t know how to edit this post, I don&#039;t have the form ID&quot;, &#039;wp-user-frontend&#039; ) . &#039;&lt;\/div&gt;&#039;;\n        }\n\n        $form = new WPUF_Form( $form_id );\n\n        $this-&gt;form_fields = $form-&gt;get_fields();\n        \/\/ $form_settings = wpuf_get_form_settings( $form_id );\n        $this-&gt;form_settings = $form-&gt;get_settings();\n\n        $disable_pending_edit = wpuf_get_option( &#039;disable_pending_edit&#039;, &#039;wpuf_dashboard&#039;, &#039;on&#039; );\n        $disable_publish_edit = wpuf_get_option( &#039;disable_publish_edit&#039;, &#039;wpuf_dashboard&#039;, &#039;off&#039; );\n\n        if ( &#039;pending&#039; === $curpost-&gt;post_status &amp;&amp; &#039;on&#039; === $disable_pending_edit ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &#039;You can\\&#039;t edit a post while in pending mode.&#039;, &#039;wp-user-frontend&#039; );\n        }\n\n        if ( &#039;publish&#039; === $curpost-&gt;post_status &amp;&amp; &#039;off&#039; !== $disable_publish_edit ) {\n            return &#039;&lt;div class=&quot;wpuf-info&quot;&gt;&#039; . __( &#039;You\\&#039;re not allowed to edit this post.&#039;, &#039;wp-user-frontend&#039; );\n        }\n\n        $msg = isset( $_GET&#91;&#039;msg&#039;] ) ? sanitize_text_field( wp_unslash( $_GET&#91;&#039;msg&#039;] ) ) : &#039;&#039;;\n\n        if ( $msg === &#039;post_updated&#039; ) {\n            echo wp_kses_post( &#039;&lt;div class=&quot;wpuf-success&quot;&gt;&#039; );\n            echo wp_kses_post( str_replace( &#039;%link%&#039;, get_permalink( $post_id ), $this-&gt;form_settings&#91;&#039;update_message&#039;] ) );\n            echo wp_kses_post( &#039;&lt;\/div&gt;&#039; );\n        }\n\n        $this-&gt;render_form( $form_id, $post_id, $atts, $form );\n\n        $content = ob_get_contents();\n\n        ob_end_clean();\n\n        return $content;\n    }\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\">wp-user-frontend\/wp-user-frontend\/includes\/class-frontend-form-post.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\">Wp User Frontend [wpuf-login] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend Login shortcode is used for rendering a login form. It checks if a user is logged in, and displays corresponding templates.\n\n\n\nThis shortcode executes the &#8216;login_form&#8217; function, which handles different login scenarios. It sanitizes GET parameters, loads templates based on user status, and provides feedback messages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf-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\">Examples and Usage<\/h3>\n\n\n<p><strong>Basic example<\/strong> &#8211; The shortcode below will display a login form.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-login \/]<\/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>[wpuf-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( 'wpuf-login', [ $this, 'login_form' ] );<\/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 login_form() {\n        $getdata = wp_unslash( $_GET );\n\n        $login_page = $this-&gt;get_login_url();\n        $reset = isset( $getdata&#91;&#039;reset&#039;] ) ? sanitize_text_field( $getdata&#91;&#039;reset&#039;] ) : &#039;&#039;;\n\n        if ( false === $login_page ) {\n            return;\n        }\n\n        ob_start();\n\n        if ( is_user_logged_in() ) {\n            wpuf_load_template(\n                &#039;logged-in.php&#039;, &#91;\n                    &#039;user&#039; =&gt; wp_get_current_user(),\n                ]\n            );\n        } else {\n            $action = isset( $getdata&#91;&#039;action&#039;] ) ? sanitize_text_field( $getdata&#91;&#039;action&#039;] ) : &#039;login&#039;;\n\n            $args = &#91;\n                &#039;action_url&#039;  =&gt; $login_page,\n                &#039;redirect_to&#039; =&gt; isset( $getdata&#91;&#039;redirect_to&#039;] ) ? $getdata&#91;&#039;redirect_to&#039;] : &#039;&#039;,\n            ];\n\n            switch ( $action ) {\n                case &#039;lostpassword&#039;:\n                    $checkemail = isset( $getdata&#91;&#039;checkemail&#039;] ) ? sanitize_text_field( $getdata&#91;&#039;checkemail&#039;] ) : &#039;&#039;;\n\n                    if ( &#039;confirm&#039; === $checkemail ) {\n                        $this-&gt;messages&#91;] = __( &#039;Check your e-mail for the confirmation link.&#039;, &#039;wp-user-frontend&#039; );\n                    }\n\n                    if ( ! $checkemail ) {\n                        $this-&gt;messages&#91;] = __( &#039;Please enter your username or email address. You will receive a link to create a new password via email.&#039;, &#039;wp-user-frontend&#039; );\n                    }\n\n                    wpuf_load_template( &#039;lost-pass-form.php&#039;, $args );\n                    break;\n\n                case &#039;rp&#039;:\n                case &#039;resetpass&#039;:\n                    if ( $reset === &#039;true&#039; ) {\n                        $this-&gt;messages&#91;] = __( &#039;Your password has been reset successfully&#039;, &#039;wp-user-frontend&#039; );\n\n                        wpuf_load_template( &#039;login-form.php&#039;, $args );\n\n                        break;\n                    } else {\n                        $this-&gt;messages&#91;] = __( &#039;Enter your new password below.&#039;, &#039;wp-user-frontend&#039; );\n\n                        wpuf_load_template( &#039;reset-pass-form.php&#039;, $args );\n                    }\n\n                    break;\n\n                default:\n                    $loggedout = isset( $getdata&#91;&#039;loggedout&#039;] ) ? sanitize_text_field( $getdata&#91;&#039;loggedout&#039;] ) : &#039;&#039;;\n\n                    if ( $loggedout === &#039;true&#039; ) {\n                        $this-&gt;messages&#91;] = __( &#039;You are now logged out.&#039;, &#039;wp-user-frontend&#039; );\n                    }\n\n                    $args&#91;&#039;redirect_to&#039;] = $this-&gt;get_login_redirect_link( $args&#91;&#039;redirect_to&#039;] );\n\n                    wpuf_load_template( &#039;login-form.php&#039;, $args );\n\n                    break;\n            }\n        }\n\n        return ob_get_clean();\n    }\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\">wp-user-frontend\/wp-user-frontend\/includes\/free\/class-login.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\">Wp User Frontend [wpuf-registration] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend shortcode &#8216;wpuf-registration&#8217; facilitates the registration process. It first checks if a user is logged in. If so, it loads the &#8216;logged-in.php&#8217; template. \n\nIf not, it sanitizes query parameters, encodes the user role, and loads the &#8216;registration-form.php&#8217; template with the necessary arguments.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf-registration]<\/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 wpuf-registration shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>role<\/code> &#8211; specifies the role to be assigned to the registering user<\/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 the registration form with the default user role.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-registration]<\/code><\/pre>\n\n\n<p>Advanced examples:<\/p>\n<p>Display the registration form with a specific user role. In the example below, the user role is set to &#8216;subscriber&#8217;.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-registration role='subscriber']<\/code><\/pre>\n\n\n<p>Display the registration form with a custom user role. In the example below, the user role is set to &#8216;custom_role&#8217;.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-registration role='custom_role']<\/code><\/pre>\n\n\n<p>You can also use the shortcode within PHP code by using the do_shortcode function. This method allows you to display the registration form directly within your theme files.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php echo do_shortcode(\"[wpuf-registration role='custom_role']\"); ?&gt;<\/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>[wpuf-registration]<\/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( 'wpuf-registration', [ $this, 'registration_form' ] );<\/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 registration_form( $atts ) {\n        $atts = shortcode_atts(\n            &#91;\n                &#039;role&#039; =&gt; &#039;&#039;,\n            ], $atts\n        );\n        $userrole = $atts&#91;&#039;role&#039;];\n\n        $user_nonce  = base64_encode( random_bytes( WPUF_Encryption_Helper::get_encryption_nonce_length() ) );\n        $roleencoded = wpuf_encryption( $userrole, $user_nonce );\n\n        $reg_page = $this-&gt;get_registration_url();\n\n        if ( false === $reg_page ) {\n            return;\n        }\n\n        ob_start();\n\n        if ( is_user_logged_in() ) {\n            wpuf_load_template(\n                &#039;logged-in.php&#039;, &#91;\n                    &#039;user&#039; =&gt; wp_get_current_user(),\n                ]\n            );\n        } else {\n            $queries = wp_unslash( $_GET );\n\n            array_walk(\n                $queries, function ( &amp;$a ) {\n                    $a = sanitize_text_field( $a );\n                }\n            );\n\n            $args = &#91;\n                &#039;action_url&#039; =&gt; add_query_arg( $queries, $reg_page ),\n                &#039;userrole&#039;   =&gt; $roleencoded,\n                &#039;user_nonce&#039; =&gt; $user_nonce,\n            ];\n\n            wpuf_load_template( &#039;registration-form.php&#039;, $args );\n        }\n\n        return ob_get_clean();\n    }\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\">wp-user-frontend\/wp-user-frontend\/includes\/free\/class-registration.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\">Wp User Frontend [wpuf-edit-users] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend shortcode is designed to edit users&#8217; profiles. It checks if a user is logged in and has the required permissions. \n\n\n\nIf conditions are met, it gets the user&#8217;s data and performs actions based on the &#8216;action&#8217; parameter. If &#8216;action&#8217; equals &#8216;edit&#8217;, it displays the edit profile form if the user exists. If &#8216;action&#8217; equals &#8216;wpuf_add_user&#8217;, it adds a new user. By default, it displays all users. If the user doesn&#8217;t have the required permissions or is not logged in, it returns an error message.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf-edit-users]<\/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; A simple usage of the shortcode to allow users with necessary permissions to edit user profiles.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-edit-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>[wpuf-edit-users]<\/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( 'wpuf-edit-users', 'wpuf_edit_users' );<\/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 wpuf_edit_users() {\n    ob_start();\n\n    \/\/ if user is logged in\n    if ( is_user_logged_in() ) {\n\n        \/\/this user can edit the users\n        if ( current_user_can( &#039;edit_users&#039; ) ) {\n            $action   = isset( $_GET&#91;&#039;action&#039;] ) ? sanitize_text_field( wp_unslash( $_GET&#91;&#039;action&#039;] ) ) : &#039;show&#039;;\n            $user_id  = isset( $_GET&#91;&#039;user_id&#039;] ) ? intval( wp_unslash( $_GET&#91;&#039;user_id&#039;] ) ) : 0;\n            $userdata = get_userdata( $user_id );\n\n            switch ( $action ) {\n                case &#039;edit&#039;:\n                    \/\/if user exists\n                    if ( $user_id &amp;&amp; $userdata ) {\n                        if ( ! empty( wpuf()-&gt;free_loader-&gt;edit_profile ) ) {\n                            wpuf()-&gt;free_loader-&gt;edit_profile-&gt;show_form( $user_id );\n                        } else {\n                            printf( esc_html( __( &quot;User doesn&#039;t exists&quot;, &#039;wp-user-frontend&#039; ) ) );\n                        }\n                    } else {\n                        printf( esc_html( __( &quot;User doesn&#039;t exists&quot;, &#039;wp-user-frontend&#039; ) ) );\n                    }\n                    break;\n\n                case &#039;wpuf_add_user&#039;:\n                    wpuf_add_user();\n                    break;\n\n                default: wpuf_show_users();\n            }\n        } else { \/\/ user don&#039;t have any permission\n            printf( esc_html( __( &quot;You don&#039;t have permission for this purpose&quot;, &#039;wp-user-frontend&#039; ) ) );\n        }\n    } else { \/\/user is not logged in\n        printf( esc_html( __( &#039;This page is restricted. Please %s to view this page.&#039;, &#039;wp-user-frontend&#039; ) ), wp_loginout( &#039;&#039;, false ) );\n    }\n\n    return ob_get_clean();\n}\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\">wp-user-frontend\/wp-user-frontend\/includes\/free\/edit-user.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\">Wp User Frontend [wpuf-meta] Shortcode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The WP User Frontend shortcode &#8216;wpuf-meta&#8217; allows users to display custom meta data in posts. It supports different types such as image, file, map, repeat, and normal. \n\n.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Shortcode<\/strong>: <code>[wpuf-meta]<\/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 wpuf-meta shortcode parameters and attributes:<\/p>\n\n\n<ul>\n<li><code>name<\/code> &#8211; Defines the meta key of the post meta field.<\/li>\n<li><code>type<\/code> &#8211; Specifies the type of the field like image, file, map, repeat or normal.<\/li>\n<li><code>size<\/code> &#8211; Determines the size of the thumbnail if the type is image.<\/li>\n<li><code>width<\/code> &#8211; Sets the width of the map if the type is map.<\/li>\n<li><code>height<\/code> &#8211; Sets the height of the map if the type is map.<\/li>\n<li><code>zoom<\/code> &#8211; Sets the zoom level of the map if the type is map.<\/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 a normal meta field using the shortcode. In this example, the &#8216;name&#8217; attribute refers to the meta key of the post.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-meta name=\"my_meta_key\" \/]<\/code><\/pre>\n\n\n<p><strong>Advanced examples<\/strong><\/p>\n<p>Displaying an image or file field using the shortcode. The &#8216;name&#8217; attribute refers to the meta key, and the &#8216;type&#8217; attribute should be set to either &#8216;image&#8217; or &#8216;file&#8217;.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-meta name=\"my_image_key\" type=\"image\" \/]<\/code><\/pre>\n\n\n<p>Displaying a map field using the shortcode. The &#8216;name&#8217; attribute refers to the meta key, and the &#8216;type&#8217; attribute should be set to &#8216;map&#8217;. The &#8216;width&#8217;, &#8216;height&#8217;, and &#8216;zoom&#8217; attributes can be used to customize the map.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-meta name=\"my_map_key\" type=\"map\" width=\"500\" height=\"300\" zoom=\"14\" \/]<\/code><\/pre>\n\n\n<p>Displaying a repeating field using the shortcode. The &#8216;name&#8217; attribute refers to the meta key, and the &#8216;type&#8217; attribute should be set to &#8216;repeat&#8217;.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-meta name=\"my_repeat_key\" type=\"repeat\" \/]<\/code><\/pre>\n\n\n<p>Displaying a clickable meta field using the shortcode. The &#8216;name&#8217; attribute refers to the meta key, and any other value for the &#8216;type&#8217; attribute will result in a clickable meta field.<\/p>\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">[wpuf-meta name=\"my_clickable_key\" type=\"clickable\" \/]<\/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>[wpuf-meta]<\/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( 'wpuf-meta', 'wpuf_meta_shortcode' );<\/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 wpuf_meta_shortcode( $atts ) {\n    global $post;\n\n    $attrs = shortcode_atts(\n        &#91;\n            &#039;name&#039;   =&gt; &#039;&#039;,\n            &#039;type&#039;   =&gt; &#039;normal&#039;,\n            &#039;size&#039;   =&gt; &#039;thumbnail&#039;,\n            &#039;height&#039; =&gt; 250,\n            &#039;width&#039;  =&gt; 450,\n            &#039;zoom&#039;   =&gt; 12,\n        ], $atts\n    );\n\n    $name   = $attrs&#91;&#039;name&#039;];\n    $type   = $attrs&#91;&#039;type&#039;];\n    $size   = $attrs&#91;&#039;size&#039;];\n    $width  = $attrs&#91;&#039;width&#039;];\n    $height = $attrs&#91;&#039;height&#039;];\n    $zoom   = $attrs&#91;&#039;zoom&#039;];\n\n    if ( empty( $name ) ) {\n        return;\n    }\n\n    if ( &#039;image&#039; === $type || &#039;file&#039; === $type ) {\n        $images = get_post_meta( $post-&gt;ID, $name, true );\n\n        if ( ! is_array( $images ) ) {\n            $images = (array) $images;\n        }\n\n        if ( $images ) {\n            $html = &#039;&#039;;\n\n            foreach ( $images as $attachment_id ) {\n                if ( &#039;image&#039; === $type ) {\n                    $thumb = wp_get_attachment_image( $attachment_id, $size );\n                } else {\n                    $thumb = get_post_field( &#039;post_title&#039;, $attachment_id );\n                }\n\n                $full_size = wp_get_attachment_url( $attachment_id );\n                $html      .= sprintf( &#039;&lt;a href=&quot;%s&quot;&gt;%s&lt;\/a&gt; &#039;, $full_size, $thumb );\n            }\n\n            return $html;\n        }\n    } elseif ( &#039;map&#039; === $type ) {\n        ob_start();\n        wpuf_shortcode_map(\n            $name, $post-&gt;ID, &#91;\n                &#039;width&#039; =&gt; $width,\n                &#039;height&#039; =&gt; $height,\n                &#039;zoom&#039; =&gt; $zoom,\n            ]\n        );\n\n        return ob_get_clean();\n    } elseif ( &#039;repeat&#039; === $type ) {\n        return implode( &#039;; &#039;, get_post_meta( $post-&gt;ID, $name ) );\n    } elseif ( &#039;normal&#039; === $type ) {\n        return implode( &#039;, &#039;, get_post_meta( $post-&gt;ID, $name ) );\n    } else {\n        return make_clickable( implode( &#039;, &#039;, get_post_meta( $post-&gt;ID, $name ) ) );\n    }\n}\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\">wp-user-frontend\/wp-user-frontend\/wpuf-functions.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>Wp User Frontend 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 Wp User Frontend 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 Wp User Frontend Plugin shortcodes not to show or not to work correctly. Before starting, here is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"name":"WP User Frontend &#8211; Registration, User Profile, Membership, Content Restriction, User Directory, and Frontend Post Submission Plugin","slug":"","version":"3.6.9","author":"<a href=\"https:\/\/wedevs.com\/?utm_source=WPUF_Author_URI\">weDevs<\/a>","icons":"https:\/\/ps.w.org\/wp-user-frontend\/assets\/icon-128x128.gif?rev=2818776","plugin_tags":"{\"content-restriction\":\"content restriction\",\"frontend-post\":\"frontend post\",\"membership\":\"membership\",\"registration\":\"registration\",\"user-profile\":\"user profile\"}","author_profile":"https:\/\/profiles.wordpress.org\/tareq1988\/","requires":"4.0","tested":"6.3.2","requires_php":"5.6","rating":84,"num_ratings":476,"active_installs":20000,"downloaded":1358790,"last_updated":"2023-09-11 11:46am GMT","added":"2011-01-10","homepage":"https:\/\/wordpress.org\/plugins\/wp-user-frontend\/","short_description":"Get frontend post, content access &amp; restriction, user login &amp; registration, subscription &amp; membership, form builder, user directory &amp;  &hellip;","description":"\"WP User Frontend is a comprehensive plugin that provides user registration, profile creation, membership management, content restriction, user directory, and frontend post submission capabilities.\"","shortcodes":"[\"wpuf_account\",\"wpuf_sub_info\",\"wpuf_sub_pack\",\"wpuf_form\",\"wpuf_edit\",\"wpuf-login\",\"wpuf-registration\",\"wpuf-edit-users\",\"wpuf-meta\"]","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1014","post","type-post","status-publish","format-standard","hentry","category-plugins"],"_links":{"self":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1014","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=1014"}],"version-history":[{"count":1,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1014\/revisions"}],"predecessor-version":[{"id":1096,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/posts\/1014\/revisions\/1096"}],"wp:attachment":[{"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/media?parent=1014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/categories?post=1014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpshortcode.org\/wp-json\/wp\/v2\/tags?post=1014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}