Notifications
Clear all

[Solved] Only give points in selected forums

6 Posts
2 Users
0 Likes
872 Views
Posts: 6
Topic starter
(@langel87)
Active Member
Joined: 3 years ago

Hi again!

I'm following the answer they gave me on the pre-order page of the plugin, which said this:

You can use the hook-code proviede below:

add_filter(“mycred_add”, function ($execute, $data) {
if (($ref = wpfval($data, ‘ref’)) && ($forumid = intval(wpfval(WPF()->current_object, ‘forumid’))) && $ref === ‘wpforo_add_post’ && in_array($forumid, array(1, 2, 3))) {
$execute = false;
}
return $execute;
}, 10, 2);

Just change the value of the boldly marked part. Replace those with the Forum IDs there you don’t need to add the points.

My question is, where is this code added? Since I put it in the functions of my theme, adding the ID of the forums in which I do not want give points, but it does not work.

Thanks!

5 Replies
Astghik
Posts: 5911
Admin
(@astgh)
Illustrious Member
Joined: 6 years ago

@langel87,

We've checked the code one more time it works fine. Please make sure you've inserted the correct code in the correct section. Please leave screenshots or video with the changes you've made. 

1 Reply
(@langel87)
Joined: 3 years ago

Active Member
Posts: 6

@astghik Could you tell me where to add the code, in what file?

Thanks!

Posts: 6
Topic starter
(@langel87)
Active Member
Joined: 3 years ago

I have found the problem, the single and double quotes were backwards, here is the code:

add_filter("mycred_add", function ($execute, $data) {
if (($ref = wpfval($data, 'ref')) && ($forumid = intval(wpfval(WPF()->current_object, 'forumid'))) && $ref === 'wpforo_add_post' && in_array($forumid, array(1,2,3))) {
$execute = false;
}
return $execute;
}, 10, 2);
2 Replies
Astghik
Admin
(@astgh)
Joined: 6 years ago

Illustrious Member
Posts: 5911

@langel87,

So may I mark this topic as solved? 

(@langel87)
Joined: 3 years ago

Active Member
Posts: 6

@astghik Sure! Thanks!

Share:
Scroll to top