Peepso Core Shortcodes

Below, you’ll find a detailed guide on how to add the Peepso Core 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 Peepso Core Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Peepso Core Plugin and the shortcodes it provides:

Plugin Icon
Community by PeepSo – Social Network, Membership, Registration, User Profiles

"Community by PeepSo is an all-in-one WordPress plugin, enabling social networking, membership registration, and user profile management. It turns your website into a full-fledged community hub."

★★★★✩ (198) Active Installs: 4000+ Tested with: 6.3.2 PHP Version: 7.2
Included Shortcodes:
  • [peepso_search]
  • [peepso_activity]
  • [peepso_tag]

Peepso Core [peepso_search] Shortcode

The Peepso Search shortcode is a dynamic tool that generates a search function within your WordPress site. It uses the PeepSo plugin to set up a dedicated search area. This shortcode initiates a search module, checks user access, and if granted, it outputs a search template. The search context is set to ‘shortcode’, allowing customization. The query is then reset to ensure smooth operation.

Shortcode: [peepso_search]

Examples and Usage

Basic example – The shortcode peepso_search is used to display a search form for PeepSo.

[peepso_search]

For advanced examples, you can customize the shortcode with additional parameters. However, in the given PHP code, it does not show any additional parameters that can be passed to the shortcode. The PeepSo search form does not seem to have any customizable options through the shortcode. If you want to customize the search form, you may need to do it through the PeepSo settings or by customizing the PeepSo search template.

Advanced example – Unfortunately, based on the given PHP code, it does not show any additional parameters that can be passed to the shortcode.

[peepso_search]

Please note that you should always check the plugin documentation or contact the plugin developer for more details about the shortcode usage and parameters.

PHP Function Code

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

Shortcode line:

add_shortcode('peepso_search', array(&$this, 'shortcode'));

Shortcode PHP function:

function shortcode() {
        PeepSo::set_current_shortcode('peepso_search');

        if (FALSE == apply_filters('peepso_access_content', TRUE, 'peepso_search', PeepSo::MODULE_ID)) {
            return PeepSoTemplate::do_404();
        }

        if(!isset($this->url) || !($this->url instanceof PeepSoUrlSegments)) {
            $this->url = PeepSoUrlSegments::get_instance();
        }

        ob_start();

        echo '<div class="ps-js-shortcode-search">';
        PeepSoTemplate::exec_template('search', 'search', array('context' => 'shortcode'));
        echo '</div>';

        PeepSo::reset_query();

        return (ob_get_clean());
    }

Code file location:

peepso-core/peepso-core/3/classes/search/search_shortcode.php

Peepso Core [peepso_activity] Shortcode

Peepso Activity shortcode is a functional code snippet in Peepso-core plugin. It allows users to display social activity on their WordPress site. This shortcode checks if the activity content is accessible. If not, it redirects to a 404 page. It also enqueues the necessary styles and scripts for the activity feed. If the user is not logged in and the reCAPTCHA option is enabled, it loads the reCAPTCHA script.

Shortcode: [peepso_activity]

Examples and Usage

Basic example – Utilizing the PeepSo Activity shortcode to display user activity on a page.

[peepso_activity]

PHP Function Code

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

Shortcode line:

add_shortcode('peepso_activity', array(&$this, 'do_shortcode'));

Shortcode PHP function:

function do_shortcode($atts, $content)
	{
		PeepSo::set_current_shortcode('peepso_activity');
        PeepSo::reset_query();

		if (FALSE == $this->is_accessible() || FALSE == apply_filters('peepso_access_content', TRUE, 'peepso_activity', PeepSoActivity::MODULE_ID)) {
		    // Give the activity class a chance to run redirects, but do not output anything
            $do_not_output = PeepSoTemplate::exec_template('activity', 'activity', NULL, TRUE);

            return PeepSoTemplate::do_404();
		}

		wp_enqueue_style('peepso-activity');
		wp_enqueue_script('peepso-activity');
		if (!is_user_logged_in() && PeepSo::get_option('recaptcha_login_enable', 0)) {
			wp_enqueue_script('peepso-recaptcha');
		}

        return PeepSoTemplate::get_before_markup() . PeepSoTemplate::exec_template('activity', 'activity', NULL, TRUE) .  PeepSoTemplate::get_after_markup();
	}

Code file location:

peepso-core/peepso-core/activity/classes/activityshortcode.php

Peepso Core [peepso_tag] Shortcode

PeepSo-Core shortcode is a PHP function that allows users to mention others in their posts. It takes a user’s ID as an attribute, retrieves the user’s full name, and replaces the shortcode with a mention of the user in the post content and excerpt. If no name is provided, it uses the user’s full name as the preferred name.

Shortcode: [peepso_tag]

Parameters

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

  • id – The unique identifier of the PeepSo user
  • content – Optional, specifies the name to be displayed. Defaults to full name of the user if not set.

Examples and Usage

Basic Example – A simple implementation of the peepso-core plugin shortcode to tag a user by their ID.

[peepso_tag id=3 /]

Advanced Examples

Tagging a user by their ID and setting a preferred name. If the user’s full name isn’t found, it will display the preferred name.

[peepso_tag id=3]John Doe[/peepso_tag]

Tagging multiple users by their IDs. This example demonstrates how to tag multiple users within the same post content.

[peepso_tag id=3]John Doe[/peepso_tag]
[peepso_tag id=5]Jane Smith[/peepso_tag]

Please note that the ‘id’ attribute in the shortcode corresponds to the user’s ID in the WordPress Users section. Make sure to replace it with the correct ID when using the shortcode.

PHP Function Code

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

Shortcode line:

add_shortcode(self::SHORTCODE_TAG, array(&$this, 'shortcode_tag'));

Shortcode PHP function:

function shortcode_tag($atts, $content = '')
    {
        if (!isset($atts['id']) && empty($atts['id'])) { return; }

        $id = $atts['id'];

        $user = PeepSoUser::get_instance($id);
        if (!$content) {
            $content = $user->get_fullname();
        }

        $preferred_name = $content;

        global $post;

        $mention = "@peepso_user_{$atts['id']}($preferred_name)";
        $new_content = $post->post_content;
        $new_content = str_replace('[peepso_tag id='.$atts['id'].']'.$content.'[/peepso_tag]', $mention, $new_content);
        $new_excerpt = $post->post_excerpt;
        $new_excerpt = str_replace('[peepso_tag id='.$atts['id'].']'.$content.'[/peepso_tag]', $mention, $new_excerpt);

        wp_update_post(array('ID'=>$post->ID,'post_content'=>$new_content,'post_excerpt'=>$new_excerpt));

        return $mention;
    }

Code file location:

peepso-core/peepso-core/classes/tags.php

Conclusion

Now that you’ve learned how to embed the Peepso Core 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 *