Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
Notifications
Clear all

[Solved] Only give points in selected forums

6 Posts
2 Users
0 Reactions
2,084 Views
Posts: 6
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@langel87)
Active Member
Joined: 5 years ago
[#7271]

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: 6645
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@astgh)
Illustrious Member
Joined: 8 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: 5 years ago

Active Member
Posts: 6
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

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

Thanks!


Posts: 6
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@langel87)
Active Member
Joined: 5 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: 8 years ago

Illustrious Member
Posts: 6645
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@langel87,

So may I mark this topic as solved? 


(@langel87)
Joined: 5 years ago

Active Member
Posts: 6
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

@astghik Sure! Thanks!


Share:
Scroll to top