WP Recall Shortcodes

Below, you’ll find a detailed guide on how to add the Wp Recall Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Wp Recall Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Wp Recall Plugin and the shortcodes it provides:

Plugin Icon
WP-Recall – Registration, Profile, Commerce & More

"WP-Recall is a versatile WordPress plugin that simplifies registration, profile management, and commerce activities. This all-in-one solution offers extensive functionality to streamline your site management tasks."

★★★★✩ (102) Active Installs: 3000+ Tested with: 6.2.3 PHP Version: 7.0
Included Shortcodes:
  • [minibasket]
  • [basket]
  • [productlist]
  • [rcl_get_feed_list]
  • [grouplist]
  • [spoiler]
  • [offtop]
  • [prime-forum]
  • [prime-posts]
  • [public-form]
  • [ratinglist]
  • [rcl-chat]
  • [rcl-pay-form]
  • [rcl-form-balance]
  • [rcl-usercount]
  • [loginform]
  • [wp-recall]
  • [userlist]
  • [rcl-cache]
  • [rcl-tab]

Wp Recall [minibasket] Shortcode

The WP-Recall plugin shortcode ‘minibasket’ is used to display a mini version of the shopping cart. The PHP function ‘rcl_get_mini_cart()’ retrieves the mini cart template ‘cart-mini.php’. This allows users to view their cart items in a compact form.

Shortcode: [minibasket]

Examples and Usage

Basic example – Displays a mini shopping cart on your website. The cart will show the items currently in the user’s cart.

[minibasket /]

Advanced examples

Although the ‘minibasket’ shortcode does not have any parameters, you can get creative and use it in conjunction with other shortcodes or widgets to create a more dynamic shopping experience. For example, you could use it with a conditional shortcode to only display the mini cart when there are items in it.

[if_cart_not_empty][minibasket /][/if_cart_not_empty]

Or you could use it with a modal window shortcode to create a pop-up mini cart that appears when a user adds an item to their cart.

[modal_on_add_to_cart][minibasket /][/modal_on_add_to_cart]

Note: The above examples assume the existence of ‘if_cart_not_empty’ and ‘modal_on_add_to_cart’ shortcodes or similar functionality. You may need to create or install additional plugins to use these features.

PHP Function Code

In case you have difficulties debugging what causing issues with [minibasket] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'minibasket', 'rcl_get_mini_cart' );

Shortcode PHP function:

                    function rcl_get_mini_cart() {

	return rcl_get_include_template( 'cart-mini.php', __FILE__ );
}
                    

Code file location:

wp-recall/wp-recall/add-on/commerce/shortcodes.php

Wp Recall [basket] Shortcode

The WP-Recall plugin’s ‘basket’ shortcode is used to fetch and display the content of a user’s shopping cart. This shortcode calls the ‘rcl_get_cart’ function which constructs a new instance of the Rcl_Cart_Constructor class and returns the current cart’s content.

Shortcode: [basket]

Examples and Usage

Basic example – The following shortcode displays the content of the user’s cart in a standard layout.

[basket /]

Advanced examples

The following shortcode example demonstrates how to use the ‘basket’ shortcode with a custom array of products. This might be useful if you want to display a custom selection of products in the cart for promotional or marketing purposes.


[basket cartProducts="product1, product2, product3" /]

Another advanced example shows how to use the shortcode with a dynamic parameter. In this case, the ‘cartProducts’ parameter is filled with the return value of a function ‘get_featured_products()’. This function could return an array of featured products, for example.


[basket cartProducts=get_featured_products() /]

Please note that the ‘cartProducts’ parameter expects an array of product IDs. You need to ensure that your custom function or manual input returns or contains valid product IDs.

PHP Function Code

In case you have difficulties debugging what causing issues with [basket] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'basket', 'rcl_get_cart' );

Shortcode PHP function:

                    function rcl_get_cart( $cartProducts = false ) {

	$Cart = new Rcl_Cart_Constructor();

	return $Cart->get_cart( $cartProducts );
}
                    

Code file location:

wp-recall/wp-recall/add-on/commerce/shortcodes.php

Wp Recall [productlist] Shortcode

The WP-Recall plugin shortcode ‘[productlist]’ is designed to generate a dynamic list of products. It pulls data from your product posts and displays it in a user-friendly list format. The shortcode allows customization, including the number of products per page, list type, category inclusion or exclusion, description length, and ordering. It also supports pagination and caching for improved performance.

Shortcode: [productlist]

Parameters

Here is a list of all possible productlist shortcode parameters and attributes:

  • num – Defines the total number of products shown.
  • inpage – Sets the number of products per page.
  • type – Specifies the layout type of the product list.
  • width – Adjusts the width of the product images.
  • cat – Filters products according to specific categories.
  • cat__not_in – Excludes products from specified categories.
  • desc – Sets the maximum length of the product description.
  • tag – Filters products according to specific tags.
  • include – Includes specific products by their IDs.
  • exclude – Excludes specific products by their IDs.
  • orderby – Determines the order of the products by a specific attribute.
  • order – Sets the sorting direction (ascending or descending).
  • author – Filters products according to the author’s ID.
  • switch – Enables or disables the layout switcher.

Examples and Usage

Basic example – Display a product list with default settings

[productlist /]

Advanced examples

Display a product list with 20 products per page, ordered by post title in ascending order, and exclude products from category with ID 5.

[productlist inpage=20 orderby="post_title" order="ASC" cat__not_in=5 /]

Display a product list in grid format, with product images of width 200px, and include only products with IDs 1, 2, and 3.

[productlist type="grid" width=200 include="1,2,3" /]

Show a product list from a specific author (author ID is 10), exclude products with IDs 4,5 and 6, and limit the product description to 100 characters.

[productlist author=10 exclude="4,5,6" desc=100 /]

Display a product list tagged with specific tags (tag IDs are 2 and 3).

[productlist tag="2,3" /]

Show a product list from a specific category (category ID is 4), and switch off the list-to-grid switcher.

[productlist cat=4 switch=0 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [productlist] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'productlist', 'rcl_shortcode_productlist' );

