Skip to Content Skip to Menu

Customize post fields

  • fioresns
  • fioresns
  • OFFLINE
  • Posts: 56
  • Thanks: 5
  • Karma: 0
6 months 2 weeks ago - 6 months 2 weeks ago #338035 by fioresns
Customize post fields was created by fioresns
Hello, is there a way to add some fields in the main page (activity)?
I'd like to put some checkboxes or dropdown menus or a second little textbox.
Last edit: 6 months 2 weeks ago by fioresns. Reason: I changed the post because the previous question had answers searching aroundI

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 months 2 weeks ago #338043 by krileon
Replied by krileon on topic Customize post fields
Not without writing code to implement that. The activity form can be extended with the following triggers.

New Post
Code:
$_PLUGINS->trigger( 'activity_onDisplayActivityStreamNew', [ $rowStream, &$row, &$form ] )
Edit Post
Code:
$_PLUGINS->trigger( 'activity_onDisplayActivityStreamEdit', [ $rowStream, &$row, &$form ] )

There's 2 options for this trigger. Either manually append to $form or just return your custom input and it'll be inserted automatically. This can be done using CB Auto Actions. For CB Auto Actions var1 is the activity stream object, var2 is the activity object itself, and var3 is just the form array.

Now that display is handled you'll need to save the data. The below triggers handle the save process.

Before Edit Post
Code:
$_PLUGINS->trigger( 'activity_onBeforeUpdateStreamActivity', [ $rowStream, $source, &$row, $old ] );
After Edit Post
Code:
$_PLUGINS->trigger( 'activity_onAfterUpdateStreamActivity', [ $rowStream, $source, $row, $old ] );
Before New Post
Code:
$_PLUGINS->trigger( 'activity_onBeforeCreateStreamActivity', [ $rowStream, $source, &$row ] );
After New Post
Code:
$_PLUGINS->trigger( 'activity_onAfterCreateStreamActivity', [ $rowStream, $source, $row ] );

For CB Auto Actions var1 is again the activity stream object, var2 is the source object for the post (e.g. if this is a groupjive group post this would be the group object), var3 is the activity object itself. The easiest way to store custom data is to just push it into params storage for the activity post, but you can implement whatever storage you want. Example of pushing data to storage.
Code:
$row->getParams()->set( 'my_custom_field', 'value_for_my_field' );

As for displaying custom content it can either be done using template files or using the below trigger.
Code:
$_PLUGINS->trigger( 'activity_onDisplayActivity', [ &$stream, &$row, &$layout[ 'title' => &$title, 'caret' => &$caret, 'date' => &$date, 'message' => &$message, 'content' => &$content, 'media' => &$media, 'header' => &$header, 'footer' => &$footer, 'menu' => &$menu, 'compact' => &$compact, 'isDetails' => false, 'isNew' => $isNew, 'isRow' => $isRow, 'isModal' => $isModal, 'isInline' => $isInline, 'isSimple' => $isSimple, 'isEmbed' => $isEmbed, ] ]

The $layout array gives access to multiple positions to insert content. Alternatively just returning content on usage of this trigger will insert content into a post.

A backend UI to add new form elements won't be implemented until sometime after CB 3.x development is complete as we have to generalize our field management (we already have plans for doing this) so fields can be used anywhere instead of just profiles.

I can provide additional instructions or even a simple example using the above if needed, but beyond that you'll need the coding experience to implement anything further.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • fioresns
  • fioresns
  • OFFLINE
  • Posts: 56
  • Thanks: 5
  • Karma: 0
6 months 1 week ago #338098 by fioresns
Replied by fioresns on topic Customize post fields
Wow, that was some answer! Thank you!
I have little experience with coding, but still I don't get WHERE should I insert the triggers.
 

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 months 1 week ago #338099 by krileon
Replied by krileon on topic Customize post fields
They're either used in a custom CB plugin or within CB Auto Actions via the Triggers parameter.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • fioresns
  • fioresns
  • OFFLINE
  • Posts: 56
  • Thanks: 5
  • Karma: 0
6 months 1 week ago #338106 by fioresns
Replied by fioresns on topic Customize post fields
I'm gonna try this, but I really think I'm gonna need you again.
Eventually I'll come back and refer.
Thank you

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
6 months 1 week ago #338107 by krileon
Replied by krileon on topic Customize post fields
I'll be able to help you to a limited extent. We only provide custom coding support for Business subscribers. I should be able to provide simple examples at the very least. The below topic is doing similar by adding a new feature to CB Activity and could be of use.

www.joomlapolis.com/forum/developer-members-support/246448-cb-activity-api-usage-update?start=12#336528


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: fioresns

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum