Search Results for 'code'
-
AuthorSearch Results
-
May 28, 2021 at 12:45 pm #220903
In reply to: Can’t post replies
Robin W
Moderatorrelevant ones are:
publish_topics
edit_topics
publish_replies
edit_repliesMay 27, 2021 at 5:46 pm #220882In reply to: bbpress responsive problem
salar2
ParticipantHi,
Is this right?#bbpress-forums div.bbp-forum-author img.avatar, #bbpress-forums div.bbp-topic-author img.avatar, #bbpress-forums div.bbp-reply-author img.avatar { float: right !important; }May 27, 2021 at 4:53 pm #220878In reply to: Post by Email & Social Media Integration
Robin W
Moderatorwell you could learn php, some javascript and a little css, work through the security issues of letting users post via email (not sure how you do that), create a receiving handler, and then after many hundreds of hours release the code for free and then support it whilst people bitch about how stupid your plugin is….
May 27, 2021 at 7:26 am #220869biznisoka
ParticipantHi,
Have two bbpress forums on a webpage, a public one, for “usual” registered users, and private one, for “special” registered users.
Used bbp private groups plug-in to create both groups.
Would like to hide private forum menu item from the general registered users (not redirect to some custome page on something).
Asked the question on plugin’s support page, but got no answer.
Is there any code snippet or something I could use to hide the menu item which opens private forum? Now i get 404 error.May 27, 2021 at 4:03 am #220866In reply to: How can I not to record IP adress
Robin W
ModeratorThis should do it
add_filter( 'bbp_current_author_ip', '__return_false' ) ;if it doesn’t then
add_filter( 'bbp_current_author_ip', 'rew_remove_ip' ); function rew_remove_ip () { $retval = 0 ; return $retval ; }Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
May 26, 2021 at 5:22 am #220858In reply to: BBPress Front-End Add Forum
dredarsenic
ParticipantHi there, my issue is similar to this, but maybe you can enlighten me.
I’m using bbPress for the forum on my site.
On the front end, users should be able to submit a topic on a forum, when they try, they get a “A name is required for this term.” error, I have already reset the forum, but still has the same thing.
Also the despite that message, the topic will appear in the WP admin dashboard under Topics, but will never show in the forum on the front end, I would like the topic created by users on the front end to appear immediately in the front end as well, any idea of code I can add to the functions.php of the theme or anything I can do ?May 21, 2021 at 12:32 pm #220775In reply to: Notify user when a reply goes into moderation
Chuckie
ParticipantThanks for your code. It has been so long now when I asked this that i am reluctant to start fiddling with my setup.
I prefer to continue to wait until such a time and bbPress is updated rather than add bits of code to my functions file.
At the moment what I have works for me due to the bsp settings that were added some time back.
Thank you for the code though.
May 21, 2021 at 9:39 am #220772In reply to: Notify user when a reply goes into moderation
Marcus (aka @msykes)
ParticipantHi All, I posted this on the trac ticket too, in case others are interested:
I’ve taken a slightly different approach to Robin, for me I only have logged in users on my forums, and I want to show the pending reply with a warning so the user knows it’s pending but exists. The below will show pending replies to the author who wrote them and a warning to the author that the reply is pending, as well as adding a warning specific to moderators so they clearly know to moderate it.
Hope it helps someone!
/** * Modifies the SQL query for reply loops so that reply authors can view their own replies that are still pending * @param $where string * @param $wp_query WP_Query * @return string */ function bbp_allow_members_pending_view( $where, $wp_query ){ global $wpdb; $type = $wp_query->query_vars['post_type']; if( $type == bbp_get_reply_post_type() && !current_user_can('moderate') && is_user_logged_in() ){ // check reply here $user_id = get_current_user_id(); $find = "{$wpdb->prefix}posts.post_author = $user_id AND {$wpdb->prefix}posts.post_status = 'private'"; $replace = $find . $wpdb->prepare(" OR {$wpdb->prefix}posts.post_author = %d AND {$wpdb->prefix}posts.post_status = %s", $user_id, bbp_get_pending_status_id()); $where = str_replace( $find, $replace, $where ); } return $where; } add_action('posts_where', 'bbp_allow_members_pending_view', 10, 2); /** * Shows a warning above pending replies, different warning for mods and the author. */ function my_bbp_allow_members_pending_view_warning(){ if( bbp_get_reply_status() == bbp_get_pending_status_id() ){ if( current_user_can('moderate') ){ $warning = 'This reply is pending moderation, approve so others can see it or trash it!'; }elseif( bbp_get_reply_author_id() == get_current_user_id() ){ $warning = 'This reply is pending moderation, others will see it once a moderator approves it.'; } if( !empty($warning) ){ echo '<div class="bbp-template-notice notice"><ul><li>'.$warning.'</li></ul></div>'; } } } add_action( 'bbp_theme_before_reply_content', 'my_bbp_allow_members_pending_view_warning');May 21, 2021 at 7:14 am #220770In reply to: bbpress responsive problem
Leoart
ParticipantIt’s because avatar image has
position: absolute. You have to override or modify this rule. There are a few ways how to handle it depending on where you want to show avatar. You need to play with CSS a bit.May 20, 2021 at 1:12 pm #220755In reply to: Logged-in User’s Gravatar to show on header.
kwk
ParticipantI’m new to coding and do not know much about these things. I would like the avatar or gravatar to show on the right corner of my header.
First of all, do I need to put this code <<get_avatar( wp_get_current_user(), 32 );>> in my header.php file?
And do I need to write some CSS code to style it?May 19, 2021 at 1:55 pm #220707In reply to: Forum page critical Error
Robin W
ModeratorThis appears to be a paid theme, so i have no access to it.
I suggest you try
item 8
May 19, 2021 at 1:46 pm #220706In reply to: Simplest possible user to user PM plugin
Robin W
ModeratorI can’t say for sure as I’ve not used that plugin.
But bbpress and worpdress have lots of capabilities to put code where you wish, so
1. exactly where do you want it to go?
2. Do you know how to do a button linking to the page?May 18, 2021 at 9:53 am #220673In reply to: Logged-in User’s Gravatar to show on header.
Robin W
Moderatordepends on what you mean by ‘solution’ 🙂
get_avatar( wp_get_current_user(), 32 );May 18, 2021 at 3:50 am #220665In reply to: send all subscribers an email once
Robin W
ModeratorThis still works as far as I know
it it is not perfect, the code wold get you most of the way to what you want
May 17, 2021 at 5:10 pm #220655In reply to: Simplest possible user to user PM plugin
Robin W
ModeratorThere are tens of thousands of themes, and tens of thousands of plugins. It would be impossible to test every combination. I can’t say that bbpress has been tested with Avada !!
As long as both theme and plugin adhere to basic standards, then it is likely that they will work together.
The plugin is a subset of code from within buddypress, so if you have buddypress you don’t need the plugin.
May 17, 2021 at 2:22 pm #220650In reply to: bbp_get_user_topic_count returns incorrect number
Anonymous User 18731058
InactiveHi Robin,
Unfortunately, the code you’ve provided isn’t working for me. However, bbp_get_user_topic_count_raw and bbp_get_user_reply_count_raw work fine, so I’ve replaced the functions using JavaScript.<?php $topicCount = bbp_get_user_topic_count_raw(wp_get_current_user()->ID); $replyCount = bbp_get_user_reply_count_raw(wp_get_current_user()->ID); ?> <script> var topicCount = document.querySelector('.bbp-user-topic-count'); var replyCount = document.querySelector('.bbp-user-reply-count'); if(topicCount){topicCount.innerHTML = 'Topics Created: ' + '<?php echo $topicCount ?>'} if(replyCount){replyCount.innerHTML = 'Replies Created: ' + '<?php echo $replyCount ?>'} </script>May 17, 2021 at 1:26 pm #220644In reply to: bbp_get_user_topic_count returns incorrect number
Robin W
Moderatoryes, this has been happening for a while (it happens on this site!) , and I’ve not got round to looking at why until you posted (I am a bbpress user who helps out here, not one of the bbpress authors).
I’ve just dug into the code and created a trac fix ticket for it
https://bbpress.trac.wordpress.org/ticket/3429#ticket
in the meantime, this code fixes the problem
add_filter ('bbp_bump_user_topic_count' , 'rew_new_topic_count', 10 , 4) ; function rew_new_topic_count ($user_topic_count, $user_id, $difference, $count) { //check if count is 2 and should be 1 by seeing if user topic count is empty!! if ($user_topic_count==2 && empty (bbp_get_user_topic_count( $user_id, true )) )$user_topic_count = 1 ; return $user_topic_count ; } add_filter ('bbp_bump_user_reply_count' , 'rew_new_reply_count', 10 , 4) ; function rew_new_reply_count ($user_reply_count, $user_id, $difference, $count) { //check if count is 2 and should be 1 by seeing if user topic count is empty!! if ($user_reply_count==2 && empty (bbp_get_user_reply_count( $user_id, true )) )$user_reply_count = 1 ; return $user_reply_count ; }Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
May 16, 2021 at 2:57 pm #220625biznisoka
ParticipantI can’t find the solution for custom redirect when forgot password form is sent (the form with only one field, your username or email, and “get new password” button, which triggers the email with the reset password link in it, which then opens the reset password form).
The reset password form which has two fields, “new password” and “repeat new password” (and buton save password). I solved the reset password redirect with code snippet
function wpse_lost_password_redirect() { wp_redirect( 'myurl' ); exit; } add_action('password_reset', 'wpse_lost_password_redirect');But it doesn’t work for the lost password form. Is there also a redirect function for forgot password, which I could use?
Have WP 5.7.2., bbpress 2.6.6., also use themeMyLogin plugin.
Thanks in advance!
May 16, 2021 at 1:24 pm #220623In reply to: Logout error when bbPress plugin is active
biznisoka
ParticipantChanged the theme, but the issue was still there.
I now found this solution, it worked for me:
add_action('wp_logout','ps_redirect_after_logout'); function ps_redirect_after_logout(){ wp_redirect( 'your url here' ); exit(); }May 16, 2021 at 10:47 am #220612In reply to: Logged-in User’s Gravatar to show on header.
Robin W
ModeratorThis code is from version 1 of bbpress, so probably no longer works.
May 15, 2021 at 5:49 pm #220603In reply to: Logged-in User’s Gravatar to show on header.
kwk
ParticipantPlease, how did you use the code <<echo bb_get_avatar( bb_get_current_user_info( ‘id’ ), 32 )>> to display the avatar or gravatar of the logged-in user in the header. Any explanation on what to do?
May 15, 2021 at 7:11 am #220601In reply to: Adding post meta to user replies
Robin W
ModeratorI saw your one before the edit.
I put this in my form-reply
<input name="toggle-check" id="toggle-check" type="checkbox" value="value">helloand this in my theme’s functions file
add_action( 'bbp_new_reply_post_extras', 'rew_reply_checkbox' ); add_action( 'bbp_edit_reply_post_extras', 'rew_reply_checkbox' ); function rew_reply_checkbox ($reply_id) { //and probably set the value to a $_POST parameter you set in the form if (! empty($_POST['toggle-check'] ) ) { $myvalue = $_POST['toggle-check'] ; } else $myvalue='empty' ; update_post_meta ($reply_id , 'toggle-check', $myvalue) ;and that works fine
May 14, 2021 at 6:02 pm #220595In reply to: Adding post meta to user replies
vincenzon617
ParticipantSorry, I should have been more clear. I did post a reply but it got deleted while I was trying to get the code in the correct format to make it clearer to read!
The form that I am adding to is within the ‘form-reply.php’ file and I have the checkbox working fine. The struggle I have is that even when the checkbox is clicked the
$_POST['my_parameter']is always empty and so the wrong value is being added as metadata. I have looked up some solutions to this, and the majority of them are suggesting it is something to do with the “action” part of the form, so I am wondering if this is the case or possibly something else?If you would like me to post the code I will try again!
May 14, 2021 at 5:09 pm #220593In reply to: Adding post meta to user replies
Robin W
Moderatorok, I’m very confused.
if you are adding this code to a form, then it is already in a form, so you don’t need the <form…
you’d just need to code I put above ie
echo '<p class="whatever"> <input name="my_parameter" id="my_parameter" type="checkbox" value="whatever_value_you_want" checked="checked"> <label for="whatever">Tick this box to do whatever</label> </p>' ;maybe you could post the entire form you are trying to change, and indeed say where/what it is?
May 14, 2021 at 3:55 pm #220592In reply to: Adding post meta to user replies
vincenzon617
ParticipantI have been implementing this feature to my site today and I have managed to add the metadata to the database however, I can’t seem to be able to receive the POST variable. I have added this checkbox within the form:
<form id="new-post" name="new-post" method="post" action="<?php the_permalink(); ?>">. This is the form used to get the user’s reply but as you can see the ‘action’ is set to<?php the_permalink(); ?>. Would this still allow me to access the variable within my functions.php file or will I have to change the action / create another form and submit button?Many thanks
-
AuthorSearch Results