Shortcode PHP function:

                    function rcl_shortcode_productlist( $atts ) {
	global $post, $productlist, $user_ID;
	
	extract( shortcode_atts( array(
		'num'         => false,
		'inpage'      => 10,
		'type'        => 'list',
		'width'       => 150,
		'cat'         => false,
		'cat__not_in' => false,
		'desc'        => 200,
		'tag'         => false,
		'include'     => false,
		'exclude'     => false,
		'orderby'     => 'post_date',
		'order'       => 'DESC',
		'author'      => false,
		'switch'      => 1
	), $atts ) );

	$productlist = $atts;

	$args = array(
		'numberposts' => - 1,
		'author'      => $author,
		'post_type'   => 'products',
		'include'     => $include,
		'fields'      => 'ids'
	);

	if ( $exclude ) {
		$args['post__not_in'] = array_map( 'trim', explode( ',', $exclude ) );
	}

	if ( $cat ) {
		$args['tax_query'][] = array(
			'taxonomy' => 'prodcat',
			'field'    => 'id',
			'terms'    => explode( ',', $cat )
		);
	}

	if ( $cat__not_in ) {
		$args['tax_query'][] = array(
			'taxonomy' => 'prodcat',
			'field'    => 'id',
			'terms'    => explode( ',', $cat__not_in ),
			'operator' => 'NOT IN'
		);
	}

	if ( $tag ) {
		$args['tax_query'][] = array(
			'taxonomy' => 'product_tag',
			'field'    => 'id',
			'terms'    => explode( ',', $tag )
		);
	}

	if ( ! $num ) {
		$count_prod = count( get_posts( $args ) );
	} else {
		$count_prod = false;
		$inpage     = $num;
	}

	$rclnavi = new Rcl_PageNavi( 'rcl-products', $count_prod, array( 'in_page' => intval( $inpage ) ) );

	$args['numberposts'] = $inpage;
	$args['fields']      = '';

	$more_args = array(
		'numberposts' => $inpage,
		'offset'      => $rclnavi->offset,
		'orderby'     => $orderby,
		'order'       => $order
	);

	$args = array_merge( $more_args, $args );

	$rcl_cache = new Rcl_Cache();

	if ( ! $user_ID && $rcl_cache->is_cache ) {

		$file = $rcl_cache->get_file( json_encode( $args ) );

		if ( ! $file->need_update ) {
			return $rcl_cache->get_cache();
		}
	}

	$products = get_posts( $args );

	if ( ! $products ) {
		return false;
	}

	$type_list = ( $switch ) ? $type : $type . ' cancel-switch';

	$prodlist = '<div class="products-box type-' . esc_attr( $type_list ) . '">
                    <div class="products-list">';

	foreach ( $products as $post ) {
		setup_postdata( $post );
		$prodlist .= rcl_get_include_template( 'product-' . sanitize_key( $type ) . '.php', __FILE__, $atts );
	}

	wp_reset_query();

	$prodlist .= '</div>'
	             . '</div>';

	if ( ! $num ) {
		$prodlist .= $rclnavi->pagenavi();
	}

	if ( ! $user_ID && $rcl_cache->is_cache ) {
		$rcl_cache->update_cache( $prodlist );
	}

	return $prodlist;
}
                    

Code file location:

wp-recall/wp-recall/add-on/commerce/shortcodes.php

Wp Recall [rcl_get_feed_list] Shortcode

The WP-Recall plugin shortcode is designed to generate a feed list. It checks if a user is logged in, initializes feed scripts, and sets up pagination. It further fetches feed data, creates a feed box for each feed item, and displays a preloader for AJAX loading. If no news is found, a notice is displayed. Shortcode: [rcl_get_feed_list]

Shortcode: [rcl_get_feed_list]

Parameters

Here is a list of all possible rcl_get_feed_list shortcode parameters and attributes:

  • per_page – defines the number of feed items to display on a single page
  • number – sets the total number of feed items to fetch

Examples and Usage

Basic example – Use the shortcode to display a feed list with default settings

[feed /]

Advanced examples

Display a feed list with a specific number of items per page

[feed per_page=10 /]

Using the shortcode to display a feed list with a specific number of items and custom navigation. The navigation will first try to load the number of items, but if not found, it will display the default number of items.

[feed per_page=10 number=5 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl_get_feed_list] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'feed', 'rcl_get_feed_list' );

Shortcode PHP function:

                    function rcl_get_feed_list( $atts = array() ) {
	global $user_ID, $rcl_feed;

	if ( ! $user_ID ) {
		return apply_filters( 'rcl_feed_no_login_notice', rcl_get_notice( [
			'class' => 'rcl-feed-notice',
			'text'  => __( 'Login or register to view the latest publications and comments from users for which you have subscribed.', 'wp-recall' )
		] ) );
	}

	rcl_feed_scripts_init();

	add_filter( 'rcl_rating_user_can', 'rcl_feed_unset_can_vote', 10 );

	if ( ! $atts ) {
		$atts = array();
	}

	include_once 'classes/class-rcl-feed-list.php';

	$per_page = ( isset( $atts['per_page'] ) ) ? intval( $atts['per_page'] ) : 30;

	$list    = new Rcl_Feed_List( $atts );
	$rclnavi = false;
	if ( ! isset( $atts['number'] ) ) {

		$rclnavi = new Rcl_PageNavi(
			'rcl-feed', $list->count_feed(), array(
				'in_page' => $per_page
			)
		);

		$list->query['offset'] = $rclnavi->offset;
	}

	$content = $list->get_filters();

	$feedsdata = $list->get_feed();

	if ( ! $feedsdata ) {
		return $content . rcl_get_notice( [
				'text' => __( 'No news found.', 'wp-recall' )
			] );
	}

	$load = ( isset( $rclnavi->in_page ) ) ? 'data-load="' . $list->load . '"' : '';

	$content .= '<div id="rcl-feed" data-custom="' . base64_encode( json_encode( $atts ) ) . '" data-feed="' . $list->content . '" ' . $load . '>';

	foreach ( $feedsdata as $rcl_feed ) {
		$list->setup_data( $rcl_feed );
		$content .= '<div id="feed-' . $rcl_feed->feed_type . '-' . $rcl_feed->feed_ID . '" class="feed-box feed-user-' . $rcl_feed->feed_author . ' feed-' . $rcl_feed->feed_type . '">';
		$content .= rcl_get_include_template( 'feed-post.php', __FILE__ );
		$content .= '</div>';
	}

	if ( $list->load == 'ajax' && $rclnavi->in_page ) {
		$content .= '<div id="feed-preloader"><div></div></div>'
		            . '<div id="feed-bottom"></div>';
	}

	$content .= '</div>';

	if ( $list->load == 'pagenavi' && isset( $rclnavi->in_page ) ) {
		$content .= $rclnavi->pagenavi();
	}

	$list->remove_data();

	return $content;
}
                    

