Please or Register to create posts and topics.

Extend shortcode to show specific content only

Hi there,

I'm wondering if there is a workaround for an issue that @natchoice brought up. I'm not sure it's exactly the same issue. I'm trying to use shortcode on posts instead of pages.

Shortcode will not work to show one specific forum, but instead shows all of the forums when shortcode is placed in a post.

The first pic is a screenshot of how I have placed the shortcode inside the editor of a post created using Namaste LMS. The shortcode [forum] works, but any other shortcode with parameters (categoryID, forumID, topicID, etc.) is ignored.

The second pic is where I have created a brand new post outside of Namaste and it works fine.

I realize that Namaste uses "specialized posts", but do you know if there's anything we can do to make this work?

I also realize another issue that will come up if we actually do get the shortcode to work, and that is if you click on the actual forum, it will open it in the wrong URL. i.e., it will append to the URL of the post that the code is placed on. It happens if you place the code on any post.

I think we're out of luck, but it would be really great if there was some kind of a workaround. LOL

Thanks for your time.

 

Uploaded files:
  • pic-1.png
  • Pic-2.png

Hello @mari

The main problem ist, that the shortcode is added via a custom post-type or a meta-area of a post. However, the current implementation requires that the forum-shortcode is placed inside of the content-area of a post/page. This is necessary because it allows me to analyze its content (and the included shortcode) before the actual page is getting rendered to load the requested resources based on the ID (title, access-checks for permissions, etc). For all other locations this is not possible because the shortcode will get rendered/executed the first time when WordPress is already rendering the content-part which includes your shortcode.

It is impossible for me to add support for this because there are dozens of plugins which stores their data in dozens of different locations. However, a custom implementation is possible but it requires developer-knowledge to change the related parts inside of the code - mainly in the forum-shortcodes.php file.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

@asgaros Thank you so much for the information! This helped me to understand the function.

All the best.

Hello and thank you for your wonderful forums. I was wondering if it was possible to show specific user's posts using this shortcode?

Hello @bigkahuna

Showing specific users posts is not possible but you can show one specific posts. If you want to show multiple ones, you have to use the shortcode including the post-attribute multiple times with different IDs.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Well done Asgaros and thank you for this wonderful plugin!

One question: I want to embed a forum for a specific user group. I followed the steps outlined here. Now I want the listing under the members button to reflect this user group. But when I click on members I see all users from my wordpress site not just the user group this forum is for.

Is it possible to use a filter? Can this be achieved?

Best regards,
M

Hello @mgerzabek

The members-list always shows all users on your platform. However, if you expand the filter-section you will see your user-groups which allows you to filter the list by members of certain groups only.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Quote from Asgaros on February 4, 2017, 6:39 pm

Version 1.4 of the Asgaros Forum plugin allows you to extend the forum-shortcode with additional parameters. When this parameters are used, only specific content will be shown on a page. This is especially interesting for websites where different categories/forums should be shown for different usergroups or languages. Here are a few examples on how to use it.

Show a specific post:

[forum post="POSTID"]

Show a specific topic:

[forum topic="TOPICID"]

Show a specific forum/sub-forum:

[forum forum="FORUMID"]

Show a specific category:

[forum category="CATEGORYID"]

Show multiple specific categories:

[forum category="CATEGORYID1,CATEGORYID2"]

Dont forget to replace the IDs with the corresponding IDs of the elements which should be shown on your page.

Hi is it possible to use [hide] your text here [/hide] shortcode
Lets say i want to restrict all members to leave a comment first then they will be able to view thread/posts

Hello @yashvirgaming

There is a spoiler-shortcode available, you can limit the access to its content to logged-in users only:

Spoiler
A spoiler text ...

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

never i switched to Mybb yesterday.

and its way more better with this plugin "hide content until reply v2.1" it does what im looking for.

there is also hide content until certain points gaining to view posts. Loved it

I kinda have 2 forum now , im thinking of erasing the FORUM folder in FTP where wordpress is installed.