Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'Add BuddyPress Styles to a Theme'

Viewing 25 results - 1 through 25 (of 382 total)
  • Author
    Search Results
  • kflux
    Participant

    Hello everyone,

    I’m trying to create a simple custom theme to override the BuddyPress (Nouveau) registration page, but I’m consistently running into a White Screen of Death (WSOD). I’ve been troubleshooting for a while and would appreciate any help you can offer.

    My Goal:
    To create a custom theme that overrides register.php from the BP Nouveau template pack.

    My Environment:

    OS: Windows

    Local Development Tool: DevKinsta

    Plugin: BuddyPress (latest version)

    The Problem:
    When I activate my custom theme, I get a WSOD when trying to access the site (e.g., mysite.local/register/).

    Here is a summary of the troubleshooting steps I have already tried:

    Enabled WP_DEBUG: I have set WP_DEBUG, WP_DEBUG_LOG, and WP_DEBUG_DISPLAY to true in my wp-config.php. However, no errors are ever displayed on the screen or written to the debug.log file. The page is just completely blank.

    Checked for PHP Errors: I initially had parse errors (an extra } bracket) in my functions.php and register.php files. These have been found and corrected.

    Checked for BOM: I have verified with my code editor (VS Code) that all my theme files are saved with UTF-8 encoding and do not have a Byte Order Mark (BOM).

    Reset Permalinks: I have gone to Settings > Permalinks and clicked “Save Changes” multiple times to rebuild the rewrite rules.

    Theme Deactivation Test: When I rename my theme’s folder to force WordPress to deactivate it, I can access wp-admin again. This confirms the issue is within my theme’s code.

    File Permissions: I received a security warning that /wp-content/ was too writeable. I have reset the permissions for my entire site folder on my Windows machine to ensure they are not too permissive.

    My Theme Structure and Code:

    My theme is very simple.

    1. Directory Structure for the Override:
    wp-content/themes/kfluxtheme/buddypress/members/register.php
    (The register.php file is an exact, unmodified copy from wp-content/plugins/buddypress/bp-templates/bp-nouveau/buddypress/members/)

    /*
    Theme Name: K-Flux Theme
    Author: My Name
    Version: 1.0
    */
    <?php
    /**
     * Theme functions and definitions.
     */
    
    if ( ! function_exists( 'kfluxtheme_setup' ) ) {
    	/**
    	 * Basic theme setup.
    	 */
    	function kfluxtheme_setup() {
    		// Add support for BuddyPress (ESSENTIAL)
    		add_theme_support( 'buddypress' );
    
    		// Let WordPress manage the document title.
    		add_theme_support( 'title-tag' );
    
    		// Enable support for Post Thumbnails.
    		add_theme_support( 'post-thumbnails' );
    	}
    }
    add_action( 'after_setup_theme', 'kfluxtheme_setup' );
    
    /**
     * Enqueue scripts and styles.
     */
    function kfluxtheme_enqueue_scripts() {
    	wp_enqueue_style( 'kfluxtheme-style', get_stylesheet_uri(), array(), '1.0' );
    }
    add_action( 'wp_enqueue_scripts', 'kfluxtheme_enqueue_scripts' );
    

    Despite all these steps, the WSOD persists when my theme is active. Since WP_DEBUG is not showing any errors, I’m running out of ideas on how to debug this further.

    Has anyone encountered a similar issue with DevKinsta or have any suggestions for what I might be missing?

    Thanks in advance for any help.

    #335862
    emaralive
    Moderator

    Hi,

    The CSS file that gets loaded depends on which template pack is in use, e.g. Legacy vs Nouveau. Additionally, styles (CSS) can be customized via a Child theme and, if a Classic theme is in use, via the Appearance > Customize > Additional CSS menu path within the wp-admin area. Thus, which CSS file gets loaded is irrelevant/moot.

    Specific to Avatars, How to Customize BuddyPress Avatars With CSS has some info (Note: might be a tad outdated). There are other sources on wordpress.org that contain general info regarding custom CSS, e.g. from the Advanced Administration Handbook – Custom CSS in WordPress

    Hopefully, this is enough information to get you started.

    #332259

    In reply to: BuddyPress 12.0.0

    Mathieu Viet
    Moderator

    Hi @erotmil thanks for sharing this code. I don’t see anything particular that would conflict on the server side. Since your issue is about button visibility I wonder if the fact we’re not including BuddyPress template pack styles and scripts everywhere on the site but only in BuddyPress generated pages could be the reason why you’re not seeing the buttons of this custom page. If you already rolled back to 11.4.0 a good way to figure it out is to temporarily add this code into the functions.php of your theme:
    remove_action( 'wp_enqueue_scripts', 'bp_enqueue_scripts', 10 );. Note that this code will remove all CSS and JS for BuddyPress, make sure to use it before refreshing your custom page from your browser, once refreshed if your buttons are gone, then we’ve found the issue. Remove immediately after the above code. If you still have BP 12.0 active, you can test adding the following code to see if it’s fixing the issue for your custom page:
    add_filter( 'bp_enqueue_assets_in_bp_pages_only', '__return_false' );. If it’s the case you can leave this code, otherwise remove it.

    rsial
    Participant

    To overwrite the BuddyPress Nouveau template CSS in a child theme, you need to ensure that your child theme is properly enqueued and that the correct file path is used. Here’s the recommended approach:

    In your child theme folder, create a new directory called buddypress.

    Inside the buddypress directory, create a new directory called css.

    Copy the buddypress.css file from /plugins/buddypress/bp-templates/bp-nouveau/css into your child theme’s buddypress/css directory.

    In your child theme’s functions.php file, enqueue the modified CSS file. Add the following code:

    function enqueue_child_theme_styles() {
    wp_enqueue_style( ‘child-theme-buddypress’, get_stylesheet_directory_uri() . ‘/buddypress/css/buddypress.css’, array( ‘bp-nouveau-main’ ), ‘1.0’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, 999 );

    To overwrite the BuddyPress Nouveau template CSS in a child theme, you need to ensure that your child theme is properly enqueued and that the correct file path is used. Here’s the recommended approach:

    In your child theme folder, create a new directory called buddypress.

    Inside the buddypress directory, create a new directory called css.

    Copy the buddypress.css file from /plugins/buddypress/bp-templates/bp-nouveau/css into your child theme’s buddypress/css directory.

    In your child theme’s functions.php file, enqueue the modified CSS file. Add the following code:

    php
    Copy code
    function enqueue_child_theme_styles() {
    wp_enqueue_style( ‘child-theme-buddypress’, get_stylesheet_directory_uri() . ‘/buddypress/css/buddypress.css’, array( ‘bp-nouveau-main’ ), ‘1.0’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘enqueue_child_theme_styles’, 999 );
    Make sure to adjust the version number (‘1.0’) if you update your child theme’s CSS in the future.

    With these steps, the modified “buddypress.css” file from your child theme should be loaded and override the default styles from the BuddyPress Nouveau template.

    Remember to clear any caching plugins or server caches to ensure that the updated CSS is being served.

    If the changes still don’t take effect, it’s possible that another plugin or theme is conflicting with the child theme’s styles. In that case, you may need to investigate further and potentially use more specific CSS selectors or use a higher priority for the “wp_enqueue_style” function.

    #322587
    dugost
    Participant

    I’m not a coder so I’m sure this is pretty obvious to a lot of people but this seems to do the trick:

    function register_nouveau_stylesheet() {
        wp_register_style( 'bp-nouveau-enqueue', get_stylesheet_directory_uri() . '/css/buddypress.min.css' );
    }
    add_action( 'init', 'register_nouveau_stylesheet' );
    
    function conditionally_enqueue_nouveau_stylesheet() {
        // only enqueue on members-directory page slug
        if ( ! current_user_can( 'update_core' ) && is_page( 'members-directory' ) ) {
            wp_enqueue_style( 'bp-nouveau-enqueue' );
        }
    }
    add_action( 'wp_enqueue_scripts', 'conditionally_enqueue_nouveau_stylesheet' );

    The inclusion of ! current_user_can( 'update_core' ) && in the if statement prevents the stylesheet loading twice for the admin. Other user types and logged-out visitors will see the stylesheet loaded for them since Avada child theme’s currently can’t handle this.

    #322579
    dugost
    Participant

    In case this is helpful for anyone, I was able to get an Avada child theme to enqueue BP Nouveau styles conditionally based on code detailed here placed in my child theme’s functions.php file and making sure BP Nouveau’s /css/ directory sits in the same directory.

    function register_nouveau_stylesheet() {
        wp_register_style( 'bp-nouveau-enqueue', get_stylesheet_directory_uri() . '/css/buddypress.min.css' );
    }
    add_action( 'init', 'register_nouveau_stylesheet' );
    
    function conditionally_enqueue_nouveau_stylesheet() {
        // only enqueue on members-directory page slug
        if ( is_page( 'members-directory' ) ) {
            wp_enqueue_style( 'bp-nouveau-enqueue' );
        }
    }
    add_action( 'wp_enqueue_scripts', 'conditionally_enqueue_nouveau_stylesheet' );
    

    Unfortunately, logged in users will end up loading the Nouveau stylesheet twice so I’ll have to update this code further so it checks for login status and possibly user role. Hopefully, I can find a way to conditionally enqueue BP’s styles for the directory only as well. I don’t need those styles loading site-wide!

    dugost
    Participant

    I have BP v.9.1.1 installed under WP 5.8.2 and the site in progress is using a subdomain with its directory at the root. The directory is named as per the subdomain (i.e. subdomain.domain.tld). Unfortunately, I’m unable to share the URL.

    I’ve been wrestling with this issue for a while now. When logged in as the admin and viewing the Members Directory, the bp-nouveau-css styles (…/buddypress.min.css?ver=9.1.1) load just fine but they won’t load when logged out. This is happening specifically with an Avada child theme. I have reached out to Avada support but I’m not holding my breath for a solution from them.

    I cloned the site and began by activating the Twenty Twenty One. Like the original site, bp-nouveau-css loaded just fine when logged in or out. This was also the case for Twenty Twenty One child or the Avada parent themes. However, activating the Avada child theme prevents that stylesheet from loading.

    In my Avada child theme, I’ve only added the buddypress/members/ directories so I could make some tweaks to the listings and profile pages. The child theme’s style.css relies on the Nouveau template CSS in the BP plugin directory. With its styles missing, the page falls apart.

    I also have some custom functions in plugins/bp-custom.php but none of those deal with stylesheets.

    I’ve also tried placing the CSS folder from /buddypress/bp-templates/bp-nouveau/ in /avada-child-theme/ as a test. When logged in, bp-nouveau-css loaded from the child theme. When logged out, other BP styles were loaded from the plugin directory, not the child theme, and it still refused to load bp-nouveau-css.

    Can I add a function somewhere to enqueue the styles I need since the child theme won’t do it on its own?

    I’d actually like to add a function to only load BP’s CSS and JS where necessary since only a couple of pages use BP. I’ve found this SERT Media article but comments suggest the code won’t work with Nouveau.

    I’d greatly appreciate any help with this issue. Cheers.

    #318492

    In reply to: BuddyPress 8.0.0-beta1

    deborah86
    Participant

    I posted my initial response about this on the blog page. I want to add additional ideas and context here. The changes to the plugin sound great and are needed but they just don’t go far enough. The update is not that exciting.

    There doesn’t look like there is going to be support for block-based themes, full-site editing, or Gutenberg. There is no mention of new Gutenberg blocks.

    It looks like the next release will still rely on a limited amount of widgets. The widgets can’t be added to pages to create unique looks unless the user downloads a plugin.

    Widgets are going away and will be replaced with blocks soon. WordPress users will have to disable newer features in order to use the older BuddyPress features. How is this fair?

    BuddyPress should incorporate the newer WordPress features and add backwards compatibility for those unable to upgrade right away.

    Also, your website doesn’t contain any documentation on creating blocks for Gutenberg or block-based themes that work with the plugin. There is no exciting news about documentation updates.

    The release notes say there are updates to the BP Nouveau template pack. I am wondering what these updates are. Will this include updates to the Companion Stylesheets?

    Honestly, with full-site editing and block-based themes coming, these updates are a little too late.

    I am hoping the BP Nouveau template pack at least removes some of the BuddyPress CSS elements and gives more control back to the theme authors.

    Why is the plugin overriding the theme’s original styles for page titles, fonts, color schemes, etc?

    This creates extra work for someone modifying a theme or creating a theme. The plugin works against the original theme and not with it. The plugin should focus on modifying the elements that are not taken care of by the theme.

    The alerts look like you just copied what the alerts looked like in a previous version of Bootstrap. They have to be redesigned.

    The plugin is not mobile-friendly. The plugin overrides the mobile-friendly designs put in place by the theme designer to make the experience as terrible as possible on a mobile device.

    – Small fonts in places
    – Fonts too large in others
    – Selection areas too small to touch
    – Buttons too small

    I understand not all themes are done well, but the majority using the new features available in WordPress already does a better job with design than the BP Nouveau styles.

    Overall, this new update isn’t going to be ready for WordPress 5.8. It seems as though the developers o BuddyPress don’t care about what the WordPress Core community is accomplishing and the progress they are making.

    In 2017/2018 this would be an awesome update. It’s 2021 and the update is meh.

    #316659
    rando
    Participant

    hi vapvarun and thank you for replying back (: ,

    i tried to write a code to override the main template – and i make the script run as a plugin
    here what i did

    <?php
    /*
    Plugin Name: PAGTEM
    Plugin URI: https://www.example.com
    Version: 0.0.1
    Author: NULL
    Author URI: https://www.example.com
    */
    
    class PageTemplate {
    
    	/**
    	 * A reference to an instance of this class.
    	 */
    	private static $instance;
    
    	/**
    	 * The array of templates that this plugin tracks.
    	 */
    	protected $templates;
    
    	/**
    	 * Returns an instance of this class.
    	 */
    	public static function get_instance() {
    
    		if ( null == self::$instance ) {
    			self::$instance = new PageTemplate();
    		}
    
    		return self::$instance;
    
    	}
    
    	/**
    	 * Initializes the plugin by setting filters and administration functions.
    	 */
    	private function __construct() {
    
    		$this->templates = array();
    
    		// Add a filter to the attributes metabox to inject template into the cache.
    		if ( version_compare( floatval( get_bloginfo( 'version' ) ), '4.7', '<' ) ) {
    
    			// 4.6 and older
    			add_filter(
    				'page_attributes_dropdown_pages_args',
    				array( $this, 'register_project_templates' )
    			);
    
    		} else {
    
    			add_filter(
    				'theme_page_templates', array( $this, 'add_new_template' )
    			);
    
    		}
    
    		// Add a filter to the save post to inject out template into the page cache
    		add_filter(
    			'wp_insert_post_data',
    			array( $this, 'register_project_templates' )
    		);
    
    		// template assigned and return it's path
    		add_filter(
    			'template_include',
    			array( $this, 'view_project_template')
    		);
    
    		$this->templates = array(	
    			'FullC.php' => 'Full Canvas',
    			// this file exist in the same folder as the plugin like that 
    
    		/* Plugin Template ( Folder ) ========
    		 		  |
    		 		  |
    		 		  |
    		 	Index.php (file)
    		 	FullC.php (file) 
    	================			*/
    
    		);
    
    	}
    
    	/**
    	 * Adds template to the page dropdown for v4.7+
    	 *
    	 */
    	public function add_new_template( $posts_templates ) {
    		$posts_templates = array_merge( $posts_templates, $this->templates );
    		return $posts_templates;
    	}
    
    	/**
    	 * Adds our template to the pages cache in order to trick WordPress
    	 * into thinking the template file exists where it doens't really exist.
    	 */
    	public function register_project_templates( $atts ) {
    
    		// Create the key used for the themes cache
    		$cache_key = 'page_templates-' . md5( get_theme_root() . '/' . get_stylesheet() );
    
    		// Retrieve the cache list.
    		// If it doesn't exist, or it's empty prepare an array
    		$templates = wp_get_theme()->get_page_templates();
    		if ( empty( $templates ) ) {
    			$templates = array();
    		}
    
    		// New cache, therefore remove the old one
    		wp_cache_delete( $cache_key , 'themes');
    
    		$templates = array_merge( $templates, $this->templates );
    
    		// Add the modified cache to allow WordPress to pick it up for listing
    		// available templates
    		wp_cache_add( $cache_key, $templates, 'themes', 1800 );
    
    		return $atts;
    
    	}
    
    	/**
    	 * Checks if the template is assigned to the page
    	 */
    	public function view_project_template( $template ) {
    		// Return the search template if we're searching (instead of the template for the first result)
    		if ( is_search() ) {
    			return $template;
    		}
    
    		global $post;
    
    		// Return template if post is empty
    		if ( ! $post ) {
    			return $template;
    		}
    
    		// Return default template
    		if ( ! isset( $this->templates[get_post_meta(
    			$post->ID, '_wp_page_template', true
    		)] ) ) {
    			return $template;
    		}
    
    		// Allows filtering of file path
    		$filepath = apply_filters( 'page_templater_plugin_dir_path', plugin_dir_path( __FILE__ ) );
    
    		$file =  $filepath . get_post_meta(
    			$post->ID, '_wp_page_template', true
    		);
    
    		// check if the file exist first
    		if ( file_exists( $file ) ) {
    			return $file;
    		} else {
    			echo $file;
    		}
    
    		// Return template
    		return $template;
    
    	}
    
    }
    add_action( 'plugins_loaded', array( 'PageTemplate', 'get_instance' ) );

    now if you go to
    Pages > Edit xor Add New Page > Page Attributes > A New Section Called Templates > I Click On the Full Canvas > [UPDATED]

    Nothing Changed (:
    Why’s Is That – Is There’s Wrong With The Code Or The Buddypress V that i use ?

    i use ==> Version 6.3.0 | By The BuddyPress Community

    #303681
    chris19731973
    Participant

    In the site below, they copy the code to style.css file …

    https://buddypress.org/support/topic/how-to-remove-this-field-can-be-seen-by/
    You could download a plugin like this: https://wordpress.org/extend/plugins/safecss/ and add these lines of css to your style sheet, or If you have a created a child theme, you can just add these lines to your style.css file

    .field-visibility-settings-toggle {
    display:none;
    }
    .field-visibility-settings-notoggle {
    display:none;
    }

    I don’t have the style.css file in my Theme but these 2 files instead :
    editor-style.css
    theme-customizer-controls-styles

    Please do you know which CSS files need to be added or modified ?

    #279139
    John
    Participant

    I want to dequeue, or override, the bp-nouveau stylesheet. I have tried:

    function dequeue_buddypress() {
    	if (!is_admin()) {
    		wp_dequeue_style('bp-nouveau');
            wp_deregister_style('bp-nouveau');
    	}
    }
    add_action('wp_enqueue_scripts', 'dequeue_buddypress', 1);

    Have also played with priorities from 1 to 99 and tried the handle bp-nouveau-css.

    as well as trying to override the css in the theme but neither has worked.

    Anyone know how I can get the bp-nouveau css to dequeue?

    #278473

    Hi @shanebp
    Thanks for your recommandations, you’re right.
    I’ve made it working by putting my snippet in bp-custom.php like this:

    
    /**
    * Buddypress template stack adaptation for Blade Sage.io templating
    * @link 
    * example @link http://www.generalthreat.com/2013/08/grappling-with-bp-theme-compatibility/
    *
    * initial one was :
    * /app/public/app/themes/sage/resources/buddypress
    */
    
    // will return something like '/app/public/app/themes/sage/resources/views';
    
    function md_bp_blade_register_template_location() {
        // return STYLESHEETPATH . '/views/buddypress/';
        return TEMPLATEPATH . '/views';
    }
    
    // replace bp template parts syntaxe with the template overload from sage Blade types
    // see: http://hookr.io/functions/bp_get_template_part/
    function md_blade_replace_template( $templates, $slug, $name ) {
    
        // Overload the bp template
    	
    	$templates = array(); // empty it
     	
        if ( isset( $name ) ) {  
            $templates[] = $slug . '-' . $name . '.blade.php'; 
        }
        else {
            $templates[] = $slug . '.blade.php';
        }
    
        //print_r($templates);
        return $templates;
    }
    
    add_action( 'bp_init', function () {
    
    	//error_log("bp init loaded");
    
    	// custom url stacks for blade '/views' folder
    	// working but Blade Syntax is not interpreted ...
    	
        if( function_exists( 'bp_register_template_stack' ) ) {
            bp_register_template_stack( 'md_bp_blade_register_template_location', 1 );
        }
        
        // we also have to filter the render file extension (.blade.php) 
       // for Buddypress components tpl parts
    	add_filter( 'bp_get_template_part', 'md_blade_replace_template', 10, 3 );
    
    	// http://buddypress.wp-a2z.org/oik_api/bp_locate_template/
    	//add_action( 'bp_locate_template', 'md_blade_locate_template', 1, 6);
    
    });

    But this technique doesn’t work with bp ajax for example when bp groups loop is reloaded with ajax

    I’m sure there is something to do with bp_locate_template() or bp_locate_template_and_load()
    to inject correctly my buddypress templates in the_content from mytheme/resources/views/buddypress (instead of mytheme/resources/buddypress/)

    By the way i’m using the Sage starter theme https://roots.io/sage/

    Any idea?

    MrShawnTierney
    Participant

    I use BuddyPress (and BuddyBoss Social Learner Theme) to interact with my students who take courses on my WordPress / Learndash website.

    Q1) One thing that kind of drives me crazy is I can’t put line feeds in my messages without adding a character to space out the sentences.

    I use to type in &nbsp; which worked, but the emailed copy of the message showed &nbsp; in place of just a blank line.

    So that in mind, what am I missing?

    Is there any setting or stylesheet I can edit to allow a space between sentences in BuddyPress Messages?

    People really hate walls-of-text, and spaces between sentences make text more readable, just like you find here on the Buddypress website and in this post I’m making.

    Note that I don’t have this issue with BBPress forum posts.

    Q2) I’m imperfect, and whenever I create a notice to all users I always have a typo 🙁

    BUT, I just can’t find any way to edit these announcement messages?

    Just checked, and yes it is the 21st century and even Facebook now lets you edit announcements, so I figured it must be me, that I just don’t know how to edit them.

    Can someone point me in the right direction?

    Thanks a million in advance!

    Shawn

    Bit Boy
    Participant

    Hi,
    How did you disable the option? Are you using css to do it?

    There are two ways to do it
    1. Using css
    2. editing template file(register.php and keeping a copy in your theme’s buddypress/members directory)

    I will prefer the first approach as it will not be much work on a site admin’s part.

    
    .register-page .signup-form .editfield .field-visibility-settings,
    .buddypress-wrap .standard-form .field-visibility-settings-header {
        display:none;
    }
    
    

    Please visit Dashboard->Appearance->Customize menu then open “Additional Styles” and add those lines.

    Does that work?

    Best Regards
    B

    #276663
    envis
    Participant

    I have tried to add BuddyPress to my child-theme.
    My object is to change the layout of the register and activate form.

    So I have created the following folder structure:
    \wp-content\themes\child-theme\buddypress\members\

    In this folder I placed two files:
    index-register.php = same content as \wp-content\plugins\buddypress\bp-themes\bp-default\registration\index-register.php
    index-activate.php = same content as \wp-content\plugins\buddypress\bp-themes\bp-default\registration\index-activate.php

    This seems to work, but the layout of the forms is completely wrong, all input boxes are not aligned etc. So then I checked this forum and saw that it might be a good idea to import a stylesheet from buddypress in the child-theme folder.
    So I added the following line to \wp-content\themes\child-theme\style.css

    @import
    url( ../../plugins/buddypress/bp-themes/bp-default/_inc/css/default.css );

    This fixes the aligning problem, but totally destroys the full width layout of the site.
    The sidebard is destroyed and the background color is wrong etc. etc.

    Is there a way to edit the register and activate form with only overrides, and leave the default styling in tact?

    Any help appreciated!

    #267869
    x3mp
    Participant

    I am not attacking the BuddyPress Dev team to be clear.
    I’m just saying that there should be a customization option for the registration page.
    Because right now the styles are dependent on the theme. Why not add an option that allows people to place a certain field at a place and fully customize that field to their likings. Of course I understand that is hard and takes a long time and will probably not happen.
    But please the team would make a lot of people happy by adding an option so people can customize the registration page apart from the full theme like its own style sheet.

    #267794
    r-a-y
    Keymaster

    add_theme_support( 'buddypress' ) is for custom BuddyPress themes not relying on theme compatiblity.

    I would remove that line from your theme’s functions.php and then load a BuddyPress page to see if the default BP styles show up as expected.

    ygagnon2016
    Participant

    I like your idea about calling a function from the php for the modal window.

    Just FYI .. this is what I have set up for colorbox (which isn’t a real ajax call, you’ll see):

    echo '<a class="ajax cboxElement launch-dashboard" href="' . get_stylesheet_directory_uri() . '/buddypress/members/single/dashboard.php?username=' . $row->username . '" title="Dashboard">Launch Dashboard</a>';

    If you aren’t familiar with how colorbox works … note that the modal window is being enabled by simply adding the “ajax” class to the link … similar to how a lightbox popup works.

    Ideally .. it’d be great if I didn’t have to call these 2 lines in my dashboard.php file either:

    require("../../../../../../wp-blog-header.php");
    require('../../../../../../wp-load.php'); 

    It’s my understanding that this is a terrible approach anyways .. since the WordPress engine is supposed to be already loaded in the background (making it redundant).

    So how would I implement something like what you’ve suggested? Could you show me an example, maybe? I’m assuming that if I don’t load the WordPress engine in my dashboard.php file, that I wouldn’t be able to call a function that’s been added to my functions.php file, right?

    Here’s a dumb question. Should I maybe just place my dashboard.php file in a different location within my child theme directory structure, perhaps? I ask because I’m starting to think that I might need to treat this as a normal WordPress template file .. instead of a standalone PHP script. Any thoughts?

    #265938
    manm0untain
    Participant

    Extended Buddypress profile fields demands an additional name / username field. This is the case whether you are using Buddypress Usernames Only plugin or not.

    This is only relevant if you require extended profile fields. If you don’t, then go into Buddypress settings and turn off extended profiles. That will remove the requirement for a second name on the registration / profile area.

    If you want to use extended profile fields on BP, but you don’t want the second username / name field uglying up your registration flow, you can do the following.

    You have to be careful with this, because if you hack it, remove the second required name / username field, or any of a dozen other solutions I’ve found – the registration will break down. You will get 500 errors, missing confirmation emails etc.

    The solution I used for this is as follows.

    1. Assuming you just want to use a singular Username for your site – install the Buddypress Usernames Only plugin. It says the plugin is old but it is still working as of WP version 4.7.4 (for me at least). This deals with the display / access of various username / name / fullname / nickname issues throughout the WP / Buddypress install.

    2. Next you’ll need to hide the extra name / username field on the registration area, and the BP profile area. Stick this CSS into your theme custom CSS under Appearance > Customize:

    #profile-edit-form .field_1 { display: none;}
    #signup_form .field_1 { display: none;}

    (I have seen a 3rd line of CSS on other solutions – #register-page p { display: none;} – all this did for me was to hide the confirmation message after the user registers. You probably want that so I’d leave that line out).

    3. The fields should now be hidden, but the system still requires that information to process properly. So next create a file in notepad and save it as name_remove.js

    In that file put the following javascript:

    document.getElementById("signup_username").onchange = function() {myFunction()};
    function myFunction() {
     var x = document.getElementById("signup_username");
    document.getElementById("field_1") .value = x.value
    }

    Save that file and upload it to your theme folder (same folder as functions.php etc). This javascript automatically populates the hidden field with the username, so the system does not complain or fall over.

    4. Finally you need WordPress to pick this javascript file up. You can do that with a function, using file enqueing. Copy and paste this function into your themes functions.php file Appearance > Editor

    function wpb_adding_scripts() {
    wp_register_script('name_field_remove', get_stylesheet_directory_uri() . '/name_remove.js', array('jquery'),'1.1', true);
    wp_enqueue_script('name_field_remove');
    }
    
    add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );

    You have to be careful about the path. If it’s not working at this point, you can view the page source of your register page, and search for “name_remove.js” – look at the path on that script line. If the path is wrong, tweak it in the function above (you might need to change the get_stylesheet_directory_uri() part, or the path part after it. You can check if the path is correct by clicking the link to the .js file in the page source. If the path is wrong, you will get a 404 error. If the path is right, you should see the script code contained in the js file. Fiddle around with the path until it’s correct.

    At that point, you have hidden the fields with CSS, and populated the second hidden username / name field automatically with javascript. Test your registration / confirmation email etc to make sure everything is working. But you should be good to go.

    Hope that helps someone. Thanks to the folks I cobbled this solution together from.

    #263061
    danbp
    Participant

    A brief check for wp-content/themes/rehub/buddypress/groups/single/index.php indicates that you use a wrong file.

    There is no index.php file in the original template directory of /groups/single/…

    So it may by interesting for you to review the group page install – evtl. register permalinks again and to check how you implemented “/buddypress” into your theme. About theme, do you use a child theme ?

    Perhaps read the template doc if it is a bit unclear.

    Add BuddyPress Styles to a Theme

    #260630
    Slava Abakumov
    Moderator

    That’s mainly a styling thing.
    You should be comfortable using Firefox or Chrome and their developer consoles, where you are able to preview changes.

    These links will be help you as well:

    Add BuddyPress Styles to a Theme


    https://buddypress.org/support/topic/custom-css-changes/

    Don’t forget to either include your styles via external file in your plugin or use your child themes, not to lose changes on parent theme update.

    #258410
    steigw
    Participant

    It’s a staging site that doesn’t have public access, but I can put the code and info in here. Here is the complete code of the functions.php in the child theme. maybe I just put it all together wrong.

    <?php
    function nisarg_enqueue_styles() {
    
        $parent_style = 'nisarg-style';
    
        wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.css' );
        wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/font-awesome/css/font-awesome.min.css' );   
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    
        wp_enqueue_style( 'nisarg-child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style )
        );
    }
    add_action( 'wp_enqueue_scripts', 'nisarg_enqueue_styles' );
    ?>
    <?php
    function custom_wp_mail_from( $email ) {
            $handle = ‘accounts’;
    	$find = 'http://'; 
    	$replace = '';
    	$link = get_bloginfo( 'url' );
    	$domain = str_replace( $find, $replace, $link );
    	return $handle . '@' . $domain ;
    }
    add_filter( 'wp_mail_from', 'custom_wp_mail_from' );
    ?>

    The email link is:http://mydomain.com/activate/JA0BvkK1Q0DND10SYegdOtkTMemhGUF0/

    When I click on it immediately, I get all this:

    Fatal error: Uncaught exception ‘phpmailerException’ with message ‘Invalid address: ‘accounts’@mydomain.com’ in /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-includes/class-phpmailer.php:946 Stack trace: #0 /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-includes/pluggable.php(352): PHPMailer->setFrom(‘\xE2\x80\x98accounts\xE2\x80\x99@…’, ‘WordPress’) #1 /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-includes/pluggable.php(1726): wp_mail(‘webmaster@arlin…’, ‘[My Dev Sit…’, ‘New user regist…’) #2 /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-content/plugins/buddypress/bp-members/bp-members-functions.php(2031): wp_new_user_notification(18) #3 /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-content/plugins/buddypress/bp-members/bp-members-screens.php(364): bp_core_activate_signup(‘JA0BvkK1Q0DND10…’) #4 [internal function]: bp_core_screen_activation(”) #5 /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-includes/plugin.php(524): cal in /homepages/25/d283441938/htdocs/clickandbuilds/staging/wp-includes/class-phpmailer.php on line 946

    If I wait a while, then I get the normal webpage and it says “invalid activation key”. I don’t understand the significance of an immediate click on the link in the email vs. waiting a few more seconds, but it definitely matters.

    #256926
    skitzpress
    Participant

    Thanks for the reply @danbp

    I have not built the site and I also have very little technical and coding knowledge (sorry!) I will update WordPress later but wasn’t sure how to back everything up?

    There is a lot of plugins installed:Admin Menu Editor, Advanced Custom Fields,Advanced Custom Fields PRO, bbPress,BuddyPress, DropBox Folder Share, Easy FancyBox, Gravity Forms, Gravity Forms + Custom Post Types, Gravity Forms CSS Ready Class Selector, Gravity Forms Remove Entries, jonradio Multiple Themes, Login Security, Members, No Page Comment, OPcache Dashboard,Page Specific Menu Items, PHP Code For Posts, Post Types Order, Social Media Feather, Styles with Shortcodes for WordPress,
    TAO Schedule Update, WordPress Importer, WP Google Maps, WP Google Maps – Pro Add-on, wp_mail return-path

    Are any of these know to conflict with BuddyPress?

    Not sure on the custom functions as far as I know… I’m not confident enough to debug and the site it is also live so not sure what to do?

    Think I will update WordPress then disable all plugins except BuddyPress and try on a twenty theme but if that doesn’t work, which seems like the case in other past posts, I’m not sure need help!

    Thanks again

    #255535
    @mercime
    Participant

    @destac There are different ways to implement the new feature. For the screenshot, I did it in 4 simple steps.

    Note that you might need to adjust how the widgets are registered, named, or styled based on your theme.

    1. Registered three new widget areas in the child/theme’s functions.php file.

    <?php // Only add this line if you are adding this to an empty functions.php file
    /**
     * Register three widget areas for Members front page.
     *
     * @since My Child Theme 2.6.0
     */
    function my_child_theme_widgets_init() {
    	register_sidebar( array(
    		'name'          => __( 'bp-members-1st', 'my-child-theme' ),
    		'id'            => 'bp-members-1st',
    		'description'   => __( 'Appears on each member\'s front page.', 'my-child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    
    	register_sidebar( array(
    		'name'          => __( 'bp-members-2nd', 'my-child-theme' ),
    		'id'            => 'bp-members-2nd',
    		'description'   => __( 'Appears on each member\'s front page.', 'my-child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    
    	register_sidebar( array(
    		'name'          => __( 'bp-members-3rd', 'my-child-theme' ),
    		'id'            => 'bp-members-3rd',
    		'description'   => __( 'Appears on each member\'s front page.', 'my-child-theme' ),
    		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
    		'after_widget'  => '</aside>',
    		'before_title'  => '<h2 class="widget-title">',
    		'after_title'   => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'my_child_theme_widgets_init' );

    Adjust items registered in child theme based on how your theme is setting up the widget areas.

    2. Created a new file front.php which should be located as follows: wp-content/my-child-theme-folder/buddypress/members/single/front.php
    (Create the buddypress, members, and single directories/folders if you do not have those in your theme yet.)

    Added the following in the front.php file:

    <?php
    /**
     * BuddyPress - Members Front Page
     *
     * @since My Child Theme 2.6.0
     */
    ?>
    
    <div class="bp-member-front-wrap">
    
    	<div class="bp-member-front-1">
    		<?php dynamic_sidebar( 'bp-members-1st' ); ?>
    	</div>
    
    	<div class="bp-member-front-2">
    		<?php dynamic_sidebar( 'bp-members-2nd' ); ?>
    	</div>
    
    	<div class="bp-member-front-3">
    		<?php dynamic_sidebar( 'bp-members-3rd' ); ?>
    	</div>
    
    </div>

    3. Added some styles:

    .bp-member-front-wrap {
    	clear: both;
    	margin-bottom: 2em;
    }
    
    @media screen and (min-width: 46em) {
    	.bp-member-front-wrap {
    		clear: both;
    		margin-bottom: 1em;
    	}
    	.bp-member-front-1,
    	.bp-member-front-2 {
    		float: left;
    		margin-right: 1.5%;
    		width: 32%;
    	}
    	.bp-member-front-3 {
    		float: left;
    		width: 32%;
    	}
    }

    4. Went to Appearance > Widgets and add widgets to the Member Front Page Widget Areas.

    As mentioned above, there are other ways to implement this new feature. Happy customizing!

    David Cavins
    Keymaster

    Hi Ben,

    You are correct that it’s best to leave the bp stylesheet in place so that you get updates to that file. You can add a custom stylesheet, though, and increase the selector power of the rule, so that it overrides the bp.css rule, like .site #buddypress #item-body { border-left: none; }

    Here’s the basic concept.
    https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity

    Adding a stylesheet:

    Including CSS & JavaScript

Viewing 25 results - 1 through 25 (of 382 total)
Skip to toolbar