strategeek
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Mystical wpdb query problem. What I’m doing wrong?Hah, I finally found a bug. It was a problem with IDs…
Forum: Developing with WordPress
In reply to: Mystical wpdb query problem. What I’m doing wrong?Hi Djenci. Yes, I’m logged in.
$user_ID = get_current_user_id(); echo ($user_ID);
When I do echo, I get the correct value which is 2
Forum: Plugins
In reply to: [Captcha] How to reload CAPTCHA after ajax form submitGreat! Thanks a lot!
Forum: Plugins
In reply to: [Private groups] How to get forum IDs that are assigned to a private group?Hi Robin. Thank you for the clue!
I have finally made it. Now after user creation, the new user will be automatically subscribed to the forum(s) that belong to the private group which is assigned to the user role.
$name2= $rpg_roles[$user_role]; $forums=$wpdb->get_col("select ID from $wpdb->posts where post_type='forum'") ; foreach ($forums as $forum) { $meta = (array)get_post_meta( $forum, '_private_group', false ); foreach ($meta as $meta2) { if ($meta2==$name2) { if ( !function_exists( 'bbp_add_user_forum_subscription' ) ) { require_once ABSPATH . PLUGINDIR . '/bbpress/includes/users/functions.php'; } $forum_id = $forum; bbp_add_user_subscription($user_id, $forum_id); } } }
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsOk, great, thanks for the answers! If no success on my own, I will probably ask for help again ?? Thanks!
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsI tried this and similar shortcode with style pack plugin but it doesn’t work. Also we try to use as less plugins as possible.
I guess, for now I stick with simple stickies and will try to figure out how to move them to the top when [bbp-topic-index] shortcode is used.
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsHi Robin. I continue playing with stickies and super stickies and it becomes clear that stickies should be used instead of super stickies.
But then there is the same question: how to move stickies to the top of the topics list that is shown by [bbp-topic-index] shortcode? Any ideas?
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsOr, we can just move simple stickies to the top of the whole topics list. We are using this shortcode to display topics: [bbp-topic-index]
Because now the list is displayed: most recent on top. Stickies are treated similar as simple topics.
If we can get stickies to be displayed on top (sort by recent), and then simple topics (sort by recent-as it is now), that would solve the problem.
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsRegarding stickies, unfortunately simple “stick” is not good for our forum, because we treat individual forums more like categories, and so most of the time we see all topics (from different forums-categories) in one page. Individual forums-categories are rarely visited. So we need to use super-stickies in order to highlight the important topics at the top of the whole topics list.
I guess the if statement logic should be something similar to this:
if is_super_sticky && is_in_the_forum_that_user_can_not_access
then redirect to restricted-access.phpCan this work? Any other ideas?
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsHi Robin.
Thank you for the clue. I have figured out how to change role and private group together. Below is the code. Now I will try to play with stickies and super stickies…
if ( !empty( $_POST['role'] ) ) { wp_update_user(array('ID' => $user_id,'role' => esc_attr( $_POST['role']))); global $rpg_roles ; $user_info = get_userdata($user_id); $user_roles = $user_info->roles ; foreach ((array)$user_roles as $list=>$role) { $group = $rpg_roles[$role] ; update_user_meta( $user_id, 'private_group', $group); } }
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsRegarding issue nr.1 I have made a front end user edit screen so that the site admin can edit users without going to the dashboard.
The post method looks like this:
if ( !empty( $_POST['role'] ) ) wp_update_user(array('ID' => $user_id,'role' => esc_attr( $_POST['role'])));
Maybe here I can also add a code to update the user (overwrite the role) also in bbP private group?
Forum: Plugins
In reply to: [Private groups] Role change and Sticky postsHello Robin. Thank you for taking your time to help me with this.
Regarding issue nr.2 I am talking about super-sticky.
Yep, that one is even better. Many thanks!
The suggested solution did not work as expected because it repeated only one tick 50 times, and then another tick 50 times etc. It needed to repeat the whole group of ticks.
We have modified the code in ditty-news-ticker/includes/functions.php after “Randomize the ticks” and before “Close the ticker container” functions, starting on line 182, here is the code:
$all = “”;
$total = count($dnt_ticks);
foreach( $dnt_ticks as $i => $tick ) {$type = ( $_mtphr_dnt_type == ‘mixed’ ) ? $tick[‘type’] : $_mtphr_dnt_type;
$tick = ( $_mtphr_dnt_type == ‘mixed’ ) ? $tick[‘tick’] : $tick;// Set the list spacing depending on the tick position
if( $_mtphr_dnt_mode == ‘list’ ) {
$spacing = ( $i != intval($total-1) ) ? ‘margin-bottom:’.intval($_mtphr_dnt_list_tick_spacing).’px;’ : ”;
}
$spacing = apply_filters( ‘mtphr_dnt_list_tick_spacing’, $spacing, $i, $total );
$tick_style = ( $width != ” || $height != ” || $spacing != ” ) ? ‘ style=”‘.$width.$height.$spacing.'”‘ : ”;
$all = $all . $tick.”????????????????????“;}
do_action( ‘mtphr_dnt_tick_before’, $id, $meta_data, $total, $i );
echo ‘<div’.$tick_style.’ ‘.mtphr_dnt_tick_class(‘mtphr-dnt-‘.$type.’-tick mtphr-dnt-clearfix’).’>’;
do_action( ‘mtphr_dnt_tick_top’, $id, $meta_data );echo str_repeat($all,50); //repeat 50 times
do_action( ‘mtphr_dnt_tick_bottom’, $id, $meta_data );
echo ‘</div>’;
do_action( ‘mtphr_dnt_tick_after’, $id, $meta_data, $total, $i );}
Thanks for the help!
Issue resolved ??Thank you for a fast reply.
The problem is that our site is designed for users and users are the ones who update the ticker. So it would be very difficult to explain them to duplicate ticks and I believe they will not like that.
Maybe there is a way to edit the code so that all ticks would be duplicated automatically (always)?