Plugin Development Questions?

  • Hello,

    I have couple of questions to understand how it works and how I must develop;

    1- How can I get logged in user information through PHP?

    2- How can I create a new thread using PHP?

    3- How can I customize thread list, so they will have images for uploaded topics?

    4- And last one, I want to add custom fields to thread. How can I create custom fields for threads?

    Thank you

  • I'm trying to understand Woltlab products and structure. If they are suitable for a project or not.

    So are you saying, with trial, its not possible to create a thread?

    If I buy the license, how can I create a thread on WBB 5.0 using PHP?

  • So are you saying, with trial, its not possible to create a thread?

    It's not possible to create a thread via a custom PHP-script, yes. (until you get access to the webspace/the permission to install packages)

    The code for it should be very easy - you might have a look at: https://github.com/WoltLab/com.wo…s.php#L184-L212

    That shows you how to create a new conversation - looks more complicated than it is because it's just a lot of information, but two essential lines of code (211+212).

    3- How can I customize thread list, so they will have images for uploaded topics?

    That would get more complicated if you want to force an icon for every thread. You'd have to implement an upload-form (e.g. something like it's used over here: https://pluginstore.woltlab.com/file-add/) and modify the template in order to replace the user's avatar with the thread's icon.

    4- And last one, I want to add custom fields to thread. How can I create custom fields for threads?

    Maybe something like this?

    woltlab.com/pluginstore/file/2100/
  • First of all thank you for your answers.

    Zitat

    The code for it should be very easy - you might have a look at: https://github.com/WoltLab/com…dForm.class.php#L184-L212

    I've checked the Github link you've provided but I'm a bit confused. Its a code piece related to conversations, which is private messaging system in Woltlab. Am I wrong?

    What I am trying to do is, I want to create a new topic/thread from PHP on Woltlab Burning Board. (Not trying to create a new conversation on private messaging)

    Zitat

    ... and modify the template in order to replace the user's avatar with the thread's icon.

    I'm trying to use the image uploaded as a thread icon inside the thread. (not users avatar)

    My idea is, for specific forum categories, when users are going to start a new thread (which my plan is to it on custom php code) users will either upload an image or provide the link for the image. I'll access link and get the image (or user will upload image) using PHP.

    Later I'll show the received images as thread icon on that forum category.

    For the last one (thread icons) please check this link: http://forums.cgsociety.org/forumdisplay.php?f=121

    As you can see it shows the uploaded images as thread icons. If you click one link you will see the actual size of the uploaded image.

    Thats why I asked custom fields for new threads/topics. I need to have some custom fields (mostly text input) to be asked on new threads for specific categories.

    It looks a bit complicated but these are the basic ideas that I'm going to implement. And I'm looking the ways to achieve it.

    • Offizieller Beitrag

    There are some more or less obvious placeholders in the above lines, especially the data-array contains quite a few values that you'll have to adjust. The code assumes that your PHP file is located right in the root of the forum installation, otherwise you'll have to adjust the path to the global.php.

    Alexander Ebert
    Senior Developer WoltLab® GmbH

  • Thank you Alexander Ebert and also thank you MysteryCode

    Now, going into deeper and darkness begins :)

    I've access userid, checked login, created a new thread. Thats cool so far.

    Btw, here is the reference code for creating a thread and checking user login. These will help people for similar issues:

    Einmal editiert, zuletzt von aliveli (17. November 2017 um 10:20) aus folgendem Grund: Changed $threadAction->create(); method to $threadAction->executeAction();

  • Note that it's actually `wbb\data\thread\ThreadAction->executeAction()` instead of create

    Thanks jens1o for the feedback.

    I'm trying to create a new page/form to create a new thread using same design/style/template.

    I've checked ThreadAction class (ThreadAction.class.php) and threadAdd template (threadAdd.tpl) files. There are lots of system logic related to permission checks, censored words checks, codes related to Multilingualism, tagging, captcha lots of stuff related to wbb system. (which are normal to be there to provide those wbb functionalities)

    Is there a simple way to use ThreadAction class and template or must I re-implement/re-call the same logic & use a similar designed template file to get things done?

  • Why are you trying to reinvent the wheel?

    That's what I'm not trying to do exactly! :)

    I want to get a similar structure like this thread list: http://forums.cgsociety.org/forumdisplay.php?f=121

    To get that functionality, I need to do couple of things:

    1- Check user login and redirect if not logged in.

    2- Show user a create thread like form with new fields that I need to add. (Specially text input, getting URL information of the picture and couple of more text inputs)

    3- Later I'll create a new thread with the information user gave (of course including thread topic, thread content, attachments etc.) including custom information (URL of the picture, the other information that I'll get from user input).

    4- And finally I want to show the pictures as thread icons as seen on this example: http://forums.cgsociety.org/forumdisplay.php?f=121

    That's why I asked questions to understand WCF and WBB frameworks structures, developing and integrating custom requirements, showing in a similar design/style/template.

    Could you describe what exactly you want to do and what would be different to the original form/template? :)

    So as a result, I will ask couple of more inputs like URL of the picture, some text inputs from user, that's why I'm trying to use ready structure of WCF and WBB.

    I really really don't want to invent the wheel! :)

    Makes sense?

  • Why not creating simply the stuff you need with css?

    You simply want to have the first image uploaded to the new thread as trhwad icon in the thread list, don't you?

    There used to exist a plugin for that.

    Maybe Bibini could link you in the right direction. Cannot find it at the moment.

    And the thread Form plugin, maybe Joshua Rüsweg could give you some hints, maybe it's even possible to recreate it for wbb 5.(1).

    Thanks for the hint Bibini

    Themenvorschaubilder

    aliveli  Sonnenspeer will you develop that plugin for WBB5 / WBB 5.1 as well?

  • Why not creating simply the stuff you need with css?

    You simply want to have the first image uploaded to the new thread as trhwad icon in the thread list, don't you?

    Lycra Well some of them could be done with CSS and basic template customization but some of them is not possible without writing some PHP code.

    First image uploaded to the new thread to be shown as thread icon is one of the things that I'm trying to do.

    But there are other things that i'm trying to do as well.

    User can either give URL of the photo or upload the photo. So if user wants to upload, its already there waiting for him/her to upload :) But if user wants to give the URL I must download that photo URL with PHP and store it on the server. (maybe inside attachment structure or maybe somewhere else)

    Also I need to get input from user like, when did you take this photo? What camera equipment did you use? etc.

    So there will be some inputs which will be filled by the user.

    And finally all information should go into new thread. (Image, camera info, other user custom inputs etc.)

    So I'm trying to understand if I need to create a new page to collect those information and open a new thread by programmatically or is there a way to use Thread Form, Thread Action classes, Attachment Handlers etc.

    I'm working on WCF 3.1 Beta 3, WBB 5.1 Beta 3.

    Thanks for the hint @Bibini


    Themenvorschaubilder

    Thanks for the plugin and suggestions. It looks like its changing the thread icon with uploaded first image (I've used Google Translate to understand). I'll try it. But as I explained above there are other things to do.

    aliveli Sonnenspeer will you develop that plugin for WBB5 / WBB 5.1 as well?

    Yes, my purpose is creating a plugin so if there are new updates on WCF/WBB I can make some little fixes related to migration and keep the functionality working.

  • Sounds good :) maybe Cr@@gle could suggest something to extract the picture info

    Of course. I am really open to suggestions. Because I know some PHP, i can access that URL and download using PHP development. But i want to have an integrated solution using WCF, WBB framework.

    And i must say, before checking WCF/WBB i have checked VBulletin framework. WCF/WBB has a really good code quality. More understandable structures, better framework. I must say thanks to Core Development Team and of course say thanks to the community for providing feedback.:thumbup:

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!