Search Results for 'code'
-
AuthorSearch Results
-
June 6, 2016 at 1:48 am #175425
In reply to: bbPress 2.5.9
Robkk
ModeratorI already replied to your topic here about the bbpress.php file in your theme. As for the bbP Default theme package template files in bbPress, there were no changes from 2.5.8 to 2.5.9, 2.5.9 was mainly an update to a security issue involving at-mention functionality.
In the future when the release of 2.6 happens, you would have to edit some files. It would be quite easy to
1. compare the new 2.6 templates and compare them to your modified files
2. make those changes to a copy of the 2.6 templates
3. test them to see if everything is in working order in a testing environment
4. update to bbPress 2.6 on your main production site (after taking a backup of course)
5. and then push the template files to your child theme using FTPAs for the text editor issue above from the other user, I think they just modified their footer.php file in their theme and accidentally removed
<?php wp_footer(); ?>, and then that screwed up all the scripts and styles hooked into the footer.June 5, 2016 at 5:26 am #175403In reply to: switching roles on different forums
Robin W
ModeratorAs author of ‘private groups’ this is quite do-able but would take a bunch of code. The problem is that whilst for those that want this it is seen as critical, the actual demand for this functionality is quite low.
The core code is really quite straightforward – you just check what permissions a user has on a forum. and go from there.
Like most plugins, writing the ‘settings page’ is what takes the time – probably a weeks worth of evenings to do this.
I might get round to this at some stage, but my time has to fit around paid IT work !
June 5, 2016 at 5:17 am #175402In reply to: This Forum Is Empty
Robin W
Moderatorit is in
bbpress\includes\forums\template.php line 2021
But the easiest way to change it is to put this into your functions file :
function change_translate_text( $translated_text ) { $text = 'This forum is empty.' ; if ( $translated_text == $text ) $translated_text = 'new text here' ; return $translated_text; } add_filter( 'gettext', 'change_translate_text', 20 );and change ‘new text here’ to the wording you want
June 4, 2016 at 12:02 pm #175387In reply to: Import PHPBB: wrong authors
giobby
ParticipantAfter further investigations I’ve found a workaround that should work.
Just to recap on the error: it seems like several posts are left with the old phpBB poster id rather than using the new wordpress user_id (which really makes me think that somewhere in the converter code a wrong reference has been used).
The best way to work around the issue is the following (assuming a fresh installation):
1) before migration
– check what is the highest user_id in your phpBB installation (e.g.: 6235)
– insert a dummy row in wp_users with id grater than that (e.g.: 6236, or even better, round it up to 10000). In this way all the converted users will have their IDs starting from a higher value (e.g.: 10001, 10002, …) and it will be easy to spot the posts with wrong author (e.g. post_author < 10000).2) launch migration as usual
3) after migration, create a temporary table that lists all the bbpress posts with wrong author/* Get all posts with wrong author and correspondent right author from bbpress translator table */ create table TMP_ORPHANS as select wp_posts.ID, wp_posts.post_author, wp_bbp_converter_translator.value_id real_author, IFNULL(wp_posts.post_date, NULL) post_date, IFNULL(wp_posts.post_date_gmt, NULL) post_date_gmt, wp_posts.post_content, CASE WHEN wp_posts.post_type = 'reply' THEN (SELECT tmposts.post_title from wp_posts as tmposts where tmposts.id = wp_posts.post_parent) ELSE wp_posts.post_title END post_title, wp_posts.post_excerpt, pescasubac, wp_posts.quea.wp_posts.post_status, wp_posts.comment_status, wp_posts.ping_status, wp_posts.post_password, wp_posts.post_name, wp_posts.to_ping, wp_posts.pinged, IFNULL(wp_posts.post_modified, NULL) post_modified, IFNULL(wp_posts.post_modified_gmt, NULL) post_modified_gmt, wp_posts.post_content_filtered, wp_posts.post_parent, wp_posts.guid, wp_posts.menu_order, wp_posts.post_type, wp_posts.post_mime_type, wp_posts.comment_count, ( select wp_postmeta.meta_value from wp_postmeta where wp_postmeta.meta_key = '_bbp_author_ip' and wp_postmeta.post_id = wp_posts.id ) user_ip from wp_posts left join wp_users on wp_posts.post_author = wp_users.id left join wp_bbp_converter_translator on wp_posts.post_author = wp_bbp_converter_translator.meta_value where wp_posts.post_type in ('forum', 'reply', 'topic') and (wp_users.id is null or wp_users.id = 1) and /* all posts of type forum looks to be assigned to the site admin (id=1 in my case)*/ wp_bbp_converter_translator.value_type = 'user' and wp_bbp_converter_translator.meta_key = '_bbp_old_user_id'; /* this is to be able to create indexes later */ ALTER TABLE TMP_ORPHANS modify column post_date datetime default NULL; ALTER TABLE TMP_ORPHANS modify column post_date_gmt datetime default NULL; ALTER TABLE TMP_ORPHANS modify column post_modified datetime default NULL; ALTER TABLE TMP_ORPHANS modify column post_modified_gmt datetime default NULL; ALTER TABLE TMP_ORPHANS modify column user_ip varchar(40); ALTER TABLE TMP_ORPHANS modify column post_title varchar(255); /* indexes to speed up access to the table (some are useless) */ ALTER TABLE TMP_ORPHANS ADD INDEX(post_date); ALTER TABLE TMP_ORPHANS ADD INDEX(post_author); ALTER TABLE TMP_ORPHANS ADD INDEX(real_author); ALTER TABLE TMP_ORPHANS ADD INDEX(user_ip); ALTER TABLE TMP_ORPHANS ADD INDEX(post_title);4) Now that you’ve got the list of posts with wrong authors, you can update your wp_posts table accordingly
/* Revert bad authors to good authors */ UPDATE wp_postsINNER JOIN TMP_ORPHANS ON wp_posts.id = TMP_ORPHANS.id set wp_posts.post_author = TMP_ORPHANS.real_author where wp_posts.post_type in ('reply', 'topic') ;Final consideration:
– this workaround seems to be working for me, but of course I don’t assume any responsibility in case it doesn’t work for you. The update trusts the converter table generated by the bbpress forum converter and assumes that a wrong author id matches the original author id of phpBB forum (I executed some checks and it seems like the problem is always the same = phpBB author id rather than new wordpress author id).
– the update doesn’t fix posts of type ‘forum’ because by default these are assigned to the wordpress site administrator. If you wish to assign them to the original phpBB author, just modify the where condition:
where wp_posts.post_type in ('forum','reply', 'topic') ;message to the developers: I truly believe somewhere in the converter code a wrong reference is used under certain conditions. The pattern of the error is always the same: when the author doesn’t match it’s because the author id of the phpBB forum rather than the new converted author id.
June 3, 2016 at 10:44 pm #175383In reply to: How to hide the word “ago” from freshness…
lflier
ParticipantHere is a straightforward approach to abbreviating the time. Just put it in your functions.php file. You can modify the abbreviations as you wish:
add_filter( 'bbp_get_time_since', 'abbreviate_time' ); function abbreviate_time ( $output ) { $output = str_replace( 'minutes', 'min', $output ); $output = str_replace( 'minute', 'min', $output ); $output = str_replace( 'hours', 'hr', $output ); $output = str_replace( 'hour', 'hr', $output ); $output = str_replace( 'weeks', 'wk', $output ); $output = str_replace( 'week', 'wk', $output ); $output = str_replace( 'months', 'mo', $output ); $output = str_replace( 'month', 'mo', $output ); $output = str_replace( 'years', 'yr', $output ); $output = str_replace( 'year', 'yr', $output ); return $output; }June 3, 2016 at 12:44 pm #175370In reply to: Freshness URLs Broken
Robin W
Moderatorok, I’ve had a quick look.
The page number is set by this line
$reply_page = ceil( (int) bbp_get_reply_position( $reply_id, $topic_id ) / (int) bbp_get_replies_per_page() );I suspect that bbp_get_replies_per_page is not the issue, but that bbp_get_reply_position is.
so this function is as follows :
function bbp_get_reply_position( $reply_id = 0, $topic_id = 0 ) { // Get required data $reply_id = bbp_get_reply_id( $reply_id ); $reply_position = get_post_field( 'menu_order', $reply_id ); // Reply doesn't have a position so get the raw value if ( empty( $reply_position ) ) { $topic_id = !empty( $topic_id ) ? bbp_get_topic_id( $topic_id ) : bbp_get_reply_topic_id( $reply_id ); // Post is not the topic if ( $reply_id !== $topic_id ) { $reply_position = bbp_get_reply_position_raw( $reply_id, $topic_id ); // Update the reply position in the posts table so we'll never have // to hit the DB again. if ( !empty( $reply_position ) ) { bbp_update_reply_position( $reply_id, $reply_position ); } // Topic's position is always 0 } else { $reply_position = 0; } } // Bump the position by one if the lead topic is in the replies loop if ( ! bbp_show_lead_topic() ) $reply_position++; return (int) apply_filters( 'bbp_get_reply_position', $reply_position, $reply_id, $topic_id ); }so given that you seem fine with accessing the database, and hoping you are fine with editing files and uploading these, let’s see what value are being set in this function. I presume you can edit files, and you say you have a ‘safe’ area in which to play.
so lets start with
$reply_position = get_post_field( 'menu_order', $reply_id );which is set on line 1742 of includes/replies/template.php
Now we can filter and play with this function, but it is probably easier just to edit the file whilst we test – just take a copy of it before so you can restore at the end.
So I’d add a line after 1742 saying
update_option( 'encide', $reply_position ) ;save and upload, and then display a page which works and one that doesn’t and each time you can access wp_options in the database and look for the encide option name.
That should tell you what it is set to.
I’d suspect that it is not correct for the faulty ones, and is returning 1 or 0 – hence no pagination.
Come back and let me know what it says, and we can progress from there.
June 3, 2016 at 10:10 am #175357Sybre Waaijer
ParticipantThanks for confirming Robin!
As
WP_Query::is_searchis a public variable, why don’t we simply alter it in real-time within bbPress itself? This will make sure people won’t need an external fix :), and it will leave plugin/theme developers out of question and responsibility.June 3, 2016 at 10:07 am #175356jglemza
ParticipantYou can pull this off by hiding the 3rd li. Something like this should do the trick.
body.page #bbpress-forums li:nth-child(3) { display: none; }June 2, 2016 at 7:21 pm #175341Sybre Waaijer
ParticipantHi there!
As the title suggests, when dumping
$wp_query/$querythroughpre_get_posts, theis_searchvalue is set to true.I don’t believe this should be happening, as this can break compatibility with Search specific alterations.
June 2, 2016 at 6:27 pm #175339In reply to: Freshness URLs Broken
timsilva_
Participant@robin-w I do have access to phpmyadmin. I have been looking around, and the only thing that looks fishy is that the “guid” varchar(255) row has my old local environment in the URL instead of my live domain. So it is http://localhost/forum/topic/title/ when it should be http://example.com/forum/topic/title/ – But after I tried to correct that for the post and the postmeta of the thread’s latest reply (in a safe environment) it didn’t seem to fix the problem. I did notice that my old local URL was hardcoded over 220,000 times in my database though, I wonder if this is something that needs to be corrected for each topic/reply.
I tried to get creative by changing the “Replies Per Page” in wp-admin > Settings > Forums to a different number. That successfully recalculated the correct number of pages required for the non-affected threads (I set it from 15 replies per page to 30 replies per page, so a thread with 10 pages was updated with 5 pages, and the latest reply link updated to point to page 5), but the affected threads still have no “/page/##/” segment in the URL.
June 2, 2016 at 11:57 am #175328newguy
ParticipantRight now I am hosting my site locally but here is an example of my code of my paper:
Title of Paper
Section 1 of paper:
Paragraph:
[bbp-single-topic id=1]Section 2 of paper:
Paragraph:
[bbp-single-topic id=2]etc…
I want the ability to have the readers comment after every section. But when I created the “BBP Topic” and use the “id” it automatically displays a blank comment(which I do not want). Do you know if this is possible?
Thank you for your help.
June 2, 2016 at 11:00 am #175326In reply to: Correlating WP roles with BBPress roles
Robin W
ModeratorAlso I am not sure there is a visitor WordPress role.
oops… no there isn’t – old code left on my test site !
and who gets what were just examples 🙂
June 2, 2016 at 10:37 am #175325In reply to: Correlating WP roles with BBPress roles
Robkk
ModeratorI say edit Robin’s code and change
if ($role == 'subscriber' ) $new_role = 'bbp_spectator' ;To this.
if ($role == 'subscriber' ) $new_role = 'bbp_participant' ;And in my opinion you should not auto-assign moderators and just manually update the users roles for each of the users you trust to moderate the forums. Also I am not sure there is a visitor WordPress role.
https://codex.wordpress.org/Roles_and_Capabilities#Summary_of_Roles
June 2, 2016 at 10:27 am #175323Robin W
ModeratorNot really sure what you are doing.
Can you give us a link to a page showing the issue, and post the content of that page – ie the shortcodes etc. that is creating it.
June 2, 2016 at 9:14 am #175320In reply to: Correlating WP roles with BBPress roles
Robin W
Moderatornot tested, but the following in your functions file should do it
you’ll need to edit the code for which role does what
add_action('wp_login', 'rew_assign_role_on_login', 10, 2); //this function assigns user to bbp roles on login function rew_assign_role_on_login($user_login, $user) { $user_id = $user->ID ; $role = get_role($use_id) ; if (empty ($role)) return ; //has no role in the database if ($role == 'administrator' ) $new_role = 'bbp_keymaster' ; if ($role == 'editor' ) $new_role = 'bbp_moderator' ; if ($role == 'author' ) $new_role = 'bbp_moderator' ; if ($role == 'contributor' ) $new_role = 'bbp_participant' ; if ($role == 'visitor' ) $new_role = 'bbp_blocked' ; if ($role == 'subscriber' ) $new_role = 'bbp_spectator' ; bbp_set_user_role( $user_id, $new_role) }June 2, 2016 at 8:30 am #175317In reply to: Correlating WP roles with BBPress roles
Robin W
Moderatorit would be code-able, but I don’t know of anything that does this already
June 1, 2016 at 1:03 am #175288In reply to: How to fix avatar and author layout
Robkk
ModeratorHere is some CSS to float the forum subscribe link to the right. You can also just display in block to make the link just have its own row.
This css will fix some padding issues for lists in your bbPress forum.
#bbpress-forums li { padding-bottom: 0; }Since I couldn’t really read what was in the red oval I hope this helps.
May 31, 2016 at 5:08 pm #175281Steve Keller
ParticipantHey Rob…
I figured it out…hadn’t realized that it was a matter of using short code on a Forums page. It is crazy that there are so many aspects one can customize when you have the bbp Style Pack.
Thanks,
SteveMay 31, 2016 at 4:37 pm #175280In reply to: New topic emails bug on sublevel domains
Brandon Allen
ParticipantThe unit tests are passing, so my guess is that it’s a problem with a plugin, or (less likely) your PHP setup. The
$_SERVER['SERVER_NAME']doesn’t include the protocol (http:// or https:// in most cases), so that shouldn’t be an issue.My guess is that there is some other plugin that’s filtering
bbp_get_do_not_reply_addressincorrectly. Maybe even some code in your theme’s functions.php file. Could provide a list of the plugins you’re using. Specifically, bbPress or email related plugins?May 31, 2016 at 2:08 am #175261In reply to: move Forum Subscribe link/button to right
Brandon Allen
ParticipantYou can use either of these to disable subscriptions.
Forum Subscriptions
add_filter( 'bbp_get_forum_subscribe_link', '__return_false' );Topic Subscriptions
add_filter( 'bbp_get_topic_subscribe_link', '__return_false' );May 31, 2016 at 1:21 am #175256In reply to: Show User/Member Join Date
Robkk
ModeratorYeah I think it is better for profiles.
Add this hook to the function.
add_action( 'bbp_template_after_user_profile', 'rkk_add_register_date' );May 31, 2016 at 12:50 am #175251In reply to: bbPress not on dashboard
Robkk
ModeratorTry some plugin and theme troubleshooting since this is the most common.
May 31, 2016 at 12:36 am #175248In reply to: Show status label for bbPress Topics with No Replies
Robkk
ModeratorAdd
&& !bbp_is_topic_closed()to the functions if statements after the zero and before the).May 31, 2016 at 12:32 am #175247In reply to: Terms and Conditions plus profile
Robkk
ModeratorThis plugin might work for terms and conditions.
This is an example of adding inputs for contacts in their profile.
May 31, 2016 at 12:23 am #175243In reply to: Missing Gravatar images
Robkk
ModeratorI do see them, they seem oddly big though.
This CSS is causing that issue. This class is used throughout bbPress for its avatars.
a.bbp-author-avatar { background-size: cover; padding: 35px; display: block; max-width: 100px; } -
AuthorSearch Results