Forum Replies Created
-
Author
-
orbitkillerParticipant
Hi,
i finally did a whole solution for this issues, at least to the best of my knowledge.
My Code:
COPY CODE<?php /******************************************************************* :: Extends functions.php ********************************************************************/ /** * @author orbitkiller * @function get num rows of db tables / buddypress group / blog count by row */ function ok_get_row_count( $table_name ) { //$table_name -> db table to count the rows of global $wpdb; $array = $wpdb->get_results( "SELECT * FROM $table_name"); $rows = mysql_num_rows($count); //simple array iteration with count to retrieve row count $rows = 0; foreach ($array as $key => $value) { $rows++; } return $rows; } /** * @author orbitkiller * @function adds shortcode support to get user and group count for animated kleo numbers */ function ok_get_option_shortcode( $theme_option ) { return get_option( $theme_option['key'] ); } add_shortcode( 'get-theme-option', 'ok_get_option_shortcode' ); /** * @author orbitkiller * @function bp add group count and blog count to custom options */ //create options add_option( "_ok_bp_member_count", 0, "", "yes"); add_option( "_ok_bp_group_count", 0, "", "yes"); add_option( "_ok_bp_blog_count", 0, "", "yes"); //add_option( "_ok_bp_message_count", 0, "", "yes"); //get bp group count and blog count /* db table names for extended counts display bp active members -> wp_bp_groups_members bp active groups -> wp_bp_groups bp blogs -> wp_bp_user_blogs bp written messages -> wp_bp_messages_messages */ $okBPmembers = ok_get_row_count("wp_bp_groups_members"); $okBPgroups = ok_get_row_count("wp_bp_groups"); $okBPblogs = ok_get_row_count("wp_bp_user_blogs"); //$okBPblogs = ok_get_row_count("wp_bp_messages_messages"); //update options update_option( "_ok_bp_member_count", $okBPmembers); update_option( "_ok_bp_group_count", $okBPgroups); update_option( "_ok_bp_blog_count", $okBPblogs); //update_option( "_ok_bp_message_count", $okBPblogs); ?>
Hope i could help.
Bye
CharelorbitkillerParticipantHi, i developed a solution myself, it is not yet finished but it should get you (people that want to use it) an idea.
Animated Kleo Numbers
######
Issue: Kleo shortcode only lets you animated static number. What we want is to get these animated numbers in real dynamicallyMy Solution:
functions.php EDIT/ADD
######COPY CODE/** * @author orbitkiller * @function adds shortcode support to get user and group count for animated kleo numbers */ function ok_get_option_shortcode( $theme_option ) { return get_option( $theme_option['key'] ); } add_shortcode( 'get-theme-option', 'ok_get_option_shortcode' ); Use de following Option shortcode to retrieve the wanted data ###### [get-theme-option key="<yourOptionNameYouWantDataFrom>"] KLEO Animated Number Shortcode MODIFIED ###### members [kleo_animate_numbers animation="animate-when-almost-visible" timer="3000"][get-theme-option key="_transient_bp_active_member_count"][/kleo_animate_numbers] public blogs [kleo_animate_numbers animation="animate-when-almost-visible" timer="3000"][get-theme-option key="blog_public"][/kleo_animate_numbers]
Further issues
######
For group count and active topics i did not find any option, but i am developing a function that retrieves these count values and i will put them into custom option.
I did not have much time today, i will post this function in the coming days to complete this solution…Hints
#######
Where to find option names / options store data -> /wp-admin/options.php (when logged-in)
Can be applied to other displayable values if needed/wanted…Have fun.
Charel -
AuthorPosts