Code file location:

wp-recall/wp-recall/add-on/feed/shortcodes.php

Wp Recall [grouplist] Shortcode

The WP-Recall plugin shortcode ‘grouplist’ is designed to retrieve and display a list of groups. It uses the function ‘rcl_get_grouplist’ to generate this list. The function checks if the group output option is enabled and if the current post ID matches the specified group page. If a group exists, it returns the group details. If no group is found, it displays a notice saying ‘Groups not found’. The shortcode also includes pagination, allowing users to navigate through multiple pages of groups.

Shortcode: [grouplist]

Examples and Usage

Basic example – Displays a list of groups without any specific parameters.

[grouplist /]

Advanced examples

Displays a list of groups with a specified number of groups per page. Here, we set the number to 10.

[grouplist number=10 /]

Displays a list of groups with a specific offset. This can be useful when you want to skip a certain number of groups. In this example, we set the offset to 5, meaning the first 5 groups will be skipped.

[grouplist offset=5 /]

Combining multiple parameters. This example displays a list of groups, limiting the output to 10 groups per page and skipping the first 5 groups.

[grouplist number=10 offset=5 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [grouplist] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'grouplist', 'rcl_get_grouplist' );

Shortcode PHP function:

                    function rcl_get_grouplist( $atts = false ) {
	global $post, $rcl_group;

	if ( rcl_get_option( 'group-output' ) && $post && $post->ID == rcl_get_option( 'group-page' ) ) {
		if ( $rcl_group ) {
			return rcl_get_single_group();
		}
	}

	include_once 'classes/class-rcl-groups-list.php';

	$list = new Rcl_Groups_List( $atts );

	$count   = $list->count();
	$rclnavi = false;
	if ( ! isset( $atts['number'] ) ) {

		$rclnavi               = new Rcl_PageNavi( 'rcl-groups', $count, array( 'in_page' => $list->query['number'] ) );
		$list->query['offset'] = $rclnavi->offset;
	}

	$groupsdata = $list->get_data();

	$content = $list->get_filters( $count );

	if ( ! $groupsdata ) {
		return $content . rcl_get_notice( [ 'text' => __( 'Groups not found', 'wp-recall' ) ] );
	}

	$content .= '<div class="rcl-grouplist">';

	foreach ( $groupsdata as $rcl_group ) {
		$list->setup_groupdata( $rcl_group );
		$content .= rcl_get_include_template( 'group-' . $list->template . '.php', __FILE__ );
	}

	$content .= '</div>';

	if ( ! isset( $atts['number'] ) && $rclnavi->in_page ) {
		$content .= $rclnavi->pagenavi();
	}

	$list->remove_data();

	return $content;
}
                    

Code file location:

wp-recall/wp-recall/add-on/groups/shortcodes.php

Wp Recall [spoiler] Shortcode

The WP-Recall ‘spoiler’ shortcode is used to hide content within a spoiler box. This shortcode, when implemented, creates a clickable link that reveals or hides the content.

Shortcode: [spoiler]

Examples and Usage

Basic example – In this example, the spoiler shortcode is used without any additional attributes. The content within the shortcode tags will be hidden until the user clicks on the “Spoiler” link.

[spoiler]Hidden content goes here[/spoiler]

Advanced examples

Here, we are using the shortcode to display a spoiler with additional attributes. The attributes can be used to customize the appearance and behavior of the spoiler. In this case, we are adding a custom class to the spoiler div and changing the text of the spoiler link.

[spoiler class="custom-class" link_text="Show hidden content"]Hidden content goes here[/spoiler]

In this next example, we are using the shortcode to display a spoiler with a custom icon and a custom onclick event. The icon is specified using a Font Awesome class, and the onclick event is a JavaScript function that will be executed when the user clicks on the spoiler link.

[spoiler icon="fa-eye" onclick="customFunction()"]Hidden content goes here[/spoiler]

Please note that the examples above assume that you have defined the necessary attributes in the pfm_get_spoiler_content function. If the attributes are not defined in the function, they will not have any effect on the output of the shortcode.

PHP Function Code

In case you have difficulties debugging what causing issues with [spoiler] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'spoiler', 'pfm_get_spoiler_content' );

Shortcode PHP function:

                    function pfm_get_spoiler_content( $attrs, $content ) {
	return '<div class="prime-spoiler">'
	       . '<a href="#" class="prime-spoiler-link" onclick="pfm_spoiler(this); return false;">'
	       . '<i class="rcli fa-plus-square-o"></i> ' . __( 'Spoiler', 'wp-recall' )
	       . '</a>'
	       . '<div class="prime-spoiler-content">'
	       . $content
	       . '</div>'
	       . '</div>';
}
                    

Code file location:

wp-recall/wp-recall/add-on/prime-forum/functions-shortcodes.php

Wp Recall [offtop] Shortcode

The WP-Recall plugin’s ‘offtop’ shortcode is designed to create a distinct section for off-topic content. When used, it wraps the inserted content within a stylized div element labeled ‘Off-topic’. This shortcode presents a user-friendly way to segregate and display non-essential information, enhancing the overall content structure.

Shortcode: [offtop]

Examples and Usage

Basic Example – Utilizes the ‘offtop’ shortcode to display off-topic content within a special div container.

[offtop]Your off-topic content goes here[/offtop]

Advanced Examples

Embedding HTML content within the shortcode to create a more complex off-topic section.

[offtop]

Off-Topic Title

Some off-topic content here

[/offtop]

Using the ‘offtop’ shortcode inside a post to separate non-essential information from the main content. The shortcode wraps the off-topic content in a div with a specific class, making it easy to style separately.

[offtop]

This is some off-topic content that will be styled differently from the main content of the post.

[/offtop]

Please note that the ‘offtop’ shortcode does not accept any parameters. The content placed between the opening and closing tags of the shortcode is what is displayed as off-topic content.

PHP Function Code

In case you have difficulties debugging what causing issues with [offtop] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'offtop', 'pfm_get_offtop_content' );

Shortcode PHP function:

                    function pfm_get_offtop_content( $attrs, $content ) {
	return '<div class="prime-offtop">'
	       . '<span class="prime-offtop-title">'
	       . '<i class="rcli fa-coffee"></i> ' . __( 'Off-topic', 'wp-recall' )
	       . '</span>'
	       . '<div class="prime-offtop-content">'
	       . $content
	       . '</div>'
	       . '</div>';
}
                    

Code file location:

wp-recall/wp-recall/add-on/prime-forum/functions-shortcodes.php

Wp Recall [prime-forum] Shortcode

The WP-Recall plugin’s shortcode ‘prime-forum’ returns the content of a specific forum. It fetches the forum content by calling the ‘pfm_get_template_content’ function.

Shortcode: [prime-forum]

Examples and Usage

Basic example – The shortcode ‘prime-forum’ is used to get the forum content. It doesn’t require any parameters/atts for the basic usage.

[prime-forum]

PHP Function Code

In case you have difficulties debugging what causing issues with [prime-forum] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'prime-forum', 'pfm_get_forum_content' );

Shortcode PHP function:

                    function pfm_get_forum_content() {

	return pfm_get_template_content();
}
                    

Code file location:

wp-recall/wp-recall/add-on/prime-forum/functions-shortcodes.php

Wp Recall [prime-posts] Shortcode

The Prime Posts shortcode is a feature of the WP-Recall plugin. It retrieves and displays the latest posts based on the defined attributes. When executed, the shortcode calls the PrimeLastPosts class, which fetches the posts. If no posts are found, it returns a ‘Not found’ message.

Shortcode: [prime-posts]

Examples and Usage

Basic example – The shortcode is used to display the last posts based on the given parameters.

[prime-posts numberposts=5 orderby="post_date" order="DESC" /]
In the above example, the ‘numberposts’ attribute is used to specify the number of posts to display, which is 5 in this case. The ‘orderby’ attribute is used to determine the order of the posts, and it’s set to ‘post_date’, meaning the posts will be ordered by their publishing date. The ‘order’ attribute is set to ‘DESC’, indicating that the posts will be displayed in descending order, with the most recent post first.

Advanced examples

[prime-posts numberposts=10 orderby="post_date" order="DESC" category="News" exclude="1,2,3" /]
In this advanced example, the ‘numberposts’ attribute is set to 10, meaning the ten most recent posts will be displayed. The ‘orderby’ attribute is set to ‘post_date’, and the ‘order’ attribute is set to ‘DESC’, so the posts will be displayed in descending order of their publishing date. The ‘category’ attribute is used to specify the category of the posts to display, which is ‘News’ in this case. The ‘exclude’ attribute is used to exclude certain posts from the display, based on their IDs. In this case, the posts with the IDs 1, 2, and 3 will be excluded.

PHP Function Code

In case you have difficulties debugging what causing issues with [prime-posts] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'prime-posts', 'pfm_get_posts_shortcode' );

Shortcode PHP function:

                    function pfm_get_posts_shortcode( $attrs ) {

	require_once 'classes/class-prime-last-posts.php';

	$LastPosts = new PrimeLastPosts( $attrs );

	if ( ! $LastPosts->posts ) {
		return '<p>' . __( 'Not found', 'wp-recall' ) . '</p>';
	}

	return $LastPosts->get_content();
}
                    

Code file location:

wp-recall/wp-recall/add-on/prime-forum/functions-shortcodes.php

Wp Recall [public-form] Shortcode

The WP-Recall plugin shortcode, ‘public-form’, is designed to create a public form on your WordPress site. This shortcode uses the ‘rcl_publicform’ function which checks if Gutenberg editor is active. If not, it initiates a new instance of the ‘Rcl_Public_Form’ class with given attributes, returning the form’s HTML.

Shortcode: [public-form]

Examples and Usage

Basic example – The shortcode is displayed with no additional parameters. This will display the public form in its default state.

[public-form /]

Advanced examples

Using the shortcode with additional parameters. In this example, the shortcode is used with an ‘id’ parameter. This will display the public form associated with the given ID.

[public-form id=2 /]

Using the shortcode with multiple parameters. In this example, the shortcode is used with ‘id’ and ‘title’ parameters. The form will first try to load by ID, but if not found, it will try to load by title.

[public-form id=2 title="Contact Form" /]

Another advanced usage is to use the shortcode with ‘id’, ‘title’, and ‘description’ parameters. The form will first try to load by ID, but if not found, it will try to load by title, and the description will be displayed under the title of the form.

[public-form id=2 title="Contact Form" description="This is a contact form." /]

PHP Function Code

In case you have difficulties debugging what causing issues with [public-form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'public-form', 'rcl_publicform' );

Shortcode PHP function:

                    function rcl_publicform( $atts ) {

	if ( rcl_is_gutenberg() ) {
		return false;
	}

	$form = new Rcl_Public_Form( $atts );

	return $form->get_form();
}
                    

Code file location:

wp-recall/wp-recall/add-on/publicpost/shortcodes.php

Wp Recall [ratinglist] Shortcode

The WP-Recall plugin’s ‘ratinglist’ shortcode is designed to fetch and display a list of ratings from your WordPress site. The shortcode retrieves rating data based on the parameters specified within the ‘atts’ array. It queries the Rcl_Rating_Totals_Query() table, and if a ‘days’ parameter is set, it modifies the query to include ratings from the specified number of days. The shortcode then checks if there’s a ‘number’ parameter set. If not, it implements pagination. The results are cached to improve performance. If no ratings are found, it returns a ‘Data not found’ message. Finally, the shortcode generates and returns the content, including the ratings list and pagination if applicable.

Shortcode: [ratinglist]

Parameters

Here is a list of all possible ratinglist shortcode parameters and attributes:

  • select – defines the fields to be selected from the database
  • days – filters ratings based on the past number of days
  • orderby – sorts the ratings based on the specified field
  • template – determines the layout of the displayed ratings
  • number – controls the number of ratings to display

Examples and Usage

Basic example – Display a list of ratings with default parameters.

[ratinglist /]

Advanced examples

Display a list of ratings for the last 7 days with the template set to ‘post’.

[ratinglist days=7 template='post' /]

Display a list of ratings with a custom number of items per page and pagination.

[ratinglist number=10 /]

Display a list of ratings ordered by sum of rating values in descending order for the last 30 days.

[ratinglist days=30 orderby='days_value_sum' /]

These examples demonstrate the flexibility of the ‘ratinglist’ shortcode provided by the WP-Recall plugin. By adjusting the attributes, you can tailor the output to fit your specific needs.

PHP Function Code

In case you have difficulties debugging what causing issues with [ratinglist] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'ratinglist', 'rcl_rating_shortcode' );

Shortcode PHP function:

                    function rcl_rating_shortcode( $atts ) {
	global $rating;

	if(empty($atts)){
		$atts = [];
	}

	$atts['select'] = array(
		'object_id',
		'object_author',
		'rating_total',
		'rating_type'
	);

	$rcl_rating = RQ::tbl( new Rcl_Rating_Totals_Query() )->parse( $atts );

	if ( isset( $atts['days'] ) ) {

		$tableAs = $rcl_rating->table['as'];

		$rcl_rating->query['select'][] = "SUM(rating_values.rating_value) AS days_value_sum";
		$rcl_rating->query['orderby']  = ( isset( $atts['orderby'] ) ) ? $rcl_rating->query['orderby'] : "days_value_sum";
		$rcl_rating->query['join'][]   = "INNER JOIN " . RCL_PREF . "rating_values AS rating_values ON $tableAs.object_id = rating_values.object_id";
		$rcl_rating->query['where'][]  = "rating_values.rating_date > ('" . current_time( 'mysql' ) . "' - INTERVAL " . $atts['days'] . " DAY)";
		$rcl_rating->query['where'][]  = "$tableAs.rating_type = rating_values.rating_type";
		$rcl_rating->query['where'][]  = "$tableAs.object_author = rating_values.object_author";
		$rcl_rating->query['groupby']  = "$tableAs.object_id";
	}

	$template = ( isset( $atts['template'] ) ) ? $atts['template'] : 'post';

	$rclnavi = false;
	if ( ! isset( $atts['number'] ) ) {

		$count_values                = $rcl_rating->get_count();
		$rclnavi                     = new Rcl_PageNavi( 'rcl-rating', $count_values, array( 'in_page' => $rcl_rating->query['number'] ) );
		$rcl_rating->query['offset'] = $rclnavi->offset;
	}

	$rcl_cache = new Rcl_Cache();

	if ( $rcl_cache->is_cache ) {

		$file = $rcl_cache->get_file( $rcl_rating->get_sql() );

		if ( ! $file->need_update ) {

			return $rcl_cache->get_cache();
		}
	}

	$ratings = $rcl_rating->get_results();

	if ( ! $ratings ) {
		return '<p style="text-align:center;">' . __( 'Data not found', 'wp-recall' ) . '</p>';
	}

	$content = '<div class="ratinglist rating-' . $template . '">';

	foreach ( $ratings as $rating ) {
		$rating                 = ( object ) $rating;
		$rating->days_value_sum = ( $rating->days_value_sum > 0 ) ? '+' . $rating->days_value_sum : $rating->days_value_sum;
		$content                .= rcl_get_include_template( 'rating-' . $template . '.php', __FILE__ );
	}

	$content .= '</div>';

	if ( ! isset( $atts['number'] ) ) {
		$content .= $rclnavi->pagenavi();
	}

	if ( $rcl_cache->is_cache ) {
		$rcl_cache->update_cache( $content );
	}

	return $content;
}
                    

Code file location:

wp-recall/wp-recall/add-on/rating-system/core.php

Wp Recall [rcl-chat] Shortcode

The WP-Recall plugin shortcode, ‘rcl-chat’, initiates a chat functionality. It checks if the ‘chat_room’ attribute is set, enables file upload if authorized, and returns the chat interface.

Shortcode: [rcl-chat]

Parameters

Here is a list of all possible rcl-chat shortcode parameters and attributes:

  • chat_room – Identifier of the chat room to display
  • file_upload – Enables or disables file upload functionality

Examples and Usage

Basic example – A basic usage of the shortcode would be to specify a chat room. In this case, we use the ‘chat_room’ attribute to specify the chat room we want to display.

[rcl-chat chat_room="room1" /]

Advanced examples

Adding the ‘file_upload’ attribute – This shortcode allows users to upload files in the chat room. By default, file upload is disabled (0), but you can enable it by setting the ‘file_upload’ attribute to 1.

[rcl-chat chat_room="room1" file_upload=1 /]

Specifying multiple chat rooms – This shortcode allows you to specify multiple chat rooms. Each chat room should be separated by a comma without any spaces.

[rcl-chat chat_room="room1,room2,room3" /]

Combining multiple attributes – This shortcode allows you to combine multiple attributes. In this example, we enable file upload in multiple chat rooms.

[rcl-chat chat_room="room1,room2,room3" file_upload=1 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl-chat] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'rcl-chat', 'rcl_chat_shortcode' );

Shortcode PHP function:

                    function rcl_chat_shortcode( $atts ) {
	global $user_ID;

	if ( ! isset( $atts['chat_room'] ) || empty( $atts['chat_room'] ) ) {
		return __( 'Not set attributes: chat_room', 'wp-recall' );
	}

	$file_upload = ( isset( $atts['file_upload'] ) ) ? $atts['file_upload'] : 0;

	if ( $user_ID && $file_upload ) {
		rcl_fileupload_scripts();
	}

	require_once 'class-rcl-chat.php';
	$chat = new Rcl_Chat( $atts );

	return $chat->get_chat();
}
                    

Code file location:

wp-recall/wp-recall/add-on/rcl-chat/index.php

Wp Recall [rcl-pay-form] Shortcode

The WP-Recall plugin shortcode, ‘rcl-pay-form’, is designed to generate a payment form. It checks if a user is logged in and customizes the form based on specific arguments. This shortcode offers flexibility in payment types, amounts, and descriptions, providing a seamless payment experience.

Shortcode: [rcl-pay-form]

Parameters

Here is a list of all possible rcl-pay-form shortcode parameters and attributes:

  • pay_summ – The total payment amount.
  • pre_form – Determines if the form is pre-filled. 1 for yes, 0 for no.
  • ids – Specifies the IDs of the payments.
  • ids__not_in – Excludes the specified payment IDs.
  • submit_value – The text displayed on the submission button.
  • description – Text description for the payment form.
  • pay_type – Payment type, “any” for all types.
  • amount_type – Determines if the amount is a number or text.
  • amount_min – Sets the minimum payment amount.
  • amount_max – Sets the maximum payment amount.
  • amount_step – Increments the payment amount by this step.
  • default – Sets the default payment amount.
  • icon – Displays an icon. 1 for yes, 0 for no.

Examples and Usage

Basic example – Here is an example of the shortcode in its simplest form, without any additional parameters:

[rcl-pay-form]

Advanced examples

Here, we are using the shortcode to specify a payment amount and a custom description. This will generate a payment form with the defined amount and description:

[rcl-pay-form pay_summ="100" description="Payment for premium membership"]

In this next example, we are using the shortcode to set a minimum and maximum amount, with a step value. This will generate a payment form where the user can select an amount within the defined range, in increments defined by the step value:

[rcl-pay-form amount_min="10" amount_max="1000" amount_step="10"]

Lastly, this example uses the shortcode to specify a payment type and an icon. This will generate a payment form with the specified payment type and an icon:

[rcl-pay-form pay_type="credit_card" icon="1"]

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl-pay-form] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'rcl-pay-form', 'rcl_get_pay_form' );

Shortcode PHP function:

                    function rcl_get_pay_form( $args ) {
	global $user_ID;

	if ( ! $user_ID ) {
		return rcl_get_notice( [
			'text' => apply_filters( 'rcl_pay_form_guest_notice', __( 'You need to login to make a payment', 'wp-recall' ) )
		] );
	}

	$args = wp_parse_args( $args, array(
		'pay_summ'     => 0,
		'pre_form'     => 1,
		'ids'          => '',
		'ids__not_in'  => '',
		'submit_value' => '',
		'description'  => '',
		'pay_type'     => 'any',
		'amount_type'  => 'number',
		'amount_min'   => 1,
		'amount_max'   => false,
		'amount_step'  => 1,
		'default'      => 1,
		'icon'         => 1
	) );

	$gateWays = new Rcl_Payment_Form( $args );

	if ( $args['pay_summ'] ) {
		return $gateWays->get_form();
	} else {
		return $gateWays->get_custom_amount_form();
	}
}
                    

Code file location:

wp-recall/wp-recall/add-on/user-balance/addon-shortcodes.php

Wp Recall [rcl-form-balance] Shortcode

The WP-Recall plugin shortcode ‘rcl-form-balance’ is designed to create a payment form for logged-in users. It allows users to add funds to their personal account. If a user is not logged in, the shortcode displays a notice prompting them to log in. If no payment gateways are configured, an error notice is displayed.

Shortcode: [rcl-form-balance]

Parameters

Here is a list of all possible rcl-form-balance shortcode parameters and attributes:

  • ids__not_in – Excludes specific payment gateway from the form.
  • pay_type – Defines the type of payment, in this case, ‘user-balance’.
  • description – Adds a custom message to the payment form.

Examples and Usage

Basic example – A simple usage of the shortcode to add a user balance form to a page.

[rcl-form-balance]

Advanced examples

Using the shortcode with the ‘ids__not_in’ parameter to exclude a specific user balance from the form. In this example, the user balance with the ID ‘user_balance’ will not be included in the form.

[rcl-form-balance ids__not_in='user_balance']

Using the shortcode with the ‘pay_type’ parameter to specify the type of payment. In this example, the payment type is set to ‘user-balance’.

[rcl-form-balance pay_type='user-balance']

Using the shortcode with the ‘description’ parameter to provide a description for the payment form. In this case, the description is ‘Adding funds to your personal account’.

[rcl-form-balance description='Adding funds to your personal account']

Using the shortcode with multiple parameters. In this example, the ‘ids__not_in’, ‘pay_type’, and ‘description’ parameters are all used together.

[rcl-form-balance ids__not_in='user_balance' pay_type='user-balance' description='Adding funds to your personal account']

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl-form-balance] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'rcl-form-balance', 'rcl_form_user_balance' );

Shortcode PHP function:

                    function rcl_form_user_balance( $args = array() ) {
	global $user_ID;

	if ( ! $user_ID ) {
		return rcl_get_notice( [
			'text' => apply_filters( 'rcl_pay_form_guest_notice', __( 'You need to login to make a payment', 'wp-recall' ) )
		] );
	}

	$gateWays = new Rcl_Payment_Form( apply_filters( 'rcl_user_balance_form_args', wp_parse_args( $args, array(
		'ids__not_in' => 'user_balance',
		'pay_type'    => 'user-balance',
		'description' => __( 'Adding funds to your personal account', 'wp-recall' ) . ' ' . get_the_author_meta( 'user_email', $user_ID )
	) ) ) );

	if ( ! count( $gateWays->gateways ) ) {
		return rcl_get_notice( [
			'type' => 'error',
			'text' => __( 'Perhaps you haven`t configured any connect to a payment system yet', 'wp-recall' )
		] );
	}

	return $gateWays->get_custom_amount_form();
}
                    

Code file location:

wp-recall/wp-recall/add-on/user-balance/addon-shortcodes.php

Wp Recall [rcl-usercount] Shortcode

The RCL-usercount shortcode from the WP-Recall plugin is a tool that returns the total number of users on a website. This shortcode calls the function rcl_shortcode_usercount(), which in turn calls the function rcl_get_html_usercount() to retrieve the total user count.

Shortcode: [rcl-usercount]

Examples and Usage

Basic example – Show the total count of users on your WordPress site.

[rcl-usercount /]

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl-usercount] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'rcl-usercount', 'rcl_shortcode_usercount' );

Shortcode PHP function:

                    function rcl_shortcode_usercount() {
	return rcl_get_html_usercount();
}
                    

Code file location:

wp-recall/wp-recall/add-on/user-balance/addon-shortcodes.php

Wp Recall [loginform] Shortcode

The wp-recall plugin shortcode ‘loginform’ is designed to display a login form on your WordPress site. This shortcode allows you to embed a login form anywhere on your page, enhancing user experience. In the PHP code, the function ‘rcl_get_login_form’ extracts the shortcode attributes. If no form is specified, it defaults to ‘false’. The function then returns the authorization form, ‘rcl_get_authorize_form’, to be displayed on the page.

Shortcode: [loginform]

Parameters

Here is a list of all possible loginform shortcode parameters and attributes:

  • form – Determines the type of authorization form displayed

Examples and Usage

Basic example – The login form shortcode is used to display a login form on a page. By default, it does not require any parameters.

[loginform /]

Advanced examples

1. Display a specific form by using the ‘form’ attribute. The form attribute accepts the ID of the form you want to display. If the ID is not found, it will display the default login form.

[loginform form=2 /]

2. The shortcode can accept multiple parameters. Here is an example of using multiple parameters in the shortcode. This example displays form with ID 3.

[loginform form=3 /]

PHP Function Code

In case you have difficulties debugging what causing issues with [loginform] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'loginform', 'rcl_get_login_form' );

