Customize post fields

1 week 6 days ago - 1 week 6 days 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.

Please Log in to join the conversation.

1 week 4 days 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
$_PLUGINS->trigger( 'activity_onDisplayActivityStreamNew', [ $rowStream, &$row, &$form ] )
Edit Post
$_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
$_PLUGINS->trigger( 'activity_onBeforeUpdateStreamActivity', [ $rowStream, $source, &$row, $old ] );
After Edit Post
$_PLUGINS->trigger( 'activity_onAfterUpdateStreamActivity', [ $rowStream, $source, $row, $old ] );
Before New Post
$_PLUGINS->trigger( 'activity_onBeforeCreateStreamActivity', [ $rowStream, $source, &$row ] );
After New Post
$_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.
$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.
$_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 to join the conversation.

1 week 11 hours 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 to join the conversation.

1 week 11 hours 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 to join the conversation.

4 days 14 hours 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 to join the conversation.

4 days 12 hours 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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.239 seconds

Facebook Twitter LinkedIn