Search Results for 'code'
-
AuthorSearch Results
-
January 3, 2021 at 12:12 pm #217199
In reply to: User Statistics
Robin W
Moderatorok, so final amendment needed, as if you deactivate wp-approve-user then the latest user will be forevermore the last one you approved before decativating the plugin.
If you open the wp-approve-plugin you’ll see the core file wp-appprove-user.php
open this and you’ll see a line 29 which says
class Obenland_Wp_Approve_User extends Obenland_Wp_Plugins_V4 {
so we know that the wp-approve-plugin sets up a class called ‘Obenland_Wp_Approve_User’, so we can use the existence of this class to know if wp-approve-use is active or not.
This is common to many plugins and a good way to ensure parts of code that use another plugin only fire if that plugin is active.
so now we can change the ‘get_uses’ to only add the meta_data is the class exists
//set up $args with core arguments needed $args = array( 'number' => 1, 'fields' => array("user_login", "ID", "display_name"), 'orderby' => "registered", 'order' => "DESC", ) ; //add additional meta data to $args if wp-approve-user is active if (class_exists ('Obenland_Wp_Approve_User')) { $args ['meta_key'] = 'wp-approve-user' ; $args ['meta_value'] = '1' ; } //then do the lookup $latest_user = get_users($args) ;
January 3, 2021 at 8:49 am #217194In reply to: Remove underline from Topics
Robin W
Moderatortry
a.bbp-topic-permalink { text-decoration: none: !important; }
I’d add this after your css lines above.
January 3, 2021 at 8:45 am #217193In reply to: bbPress Topics for Posts comment
Robin W
ModeratorI am just a guy who sites in his kitchen and writes code for enjoyment, and I like to try and help others on the forums.
I do not get paid to do this, I have no connection with bbpress and all code (inc wordpress and bbpress) is offered under OSF, which is that it is free, open source to allow others to amend it, and offered with no support and no warranty that it does anything.
bbpress authors are free to decide what they put in their code, as am I. I do not suggest what should be in bbpress, nor do I consider that they should take any notice of me.
The topics for posts plugin has not been updated for a while because the authors do not choose to do so, that is their right, it is free code offered at the point of publishing. You are free to learn php and update and amend it as you wish.
I am not author of topics for posts, I have just been granted access as I wish to update it, which I will do when I am ready to do so.
January 3, 2021 at 7:15 am #217191In reply to: User Statistics
Robin W
Moderatorok, so the function within that code that gets the latest user is this
$latest_user = get_users( array( 'number' => 1, 'fields' => array("user_login", "ID", "display_name"), 'orderby' => "registered", 'order' => "DESC" ) );
so this function brings users ordered by registered – DESC means latest is listed first, and number=>1 means just retrieve one, so this gets the latest.
so we just need to add a lookup to say that this must also have meta ‘wp-approve-user’ set to 1 so we amend the function to
$latest_user = get_users( array( 'number' => 1, 'fields' => array("user_login", "ID", "display_name"), 'orderby' => "registered", 'order' => "DESC", 'meta_key' => 'wp-approve-user', 'meta_value' => '1' ) );
This (untested) should work for your site.
I don’t plan to support this plugin, but am happy to have it on my site to allow others to use it.
Given that many many other plugins might set meta data it is not possible to cater for all, so I’ll just host the previous version. Anyone downloading will be via this thread so they can see how to update it to cater for the approve plugin.
January 3, 2021 at 6:59 am #217190In reply to: User Statistics
Chuckie
ParticipantI have just checked the database and wp-approve-user is always 1 with the exception of one record where it is empty. I assume this is the person that registered on my site this morning whom I have not approved.
so we just need the latest user who has been approved
Correct, but, if this will be part of the plugin you sponsor on your site it will need to factor if for the old way I guess too. Unless this becomes a custom code change just for me.
January 3, 2021 at 5:38 am #217188In reply to: User Statistics
Robin W
Moderatorthat was exactly what I meant – now we know what changes, so to code we need to find out which user is being displayed and get that data.
so as you say it will be something like
$approve = get_meta_data ($user_id, 'wp-approve-user', true) ;
presume you mean ‘latest user’ – not keen to load the plugin to my test site as I’m mid something else – so we just need the latest user who has been approved, or do you mean something else?
January 3, 2021 at 5:38 am #217187In reply to: User Statistics
Chuckie
ParticipantSo it calls:
private function section_latestuser() { // Grab the latest registered user on the site return $this->tag_replace( $this->parent->option["title_text_latestuser"] ); }
Which in turn calls:
function get_latestuser( $html ) { $latest_user = get_users( array( 'number' => 1, 'fields' => array("user_login", "ID", "display_name"), 'orderby' => "registered", 'order' => "DESC" ) ); $latest_user = reset( $latest_user ); // Default display is the full name $name = $latest_user->display_name; if( $this->parent->option['user_display_format'] == "display_as_username" ) { $name = $latest_user->user_login; } if( $html == true ) { return "<a href=\"" . bbp_get_user_profile_url( $latest_user->ID ) . "\">" . $name . "</a>"; } else { return $name; } }
I think, if “WP Approve User” is installed then we need to somehow modify the array returned to only include those where the are approved (as per my previous email).
January 3, 2021 at 5:36 am #217186Topic: Remove underline from Topics
in forum Themesuksentinel
ParticipantI am running a little custom CSS custom code to underline all my Hyperlinks on my BBPRESS forum, which work well, but I now wish to not underline Topics – can anybody advise addition code needed ?
Thanks:
main a {
text-decoration: underline !important;
}Site: uktechhub.com
January 3, 2021 at 5:12 am #217181In reply to: User Statistics
Chuckie
ParticipantFurther to last message, I don’t know if the code I showed you can be improved?
As mentioned, I have “WP Approve User” installed. I have checked the meta data for a given user in the database and if “wp-approve-user” is not set to “1” then they should not be listed in the “newest users” bit of the statistics.
That “build_html” code needs to be modified somehow.
January 3, 2021 at 4:54 am #217179multi65
ParticipantI see…so there is no way to relocate the form to another page with free code?
January 2, 2021 at 12:23 pm #217170In reply to: User Statistics
Chuckie
ParticipantYes, I have the code. And originally it was available and after I made my first concern about it exposing usernames when it shouldn’t somebody decided (somehow) to lock it online in the plugin repository.
This is my current plugin (with my corrected code discussed above):
https://www.dropbox.com/s/vjovpjnk22gxcct/bbpress-improved-statistics-users-online.zip?dl=0
January 2, 2021 at 12:00 pm #217169In reply to: How can I hide the form in bbp-single-forum?
Robin W
Moderatorfind
wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.phptransfer this to your pc and edit
find line 45
<?php bbp_get_template_part( 'form', 'topic' ); ?>
and delete this line and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %your-theme-name% is the name of your theme
Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
wp-content/themes/%your-theme-name%/bbpress/content-single-forum.phpbbPress will now use this template instead of the original
January 2, 2021 at 9:25 am #217165In reply to: User Statistics
Chuckie
ParticipantI think he is on about the statistics one where you showed me the needed code changes and said someone clone the plugin.
January 2, 2021 at 4:33 am #217155Robin W
Moderatorthere probably is but beyond free code.
December 30, 2020 at 4:45 pm #217118In reply to: bbPress forum as homepage
maskis
ParticipantThank you for your answer!
You were right, most of my problems were due to not having sidebar on the homepage. This is now fixed!
I encountered now more frustrating problem. When I use the shortcode above on my homepage, the forum is displayed in default template. In the actual Forum-pages the template is alternate forum template 1 (I´m using bbPress Style Pack plugin). I would like the homepage view to be alternative forum template 1 too.
In Style Pack plugin “Not Working?” section reads as follows:
“It’s not working !!
It may be as simple as closing and restarting your browser, so try this first !!If that doesn’t work…
Background
Style pack works with many/most sites, but it can fail due to a myriad of reasons, including (but no means limited to) site permissions, php versions, other plugins and most often site themes where the theme author has altered bbpress files.This is no-ones fault – whilst I can control how bbpress performs, there are many thousands of plugins and themes, all of which may be trying to amend the same stuff as I am, and many host poviders who will have differing but equally valid permission and code versions.
Problem finding
1. “caching” software that speeds up the download of your site, but may not recognise and immediately make changes from my pluginDo you know if you are using caching software? If so then try refreshing, purging or deactivating to see if this fixes.
If you still have the issue, we need to work out which parts are working and which not
We need to look at 2 areas – files and css
2. Files
If your theme author has changed bbpress files in his theme, this will be for valid reason, which may relate to either style or functionalityNo bbpress files have been changed in the theme
3. CSS
If css had loaded then the text below will have a green background, if it has not loaded this will be a red backgroundThis sentance should have a green background
If the background is red, then try amending the “css location” tab above
check the activate box and set the location to
wp-content/uploads/
and save these changes
and then come back and re-check this area.”I´m not using any cache plugin at least to my knowledge. I´ve also tried to unactivate all of the other plugins than bbPress, Style Pack and BuddyPress. This makes no difference.
Can´t find any settings that would force the homepage view on the theme to be any different than on any other sections of my site.
Any clues, what could I do to fix the problem?
December 30, 2020 at 3:57 pm #217117In reply to: Artefacts above and below forum list in 20 16 theme
Robin W
Moderatorif I had to guess, I’d probably guess that you are using [bbp-forum-index] on a gutenberg block page, and that you have either not used the shortocde block, or have code blocks in the page.
The bits in your pasteboard are before bbpress fires
December 30, 2020 at 1:27 pm #217110In reply to: bbPress forum as homepage
Robin W
ModeratorI suspect that your homepage just needs to have the correct sidebar applied to it, so yes you would use the shortcode as you suggest, but in dashboard>pages>homepage you will need to allocate a sidebar
December 30, 2020 at 7:07 am #217094In reply to: How to make forums look better/prettier
quix8
ParticipantThanks for this post, But I think for
6. Load the style sheet after bbpress
The correct way is this:
/** * load custom bbpress css after bbp default css */ wp_enqueue_style( 'custom-bbpress', get_stylesheet_directory_uri() . '/css/custom-bbpress.css',array('bbp-default'),'1.1','all');
December 29, 2020 at 5:15 pm #217084Topic: bbPress forum as homepage
in forum Pluginsmaskis
ParticipantHi!
And thank´s for great plugin!
I have tried to change my forum page to be my site´s homepage using shortcode [bbp-topic-index]. I can make my forum index come up in a box in my homepage, but it is missing all the extra´s in the forum pages (ie. latest posts, latest topics, etc.). Is there a way to really set a forum page to be homepage of my site?
I have the newest versions of WP and bbPress, and I´m running on newest version of Customizr theme.
My homepage is http://www.maltaasta.fi (a Finnish homebrewing site) and I would like the visitors to get straight to my forum in http://www.maltaasta.fi/keskustelupalsta
December 29, 2020 at 2:26 pm #217078In reply to: bbPress profile page add custom page menu
Robin W
Moderatorok, doing that using url’s is well beyond free help or indeed my knowledge of wordpress/bbpress.
The code can be amended to pass a $_REQUEST of say ‘loginname’
you can then create a page in wordpress, and use a shortcode to hook to php code that would look up the login name and display data related to that user, but then you have to have an area to create that data and store it in the database, or let the user create – so you would need creation/edit/delete pages and code.
It is all quite doable but well beyond free help
December 29, 2020 at 1:48 pm #217075In reply to: bbPress profile page add custom page menu
Robin W
Moderatorsorry I am confused …I can give you code to go to any url, but unless you create some content for that url, it will 404.
what are you expecting it to do when you click that link ?
December 29, 2020 at 1:41 pm #217073In reply to: bbPress profile page add custom page menu
Robin W
Moderatoradd_action( 'bbp_template_after_user_details_menu_items', 'rew_add_item' ); function rew_add_item () { ?> <ul> <li class="pictures"> <span class="pictures-link"> <?php $username = bbp_get_user_nicename(bbp_get_displayed_user_id()); echo '<a href="http://localhost/projects/wpdev2/forums/users/'.$username.'/my-stories/">Click to show picture</a>' ; ?> </span> </li> </ul> <?php }
December 29, 2020 at 1:25 pm #217069In reply to: bbPress profile page add custom page menu
Robin W
Moderatorsorry, I don’t fully understand – the code will take you to any url you want.
do you mean user specific?
or if you got it working in buddypress what code did you use there?
or maybe describe what you want to achieve?
December 29, 2020 at 1:13 pm #217067In reply to: bbPress profile page add custom page menu
Robin W
Moderatoradd_action( 'bbp_template_after_user_details_menu_items', 'rew_add_item' ); function rew_add_item () { ?> <ul> <li class="pictures"> <span class="pictures-link"> <a href="https://prnt.sc/wcemvm">Click to show picture</a> </span> </li> </ul> <?php }
December 29, 2020 at 1:05 pm #217064In reply to: bbPress profile page add custom page menu
Robin W
Moderatorok, so you could use the hook in the standard template to add the item in a plugin
<?php do_action( 'bbp_template_after_user_details_menu_items' ); ?>
-
AuthorSearch Results