kalesco
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Conference Schedule] Multi-days ConferenceThank you, but this also shows the time column in each block. As I would like to have the blocks side by side, this does not work for me. Also, the blocks side by side break the layout of the day column, already tried this. there’s an issue with a float, which is not cleared I think.
I will try to re-arrange the columns in the output file.
Forum: Plugins
In reply to: [WP Conference Schedule] Spurious closing div?Thank you, this helped me!
Forum: Plugins
In reply to: [WP Conference Schedule] Multi-days ConferenceI have the same question!
I have tried to use tracks for the different days, but then the mobile view is off, because the tracks get mixed while sorted by time (which makes sense for tracks).care to share what the problem/solution was? Thank you!
wallyO: just wanted to thank you for the question and the resolution ??
had the same problem, I guess I would not have tried just clicking the save button.I added this to the mycred-widgets.php.
It shows either the current or the last month, depending on the widget setting. Don’t know if it will work for you, but I hope it helps to point you in the right direction.
/** * CURRENT MONTH * @since 1.2 * @version 1.0 */ if ( !class_exists( 'myCRED_Widget_This_Months_Leaderboard' ) ) { class myCRED_Widget_This_Months_Leaderboard extends WP_Widget { // Constructor public function __construct() { $name = apply_filters( 'mycred_label', myCRED_NAME ); // Basic details about our widget $widget_ops = array( 'classname' => 'widget-mycred-this-months-leaderboard', 'description' => __( 'Show the leaderboard for the current month.', 'mycred' ) ); $this->WP_Widget( 'mycred_widget_this_months_leaderboard', __( 'This months Leaderboard', 'mycred' ), $widget_ops ); $this->alt_option_name = 'mycred_widget_this_months_leaderboard'; } // Widget Output (what users see) public function widget( $args, $instance ) { extract( $args, EXTR_SKIP ); // Check if we want to show this to visitors if ( !$instance['show_visitors'] && !is_user_logged_in() ) return; // Get the leaderboard $leaderboard = $this->get_leaderboard( $instance['number'], $widget_id, $instance['month'] ); //if ( !isset( $leaderboard[ date_i18n( 'W' ) ] ) ) return; // Load myCRED $mycred = mycred_get_settings(); // Start constructing Widget echo $before_widget; // Title (if not empty) if ( !empty( $instance['title'] ) ) { echo $before_title; // Allow general tempalte tags in the title echo $mycred->template_tags_general( $instance['title'] ); echo $after_title; } if ( !empty( $instance['month'] ) ) { //echo $instance['month']; //setlocale(LC_TIME, 'de_DE'); if ($instance['month'] == 'this') echo '<h5 style="text-align:center; margin: 1em;">'.strftime("%m/%Y", strtotime("this month")).'</h5>'; if ($instance['month'] == 'last') echo '<h5 style="text-align:center; margin: 1em;">'.strftime("%m/%Y", strtotime("last month")).'</h5>'; } // Construct unorganized list for each row echo '<table style="width: 70%;margin: 0 auto;text-align:center"><thead><tr><th style="text-align:center; width:10%;">Position</th><th style="text-align:center; width:60%;">Name</th><th style="text-align:center">Punkte</th></tr></thead>'; $rang = 1; foreach ( $leaderboard as $position => $data ) { echo '<tr><td>'.$rang.'</td><td>' . $data->display_name . '</td><td> ' . $mycred->format_creds( $data->total ) . '</td></tr>'; $rang++; } echo '</table>'; echo $after_widget; } // Widget Settings (when editing / setting up widget) public function form( $instance ) { $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : __( 'This Months Leaderboard', 'mycred' ); $number = isset( $instance['number'] ) ? abs( $instance['number'] ) : 5; $show_visitors = isset( $instance['show_visitors'] ) ? 1 : 0; $month = isset($instance['month']) ? $instance['month'] : 'this'; ?> <p class="myCRED-widget-field"> <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title', 'mycred' ); ?>:</label> <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> </p> <p> <label for="something"><?php _e('Which month:', 'buddypress'); ?> <select name="<?php echo $this->get_field_name( 'month' ) ?>"> <option value="this" <?php if ( $month == 'this' ) : ?>selected="selected"<?php endif; ?> >This month</option> <option value="last" <?php if ( $month == 'last' ) : ?>selected="selected"<?php endif; ?>>Last month</option> </select> </label> </p> <p class="myCRED-widget-field"> <label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php _e( 'Number of users', 'mycred' ); ?>:</label> <input id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" type="text" value="<?php echo $number; ?>" size="3" class="align-right" /> </p> <p class="myCRED-widget-field"> <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_visitors' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_visitors' ) ); ?>" value="1"<?php checked( $show_visitors, 1 ); ?> class="checkbox" /> <label for="<?php echo esc_attr( $this->get_field_id( 'show_visitors' ) ); ?>"><?php _e( 'Visible to non-members', 'mycred' ); ?></label> </p> <?php } // Save Widget Settings public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['number'] = (int) $new_instance['number']; $instance['title'] = trim( $new_instance['title'] ); $instance['show_visitors'] = $new_instance['show_visitors']; $instance['month'] = $new_instance['month']; mycred_flush_widget_cache( 'mycred_widget_this_months_leaderboard' ); return $instance; } // Grabs the leaderboard public function get_leaderboard( $number = 5, $widget_id = '', $month = 'this' ) { $data = array(); // Load the wpdb class global $wpdb; $mycred = $wpdb->prefix . 'myCRED_log'; $SQL = " SELECT m.user_id, u.display_name, sum( m.creds ) AS total FROM {$mycred} m LEFT JOIN {$wpdb->users} u ON u.ID = m.user_id WHERE ( m.time >= %d AND m.time <= %d ) GROUP BY m.user_id ORDER BY total DESC "; if ($month == 'this') { $start_month = strtotime( "first day of this month" ); $end_month = strtotime("last day of this month"); } else { $start_month = strtotime( "first day of last month" ); $end_month = strtotime("last day of last month"); } $data = $wpdb->get_results( $wpdb->prepare( $SQL, $start_month, $end_month, $number ) ); //echo $wpdb->prepare( $SQL, $start_month, $end_month, 10 ); // Excludes $mycred = mycred_get_settings(); foreach ( $data as $row_id => $row_data ) { $row = get_object_vars($row_data); //print("<pre>".print_r($row,true)."</pre>"); // exclude users from myCred exclude list and deleted users (users with no displayname) if ( $mycred->exclude_user( $row['user_id'] ) || $row['display_name'] == '' ) { //echo '<br />excluded: '.$row['user_id']; unset ($data[$row_id]); } } $data = array_slice($data, 0,$number); return $data; } } }
No, I used the workaround and set it explicitly.
Forum: Plugins
In reply to: Limit Page Templates based on User RolesThank you!
I added a check to the function, so that it only changes things for non-admins:function remove_post_custom_fields() { if ( ! current_user_can('manage_options') ) remove_meta_box( 'pageparentdiv' , 'page' , 'side' ); }
I also changed the drop down box for page parents around a bit with custom arguments, found in this
stackexchange.Hi,
thanks for the quick reply.
I managed to change the custom widget you posted for a weekly leaderboard to a monthly ranking. (current month)
It is not perfect, but it does the job.Thank you!
This worked perfectly!Thank you,
I wanted to tweak it in v1.1 so that it would work as planned.
Do you have any code snippet or suggestion what I could change?
I have no problem in changing the plugin code (sorry) as I can’t update it anyway.I took a look at the current versions code, but there must have changed more than just the profile menu code as using the code from the new version didn’t change anything in the behaviour.
I have added a IF around the profile nav item code and it kind of works. It shows the history for admins, but not users. However, it still doesn’t react to the setting.Dear Gabriel,
I have the same problem and for various reasons I cannot update the mycred plugin (breaks other stuff on my site, probably because I can’t update WP either without getting error messages).
Is there any way to hide the profile nav item for the history in Buddypress without updating? A small code change maybe?
Thank you!Forum: Installing WordPress
In reply to: Custom “.html” permalinks