Shortcode PHP function:

                    function rcl_get_login_form( $atts ) {
	$form = false;
	extract( shortcode_atts( array( 'form' => false ), $atts ) );

	return rcl_get_authorize_form( 'pageform', $form );
}
                    

Code file location:

wp-recall/wp-recall/functions/loginform.php

Wp Recall [wp-recall] Shortcode

The WP-Recall shortcode is used to display a personalized user account. When the shortcode is executed, it checks if a user is logged in. If not, a message prompts the user to log in or register, along with an authorization form. If a user is logged in, it triggers the wp_recall() function, which displays the user’s personal account information.

Shortcode: [wp-recall]

Examples and Usage

Basic example – The basic usage of the WP-Recall shortcode does not require any parameters. It simply outputs the content of the user’s personal account page, provided they are logged in. If they are not logged in, it will display a message prompting them to log in or register, along with an authorization form.

[wp-recall /]

Advanced examples

The WP-Recall shortcode does not support parameters in the traditional sense. Instead, the behavior of the shortcode can be modified by changing the global $user_LK variable before the shortcode is run. For example, you could force the shortcode to always display the login/registration prompt, regardless of whether the user is already logged in, by setting $user_LK to false.


$user_LK = false;
echo do_shortcode('[wp-recall /]');

Similarly, you could ensure that the user’s account page is always displayed by setting $user_LK to true. This could be useful if you want to display a preview of the account page to users who are not logged in.


$user_LK = true;
echo do_shortcode('[wp-recall /]');

Please note that these examples require modifying the PHP code of your WordPress site, and should only be attempted if you are comfortable with PHP and understand the potential risks.

PHP Function Code

In case you have difficulties debugging what causing issues with [wp-recall] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'wp-recall', 'rcl_get_shortcode_wp_recall' );

Shortcode PHP function:

                    function rcl_get_shortcode_wp_recall() {
	global $user_LK;

	if ( ! $user_LK ) {
		return '<h4 class="rcl_cab_guest_message">' . esc_html__( 'To use your personal account, please log in or register on this site', 'wp-recall' ) . '</h4>
        <div class="authorize-form-rcl">' . rcl_get_authorize_form() . '</div>';
	}

	ob_start();

	wp_recall();

	$content = ob_get_contents();
	ob_end_clean();

	return $content;
}
                    

Code file location:

wp-recall/wp-recall/functions/shortcodes.php

Wp Recall [userlist] Shortcode

The WP-Recall plugin ‘userlist’ shortcode is a powerful tool that generates a list of users on a WordPress site. This shortcode uses the function ‘rcl_get_userlist’ to retrieve user data. It employs pagination, caching, and error handling, ensuring an efficient and user-friendly display. If no users are found, it returns a user-friendly notice. This shortcode is highly customizable, allowing the admin to adjust the number of users shown per page and to filter the user list.

Shortcode: [userlist]

Parameters

Here is a list of all possible userlist shortcode parameters and attributes:

  • number – Determines the number of users to display on a page.
  • id – Unique identifier for the user list.
  • offset – Specifies the starting point in the list of users.
  • in_page – Controls the pagination of the user list.
  • template – Specifies the layout of the user list.

Examples and Usage

Basic Example – Display a list of users without specifying any parameters. By default, it will list all users in the system.

[userlist /]

Advanced Examples

Display a list of users with a specified number of users per page. For instance, if you want to display 10 users per page, you can use the following shortcode:

[userlist number=10 /]

Display a list of users with a specific template. For instance, if you have a template named ‘custom’, you can use the following shortcode:

[userlist template="custom" /]

Combine multiple parameters to create a more specific user list. For example, if you want to display 5 users per page using the ‘custom’ template, you can use the following shortcode:

[userlist number=5 template="custom" /]
Remember, the ‘number’ attribute defines the number of users to display per page, and the ‘template’ attribute specifies the template to use for displaying the user list. The values for these attributes should be adjusted according to your specific needs and the configuration of your WordPress site.

PHP Function Code

In case you have difficulties debugging what causing issues with [userlist] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'userlist', 'rcl_get_userlist' );

Shortcode PHP function:

                    function rcl_get_userlist( $atts ) {
	global $rcl_user, $rcl_users_set, $user_ID;

	require_once RCL_PATH . 'classes/class-rcl-users-list.php';

	$users = new Rcl_Users_List( $atts );

	$count_users = false;

	if ( ! isset( $atts['number'] ) ) {

		$count_users = $users->count();

		$id_pager = ( $users->id ) ? 'rcl-users-' . $users->id : 'rcl-users';

		$pagenavi = new Rcl_PageNavi( $id_pager, $count_users, array( 'in_page' => $users->query['number'] ) );

		$users->query['offset'] = $pagenavi->offset;
	}

	$timecache = ( $user_ID && $users->query['number'] == 'time_action' ) ? rcl_get_option( 'timeout', 600 ) : 0;

	$rcl_cache = new Rcl_Cache( $timecache );

	if ( $rcl_cache->is_cache ) {
		if ( isset( $users->id ) && $users->id == 'rcl-online-users' ) {
			$string = json_encode( $users );
		} else {
			$string = json_encode( $users->query );
		}

		$file = $rcl_cache->get_file( $string );

		if ( ! $file->need_update ) {

			$users->remove_filters();

			return $rcl_cache->get_cache();
		}
	}

	$usersdata = $users->get_users();

	$userlist = $users->get_filters( $count_users );

	$userlist .= '<div class="rcl-userlist">';

	if ( ! $usersdata ) {
		$userlist .= rcl_get_notice( [ 'text' => esc_html__( 'Users not found', 'wp-recall' ) ] );
	} else {

		if ( ! isset( $atts['number'] ) && $pagenavi->in_page ) {
			$userlist .= $pagenavi->pagenavi();
		}

		$userlist .= '<div class="userlist ' . $users->template . '-list">';

		$rcl_users_set = $users;

		foreach ( $usersdata as $rcl_user ) {
			$users->setup_userdata( $rcl_user );
			$userlist .= rcl_get_include_template( 'user-' . $users->template . '.php' );
		}

		$userlist .= '</div>';

		if ( ! isset( $atts['number'] ) && $pagenavi->in_page ) {
			$userlist .= $pagenavi->pagenavi();
		}
	}

	$userlist .= '</div>';

	$users->remove_filters();

	if ( $rcl_cache->is_cache ) {
		$rcl_cache->update_cache( $userlist );
	}

	return $userlist;
}
                    

