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

[Closed] I would like to add a new feature to my wpforo

4 Posts
2 Users
0 Reactions
3,519 Views
Posts: 2
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
(@primevil)
New Member
Joined: 8 years ago
[#5972]

Hello, 

I would like to add two buttons next to the "Tools" and "RSS" buttons in the top of the topics. These two buttons are only to show up in a specific forum and can be seen/accessed only with people with right permissions. I have already started looking through the code, but I would really appreciate if I could get a hand on this, since, I hope, some of you guys might have already worked on something like this. 

Regards, 

Marko


3 Replies
Robert
Posts: 10752
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
(@robert)
Support Team
Joined: 3 months ago

We've added new hooks in wpForo theme posts.php template file for each layout, these hooks will be available with next version. You can put those manually in post.php of each layout on your end.

  • wpforo_topic_head_left
  • wpforo_topic_head_right

You can use these hooks and add buttons. This hook also passes current forum and topic data with array:

$forum:

Array ( [forumid] => # [title] => # [slug] => # [description] => # 
[parentid] => # [icon] => # [last_topicid] => # [last_postid] => #
[last_userid] => # [last_post_date] => # [topics] => # [posts] => #
[permissions] => # [status] => # [is_cat] => # [cat_layout] => #
[order] => # [url] => # ) 

$topic:

Array ( [topicid] => # [forumid] => # [first_postid] => # [userid] => # 
[title] => # [slug] => # [created] => # [modified] => # [last_post] => #
[posts] => # [votes] => # [answers] => # [views] => # [type] => # [closed] => #
[has_attach] => # [private] => # [status] => # [name] => # [email] => #)

As for permission, you should manage it yourself. wpForo doesn't have custom permission creating options yet. You should control displaying of custom buttons based on your custom functions.

 

 


Posts: 2
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
(@primevil)
New Member
Joined: 8 years ago

Oh, wow, those functions look awesome. Looking forward to it! 🙂

Thanks for the response, I've only now seen it, after I've done it myself. I've added custom hooks and changed most of the code (added only, tho), and I've backed it up, so I can do it again on the next update. 😀

Could you tell me is there a way to preserve those changes (not unlike child theme work) for plugins? 

 

Take care and thanks again. 🙂


Robert
Posts: 10752
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
(@robert)
Support Team
Joined: 3 months ago

Just change custom hooks to the hook I mentioned in the screenshot. So you'll not have any issue with update.


Share: