Notifications
Clear all

[Solved] Is the number following "wpf_t_private_" unique to a forum?

5 Posts
2 Users
1 Likes
1,474 Views
Posts: 12
Topic starter
(@christophera)
Eminent Member
Joined: 1 year ago

Hi,

I have a specific forum that will be for private support threads. I want to make the "private topic" checkbox for posts in that forum checked by default (then I'll hide it by css just to make sure no one changes it).

I'm considering doing this using php to replace:

<input id="wpf_t_private_63c757f83277e" name="thread[private]" type="checkbox" value="1">

with

<input id="wpf_t_private_63b74af86477e" checked name="thread[private]" type="checkbox" value="1">

Is the number following "wpf_t_private_" unique to each forum? If so, I can do a search for that and add the "checked". 

If not, any other suggestions on how to best do this? 

Thanks, 

Chris

4 Replies
Posts: 12
Topic starter
(@christophera)
Eminent Member
Joined: 1 year ago

Wow, 460+ views so far and know one knows.... I guess I don't ask easy questions!  🤣 

Posts: 12
Topic starter
(@christophera)
Eminent Member
Joined: 1 year ago

Apparently that id is not specific to a forum, I finally had some time to really test it and my idea did not work. 

I'm still interested in trying to get this behavior though - have one particular forum that where all topics are 'private' between the user and admin/moderators. 

Any suggestions on how to do that, paid or unpaid? 

Thanks, 

Chris

1 Reply
Chris
(@chris)
Joined: 3 years ago

Famed Member
Posts: 3650

Hi @christophera,

You can add these codes in your Active themes functions.php file or Use Snippets Plugin to make it work on the Website.

For all forum's solution:

add_action('wpforo_editor_topic_submit_before', function(){
   echo '<input type="hidden" name="thread[private]" value="1">';
});

 

For specific forum when forum ID is a 21

add_action('wpforo_editor_topic_submit_before', function( $forum ){
    if( 21 === (int) wpfval( $forum, 'forumid' ) ) echo '<input type="hidden" name="thread[private]" value="1">';
});

 

For specific forum ID's when forum ID is a 21 or 5 or 33

add_action('wpforo_editor_topic_submit_before', function( $forum ){
   if( in_array( (int) wpfval( $forum, 'forumid' ), [ 21, 5, 33 ], true ) ) echo '<input type="hidden" name="thread[private]" value="1">';
});
Posts: 12
Topic starter
(@christophera)
Eminent Member
Joined: 1 year ago

Sorry for the late reply, been down sick - Thank you!