new tab and bo activity stream
This topic contains 12 replies, has 2 voices, and was last updated by Paolo 9 years ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
April 17, 2015 at 8:30 pm #37436
I have created a new tab on the listings detail page and would like to display the authors activity stream on it, would this be hard to do? Can anybody point me in the right direction?
Would i simply call in the activity loop within the functions.php file?
ThanksApril 17, 2015 at 8:43 pm #37438Hi,
yes using the user_id as filter.
To get the author ID of a listing, you can use get_the_author_meta
Here you can find examples: https://codex.buddypress.org/developer/loops-reference/the-activity-stream-loop/#filtering-examples
Thanks
April 17, 2015 at 8:52 pm #37440Thanks paolo,
just to give me a kick in the right direction can you explain where i would put the following code.This is my add new tab in functions.php
<?php add_filter('geodir_detail_page_tab_list_extend', 'geodir_detail_page_tab_list_extend') ; function geodir_detail_page_tab_list_extend($tab_array) { $tab_array['my_new_tab'] = array( 'heading_text' => __('New Tab',GEODIRECTORY_TEXTDOMAIN), 'is_active_tab' => false, 'is_display' => apply_filters('geodir_detail_page_tab_is_display', true, 'my_new_tab'), 'tab_content' => '' ); return $tab_array ; } add_action('geodir_after_tab_content' ,'geodir_my_new_tab_content'); function geodir_my_new_tab_content($tab_index) { if($tab_index =='my_new_tab') { echo "Hello world!!"; } } ?>
where would i add the following basic activity loop?
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : ?> <?php while ( bp_activities() ) : bp_the_activity(); ?> <?php locate_template( array( 'activity/entry.php' ), true, false ); ?> <?php endwhile; ?> <?php endif; ?>
Thanks
April 17, 2015 at 9:01 pm #37442Something like that.
if($tab_index =='my_new_tab') {?> <?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) ) ) : ?> <?php while ( bp_activities() ) : bp_the_activity(); ?> <?php locate_template( array( 'activity/entry.php' ), true, false ); ?> <?php endwhile; ?> <?php endif; } ?>
Thanks
April 18, 2015 at 12:59 am #37455I am really stuck with this and i just can’t figure it out,
I dont know how to get the php to display on the tab its self, i just keep getting errors, I even tried to add a simple bit of code to get the user id and i got an error!
I have wasted far to much time on this, say i wanted to add this code the my new tab;<?php function get_user(){ global $bp; $username = $bp->loggedin_user->id; echo $username; } get_user(); ?>
how would i add it to the new tab?
April 18, 2015 at 1:06 pm #37490Any help guys…?
April 18, 2015 at 4:52 pm #37498Hi Urbanfix,
to do that, you should ask for support on the buddypress forum, don’t you think?
The function you need is not part of our plugin and we don’t support 3rd party plugins.
Our responsability is to tell you how to create the new GD tab and how to put new content in it.
To write a function for another plugin to actually create the content is part of your job.
Thanks
April 18, 2015 at 5:47 pm #37500okay fair enough,
In that case could you tell me how to add this<?php function get_user(){ global $bp; $username = $bp->loggedin_user->id; echo $username; } get_user(); ?>
into my new tab?
April 18, 2015 at 6:29 pm #37503This should work:
add_action('geodir_after_tab_content' ,'geodir_my_new_tab_content'); function geodir_my_new_tab_content($tab_index) { if($tab_index =='my_new_tab') { global $bp; $username = $bp->loggedin_user->id; echo $username; } }
Let us know,
Thx
April 22, 2015 at 9:21 am #37787Could i use a shortcode on the tab?
I am using this plugin; http://buddydev.com/plugins/bp-activity-shortcode/
Can i use the shortcode to add it to the tab i created?
ThanksApril 22, 2015 at 3:27 pm #37795Yes that should be possible using the do_shortcode wordpress function: https://codex.wordpress.org/Function_Reference/do_shortcode
Let us know how you went!
Thanks
October 27, 2015 at 4:26 pm #58161This was successful,
Thankyou,
UF!October 27, 2015 at 4:28 pm #58164You are welcome. 🙂
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket