Notifications
Clear all

wpForo 1.x.x [Closed] Code to assign secondary user group to a user

9 Posts
3 Users
1 Reactions
1,164 Views
Posts: 11
Topic starter
(@plc123)
Active Member
Joined: 5 years ago

Hi,

I would like to assign primary and secondary user group to a user depending on certain events or status every time he signs-in into my website (to restrict access to certain topics). Which is the correct PHP code?

Other questions:

Is it possible to set the maximum number of nested answers to 0 for a certain sub-forum/topic?

Is it possible to always sort answers automatically by "likes"/votes?

Many thanks in advance

8 Replies
Sofy
Posts: 4900
 Sofy
Admin
(@sofy)
Support Team
Joined: 7 years ago

Hi @plc123,

I would like to assign primary and secondary user group to a user depending on certain events or status every time he signs-in into my website (to restrict access to certain topics). Which is the correct PHP code?

I'd suggest you read this article: https://gvectors.com/using-secondary-usergroups-in-wpforo-wordpress-forum-plugin/

This fAQ topic also may be helpful for you, here Robert explained the wpForo user permission system: https://wpforo.com/community/faq/wordpress-user-roles-wpforo-usergroups-and-forum-accesses/

Is it possible to set the maximum number of nested answers to 0 for a certain sub-forum/topic?

You can set the Replies Nesting Levels Deep for the Threaded Layout. More info here: https://wpforo.com/docs/root/categories-and-forums/forum-layouts/threaded-layout/#thread-view-%E2%80%93-list-of-parent-posts-and-nested-replies

Is it possible to always sort answers automatically by "likes"/votes?

We're really sorry, but wpForo doesn't have such a feature. 

2 Replies
(@plc123)
Joined: 5 years ago

Active Member
Posts: 11

Hi @sofy,

Thanks, but I'm looking for more information as developer.

I would like to implement a plugin to assign a secondary user group to a certain user if some conditions occur.

Is there any documentation about the code?

Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@plc123,

We've created two functions, that allows add, delete, and change the usergroup_secondary as you need. Please wait a bit, it will be available in the next versions update:

1) added: WPF()->member->set_usergroups_secondary($userid, $groupids);
2) added: WPF()->member->append_usergroups_secondary($userid, $groupids);
Posts: 11
Topic starter
(@plc123)
Active Member
Joined: 5 years ago

Hi @Alvina,

ok, thanks. I will wait for next release then.

I would like to use the Q&A layout. Is there any option to sort answers by votes or likes (for example, changing internal query)?

1 Reply
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@plc123,

As Sofy already mentioned the wpForo doesn't have such a feature. 

Posts: 11
Topic starter
(@plc123)
Active Member
Joined: 5 years ago

@Alvina @Sofy

Is it possible to only show the answer chosen as the best one (if the thread is closed/solved) and hide (also partially) the other answers?

1 Reply
Alvina
Moderator
(@alvina)
Joined: 5 years ago

Member
Posts: 1862

@plc123,

I'm sorry, but no.

Alvina
Posts: 1862
Moderator
(@alvina)
Member
Joined: 5 years ago

Hi @plc123

The above-mentioned functions are available now. You just need to update the wpForo plugin to the latest version(v.1.7.7).