Code file location:

wp-recall/wp-recall/functions/shortcodes.php

Wp Recall [rcl-cache] Shortcode

The WP-Recall plugin’s shortcode, ‘rcl-cache’, is designed to manage caching of specific content. It uses the Rcl_Cache class to determine if cache is required and updates it as needed. This shortcode takes three attributes: ‘key’, ‘only_guest’, and ‘time’. ‘Key’ is used to identify the cache, ‘only_guest’ allows caching for guests only, and ‘time’ sets the cache duration. The ‘rcl-cache’ shortcode also processes nested shortcodes within its content, ensuring they’re correctly parsed and executed. It’s an efficient tool for optimizing page load times.

Shortcode: [rcl-cache]

Parameters

Here is a list of all possible rcl-cache shortcode parameters and attributes:

  • key – Used to create unique identifier for the cache.
  • only_guest – Determines if cache applies only to guests.
  • time – Sets the cache lifespan in seconds.

Examples and Usage

Basic example – The shortcode is used without any parameters. It will work with the default attributes set in the shortcode function.

[rcl-cache]

Advanced examples

Using the shortcode with the ‘key’ attribute. This can be used to specify a unique key for the cache. The cache will be stored and retrieved using this key.

[rcl-cache key="unique_key"]

Using the shortcode with the ‘time’ attribute. This can be used to set a custom time for the cache. The cache will be updated after this time period.

[rcl-cache time="3600"]

Using the shortcode with the ‘only_guest’ attribute. This can be used to specify whether the cache should be used only for guests or for all users. If it is set to true, the cache will be used only for guests.

[rcl-cache only_guest="true"]

Using the shortcode with all attributes. This provides full control over the cache settings.

[rcl-cache key="unique_key" time="3600" only_guest="true"]

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl-cache] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'rcl-cache', 'rcl_cache_shortcode' );

Shortcode PHP function:

                    function rcl_cache_shortcode( $atts, $content = null ) {
	global $post;
	$key        = false;
	$time       = false;
	$only_guest = false;
	extract( shortcode_atts( array(
		'key'        => '',
		'only_guest' => false,
		'time'       => false
	), $atts ) );

	if ( $post->post_status == 'publish' ) {

		$key .= '-cache-' . $post->ID;

		$rcl_cache = new Rcl_Cache( $time, $only_guest );

		if ( $rcl_cache->is_cache ) {

			$file = $rcl_cache->get_file( $key );

			if ( ! $file->need_update ) {
				return $rcl_cache->get_cache();
			}
		}
	}

	$content = do_shortcode( shortcode_unautop( $content ) );
	if ( '</p>' == substr( $content, 0, 4 )
	     and '<p>' == substr( $content, strlen( $content ) - 3 ) ) {
		$content = substr( $content, 4, strlen( $content ) - 7 );
	}

	if ( $post->post_status == 'publish' ) {

		if ( $rcl_cache->is_cache ) {
			$rcl_cache->update_cache( $content );
		}
	}

	return $content;
}
                    

Code file location:

wp-recall/wp-recall/functions/shortcodes.php

Wp Recall [rcl-tab] Shortcode

The WP-Recall plugin shortcode, ‘rcl-tab’, is designed to display specific tabs within a user’s personal account. The shortcode first checks if the user is logged in. If not, it prompts them to log in or register. If the user is logged in, the shortcode then retrieves the specified tab. If the tab does not exist, an error message is displayed. If the tab is valid, the shortcode checks if the user has access to it. If they do, it displays the tab’s content. The shortcode is flexible and can be customized to display different tabs based on the user’s access level.

Shortcode: [rcl-tab]

Parameters

Here is a list of all possible rcl-tab shortcode parameters and attributes:

  • tab_id – Specifies the unique identifier of the tab to be displayed.
  • subtab_id – Specifies the unique identifier of the subtab within the main tab.

Examples and Usage

Basic example – A shortcode that displays a specific tab from the user’s personal account. The tab is identified by its ‘tab_id’.

[rcl-tab tab_id=2 /]

Advanced examples

Specifying both the ‘tab_id’ and ‘subtab_id’ in the shortcode. This will display a specific subtab within the main tab of the user’s personal account. If the subtab is not found, the main tab will be displayed.

[rcl-tab tab_id=2 subtab_id=3 /]

Using the shortcode without any parameters. This will display a login form if the user is not logged in. If the user is logged in, it will display the first available tab from the user’s personal account.

[rcl-tab /]

Note: In the examples above, replace ‘2’ and ‘3’ with the actual IDs of the tab and subtab you want to display.

PHP Function Code

In case you have difficulties debugging what causing issues with [rcl-tab] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'rcl-tab', 'rcl_tab_shortcode' );

Shortcode PHP function:

                    function rcl_tab_shortcode( $atts ) {
	global $user_ID, $user_LK;

	$user_LK   = $user_ID;
	$tab_id    = false;
	$subtab_id = false;
	extract( shortcode_atts( array(
		'tab_id'    => '',
		'subtab_id' => ''
	), $atts ) );

	if ( ! $user_ID ) {
		return '<h4 class="rcl_cab_guest_message">' . esc_html__( 'To use your personal account, please log in or register on this site', 'wp-recall' ) . '</h4>
        <div class="authorize-form-rcl">' . rcl_get_authorize_form() . '</div>';
	}

	$tab = rcl_get_tab( $tab_id );

	if ( ! $tab ) {
		return '<p>' . esc_html__( 'Such tab was not found!', 'wp-recall' ) . '</p>';
	}

	if ( ! class_exists( 'Rcl_Tab' ) ) {
		require_once RCL_PATH . 'classes/class-rcl-tab.php';
	}

	$Rcl_Tab = new Rcl_Tab( $tab );

	if ( ! $Rcl_Tab->is_user_access( $user_ID ) ) {
		return false;
	}

	$content = '<div id="rcl-office" class="wprecallblock" data-account="' . $user_ID . '">';
	$content .= '<div id="lk-content">';

	$content .= sprintf( '<div id="tab-%s" class="%s_block recall_content_block %s">%s</div>', $tab_id, $tab_id, 'active', $Rcl_Tab->get_tab_content( $user_ID, $subtab_id ) );

	$content .= '</div>';
	$content .= '</div>';

	return $content;
}
                    

Code file location:

wp-recall/wp-recall/functions/shortcodes.php

Conclusion

Now that you’ve learned how to embed the Wp Recall Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *