Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 851 through 875 (of 32,468 total)
  • Author
    Search Results
  • #233915
    Robin W
    Moderator

    1. only replies
    2. bespoke code needed

    #233842
    Robin W
    Moderator

    2nd – works in my browser for your site – can you close and reopen and check again, or post a new image showing what is still wrong, and links to an exact example.

    3rd – I don’t know what ‘no output results’ means ??? again it seems to have gone from your site in my browser.

    I did see that I had not taken out the ‘author/posts’ from the footer – you can add this

    .forums.bbp-replies li.bbp-footer {
            display: none;
    }
    #233839

    In reply to: Custom Profile Fields

    scottmotion
    Participant

    First you could try Robin’s bbPress plugin: https://wordpress.org/plugins/bbp-profile-information/
    Same with BuddyPress integration: https://wordpress.org/plugins/bbp-buddypress-profile-information/

    If you’re not using BuddyPress though I would highly recommend looking into it. You can enable “Extended Profile Fields” and there’s also a plugin for custom field types: https://wordpress.org/plugins/bp-xprofile-custom-field-types/

    As far as the outbound links themselves go you might need to code/style them yourself unless your theme automatically converts links.

    #233838
    Robin W
    Moderator

    my code above corrected works, but yes do come back and let us know if you find the problem or need further help

    #233837
    saciojote
    Participant

    Yes I did I noticed that before I tried the code. I will play around and see if I can find the problem, if the get_page_by_title() works as I would like then it must be an error somewhere else.

    Thank you for your help!

    #233835
    Robin W
    Moderator

    put this in the custom css of you theme

    div.bbp-template-notice.info {
    	display: none;
    }
    
    .bbp-pagination-count {
    	display: none;
    }
    
    .forums.bbp-replies li.bbp-header {
            display: none;
    }
    #233827
    Robin W
    Moderator

    ok, based on that I have no idea what you mean by embedding.

    bbpress does not have a ‘login page’ it has shortcodes and widgets.

    the template used by bbpress for login is

    bbpress\templates\default\bbpress\form-user-login.php

    to customise :

    find
    wp-content/plugins/bbpress/templates/default/bbpress/form-user-login.php

    transfer this to your pc and edit as desired

    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/form-user-login.php

    bbPress will now use this template instead of the original

    #233826
    pcwd
    Participant

    Theme my login does not allow embedding.
    As I wrote at the beginning of the post, I would like to customize the bbpress login page.
    Can you help me run that PHP code with Code Snippets?
    Thank you very much!

    #233823
    pcwd
    Participant
    <?php
    if ( ! is_user_logged_in() ) { // Display WordPress login form:
        $args = array(
            'redirect' => admin_url(), 
            'form_id' => 'loginform-custom',
            'label_username' => __( 'Username custom text' ),
            'label_password' => __( 'Password custom text' ),
            'label_remember' => __( 'Remember Me custom text' ),
            'label_log_in' => __( 'Log In custom text' ),
            'remember' => true
        );
        wp_login_form( $args );
    } else { // If logged in:
        wp_loginout( home_url() ); // Display "Log Out" link.
        echo " | ";
        wp_register('', ''); // Display "Site Admin" link.
    }
    ?>

    I entered that code with the Code Snippets Plugin but it didn’t work 🙁

    #233821
    Robin W
    Moderator

    that is a page full of code – so what did you put in?

    #233820
    pcwd
    Participant

    Hi Robin,
    thanks for your reply.

    I entered that code with the Code Snippets Plugin but it didn’t work. Why?

    #233819
    Robin W
    Moderator

    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

    Code Snippets

    #233815
    Robin W
    Moderator

    did you correct the error in this line

    if (!empty ($topic) {

    should be

    if (!empty ($topic)) {

    #233805
    saciojote
    Participant

    Hi Robin, thank you for the example code! I have tried it and it seems to return the same value regardless of the title, so I am unsure…

    Here is the sample code that I have used the function within:

    function return_content_replies() {
    	
    	$title = $_POST['title'];
    	$topic_id = rew_find_topic_id($title);
    	
    	if ( $topic_id == 'empty' ) { 
    	  	// create the topic here
    	} else {
    		$args = array(
    			  'post_parent' => $topic_id, // ID of the topic
    			  'order'       => 'ASC', // Order of the replies (ASC or DESC)
    			);
    			
    			$replies_array = array();
    		
    			if ( bbp_has_replies( $args ) ) {
    			  while ( bbp_replies() ) {
    				bbp_the_reply();
    				$replies_array[] = array(
    				  'id' => bbp_get_reply_id(),
    				  'content' => bbp_get_reply_content(),
    				  'date' => bbp_get_reply_post_date(),
    				);
    			}
    		}
    			$response = array( 'status' => 'success', 'message' => $topic_id);
    	}
    	wp_send_json($response);
    }
    #233793
    Robin W
    Moderator

    if title is unique then

    get_page_by_title()

    untested but something like :

    function rew_find_topic_id ($title) {
    	$topic = get_page_by_title($title, OBJECT, bbp_get_topic_post_type());
    	if (!empty ($topic) {
    		$topic_id = $topic->ID ;
    		return $topic_id ;
    	}
    	else {
    		return 'empty' ;
    	}
    }
    scottmotion
    Participant

    These 3 items show nothing on the user profile Forums tab. Inspector shows that div.bp-user-section is empty, and there is no “Oh bother!” message displayed on the page.
    However, Replies Created DOES show replies or the “Oh bother!” message if empty.

    I know Favorites were displaying when I first set up the site, but now that i’m circling back to deal with notifications and such I just noticed that it is gone. So I can’t say when/how it was broken.

    I ran the forum fixes and purged cache but there was no change. I’ve tried disabling some BP/bbp related plugins but also no luck. I DO have Favorites and Engagements enabled under Settings>Forums. I’ve implemented various pieces of custom code related to BP/bbp but I don’t see how they would interfere with only those 3 items and not the replies.

    Hoping someone might know offhand what could be interfering with this data being displayed, or at least a way to debug it.

    #233765

    Topic: Custom Profile Fields

    in forum Plugins

    I have searched these forums and for the life of me can not find exactly what I am aiming for.

    Basically I run a gaming community. For the most part, everyone uses discord, and the new forum system discord currently has. However our website has been a beacon that has kept us getting back in touch with each other for over 25 year and im trying to not only keep it alive, but adding content.

    Basically I have the WP Discord plugin. I want to have BBPress allow the user to add their specific game names (battle net, steam, EA, Activision IDs) to their website / forum profile. I downloaded and installed the Advanced custom field plugin via wordpress, but it doesm’t seem to work with BBpress. If I make a new page or post I can add the fields, but I am looking more in terms of the wordpress user adding them upon registering on the site, then showing in the BBpress profile.

    I used to modify SMF years ago and played around a lot with different content management forum software, but am fairly new to wordpress itself, and I ABSOLUTELY LOVE how bbpress feels familiar to me. I feel like this is something super simple and easy to accomplish and im just looking in the wrong place.

    On our old SMF forum, I literally had it setup in a URL format to where you would put your Steam username, but then on your profile it would be a clickable link to your steam page. It was super easy and literally required modifying the code 2 or 3 lines to fix once installing a basic plugin for SMF. I feel like this should be easier.

    Can someone please point me in the right direction? Also, thank you all for what you do!

    #233731
    Robin W
    Moderator

    yes

    $replies = bbp_has_replies( $args );

    in \bbpress\includes\replies\template.php

    it has these default args (some set by code above this section)

    $default = array(
    		'post_type'              => $default_post_type,         // Only replies
    		'post_parent'            => $default_post_parent,       // Of this topic
    		'posts_per_page'         => bbp_get_replies_per_page(), // This many
    		'paged'                  => bbp_get_paged(),            // On this page
    		'orderby'                => 'date',                     // Sorted by date
    		'order'                  => 'ASC',                      // Oldest to newest
    		'hierarchical'           => $default_thread_replies,    // Hierarchical replies
    		'ignore_sticky_posts'    => true,                       // Stickies not supported
    		'update_post_term_cache' => false,                      // No terms to cache

    but whatever you pass in $args will overwrite these

    #233725
    saciojote
    Participant

    Is there a function that returns all the replies when the topicID is passed into a function?

    Some example code is below for better understanding of the function I am asking about –

    
    $args = array(
    	'post_parent' => $NUM, // ID of the topic
    	'order'       => 'ASC', // Order of the replies (ASC or DESC)
    	);
    
    $replies = bbp_get_replies_function( $args ); // function i would like
    $response = array(
          	status' => 'success',
          	'message' => $replies,
        	);
    
    #233696
    pcwd
    Participant

    Hi

    I would like to customize the labels on the login page at
    bbpress login, password fields and the button text.

    I see some related PHP code at https://codex.wordpress.org/Customizing_the_Login_Form#Make_a_Custom_Login_Page

    Could you please suggest how to add that code to my website? Thank you so much!

    #233694
    leon1912
    Participant

    Thank you for the reply @robin-w 🙂

    When I select PHP cron event, should I enter the code in there and delete the snippet? Because when I click PHP cron event, a code editor will open.

    #233693
    Robin W
    Moderator

    ok, so delete the previous code and put this code instead

    function bbpress_close_old_topics() {
    	// Auto close old topics
    	$topics_query = array(
    		'author' => 0,
    		'show_stickies' => false,
    		'parent_forum' => 'any',
    		'post_status' => 'publish',
    		'posts_per_page' => -1
    	);
    	if ( bbp_has_topics( $topics_query ) )
    		while( bbp_topics() ) {
    			bbp_the_topic();
    			$topic_id = bbp_get_topic_id();
    			$topic_date = strtotime( get_post( $topic_id, 'post_date', true ) );
                    $forum_id = bbp_get_topic_forum_id($topic_id);
                    if ($topic_date < strtotime( '-2 hours') ) // && $forum_id == 1276 )
                        bbp_close_topic( $topic_id );
    		}
    }

    In other words we take out the cron scheduling functions from the code

    then

    Event type: PHP cron event
    Hook name: bbpress_close_old_topics
    arguments: none
    next run: now
    repeat: hourly

    That should do it, you should see it as an event.

    If you have a topic already set to expire, it should do so immediately as you have schgeduled to run ‘now and then every hour’ in the above.

    #233683
    enkoes
    Participant

    Hi, I’m thinking of hiding some items in forum & topic page as follows:

    Forum page:
    1) to hide forum information
    2) to hide topic viewing information
    see screenshot: https://paste.pics/KS7KD

    Topic page:
    1) to hide topic information
    2) to hide post viewing information
    3) to hide topic header (author & posts)
    see screenshot: https://paste.pics/KS7MF

    Are there any CSS codes that can achieve that?

    #233676
    leon1912
    Participant

    Hey @robin-w,
    thanks for your reply.
    I changed the code right away after you sent the reply.

    But it still does not work and I’m note sure why.

    #233652
    Robin W
    Moderator

    a cron event only runs at the interval specified, so the check event runs once a day ie

    wp_schedule_event(time(), 'daily', 'bbpress_daily_event');

    so would only close topics older than 2 hours once a day.

    suggest changing that line to

    wp_schedule_event(time(), 'hourly', 'bbpress_daily_event');

    so it would run every hour, so topics would be closed between 2 and 3 hours depending on when cron runs in relation to their creation.

Viewing 25 results - 851 through 875 (of 32,468 total)
Skip to toolbar