Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,026 through 2,050 (of 32,460 total)
  • Author
    Search Results
  • #217199

    In reply to: User Statistics

    Robin W
    Moderator

    ok, 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) ;
    #217194
    Robin W
    Moderator

    try

    a.bbp-topic-permalink {
    text-decoration: none: !important;
    }

    I’d add this after your css lines above.

    #217193
    Robin W
    Moderator

    I 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.

    #217191

    In reply to: User Statistics

    Robin W
    Moderator

    ok, 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.

    #217190

    In reply to: User Statistics

    Chuckie
    Participant

    I 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.

    #217188

    In reply to: User Statistics

    Robin W
    Moderator

    that 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?

    #217187

    In reply to: User Statistics

    Chuckie
    Participant

    So 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).

    #217186
    uksentinel
    Participant

    I 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

    #217181

    In reply to: User Statistics

    Chuckie
    Participant

    Further 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.

    multi65
    Participant

    I see…so there is no way to relocate the form to another page with free code?

    #217170

    In reply to: User Statistics

    Chuckie
    Participant

    Yes, 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

    #217169
    Robin W
    Moderator

    find
    wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.php

    transfer 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%/bbpress

    where %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.php

    bbPress will now use this template instead of the original

    #217165

    In reply to: User Statistics

    Chuckie
    Participant

    I think he is on about the statistics one where you showed me the needed code changes and said someone clone the plugin.

    Robin W
    Moderator

    there probably is but beyond free code.

    #217118
    maskis
    Participant

    Thank 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 plugin

    Do 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 functionality

    No 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 background

    This 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?

    #217117
    Robin W
    Moderator

    if 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

    #217110
    Robin W
    Moderator

    I 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

    #217094
    quix8
    Participant

    Thanks 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');
    #217084
    maskis
    Participant

    Hi!

    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

    #217078
    Robin W
    Moderator

    ok, 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

    #217075
    Robin W
    Moderator

    sorry 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 ?

    #217073
    Robin W
    Moderator
    add_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	
    }
    #217069
    Robin W
    Moderator

    sorry, 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?

    #217067
    Robin W
    Moderator
    add_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	
    }
    #217064
    Robin W
    Moderator

    ok, 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' ); ?>

Viewing 25 results - 2,026 through 2,050 (of 32,460 total)
Skip to toolbar