Code Monkey home page Code Monkey logo

bp-rewrites's Introduction

BuddyPress

Unit Tests

Welcome to the BuddyPress development repository! This repository is a mirror of our development SVN repository. Please do not send pull requests here, instead submit patches to our SVN repository. Check out the Participate & contribute page of our Codex for information about how to open bug reports, contribute patches, test changes, write documentation, or get involved in any way you can.

Getting Started

BuddyPress is a WordPress plugin to power you community site. It is a PHP, MySQL, and JavaScript based project, and uses Node for its JavaScript dependencies. A local development environment is available to quickly get up and running.

You will need a basic understanding of how to use the command line on your computer. This will allow you to set up the local development environment, to start it and stop it when necessary, and to run the tests.

You will need Node and npm installed on your computer. Node is a JavaScript runtime used for developer tooling, and npm is the package manager included with Node. If you have a package manager installed for your operating system, setup can be as straightforward as:

  • macOS: brew install node
  • Windows: choco install node
  • Ubuntu: apt install nodejs npm

If you are not using a package manager, see the Node.js download page for installers and binaries.

You will also need Docker installed and running on your computer. Docker is the virtualization software that powers the local development environment. Docker can be installed just like any other regular application.

Development Environment Commands

Ensure Docker is running before using these commands.

To start the development environment for the first time

npm install
npm run wp-env start

Your WordPress community site will be accessible at http://localhost:8888. You can see configurations in the .wp-env.json file located at the root of the project directory. You can override these configurations using a .wp-env.override.json file located at the root of the project repository.

To stop the development environment

You can stop the environment when you're not using it to preserve your computer's power and resources:

npm run wp-env stop

To start the development environment again

Starting the environment again is a single command:

npm run wp-env start

Credentials

To login to the site, navigate to http://localhost:8888/wp-admin.

  • Username: admin
  • Password: password

To generate a new password (recommended):

  1. Go to the Dashboard
  2. Click the Users menu on the left
  3. Click the Edit link below the admin user
  4. Scroll down and click 'Generate password'. Either use this password (recommended) or change it, then click 'Update User'. If you use the generated password be sure to save it somewhere (password manager, etc).

bp-rewrites's People

Contributors

adiloztaser avatar imath avatar shanebp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bp-rewrites's Issues

Group Extension > group id in construct

Using a custom BP component...
Using a BP_Group_Extension, in __construct() I need to get the group id so I can retrieve a groupmeta value and determine if a tab should be added.
This works when the Rewrites plugin is not active:

class Group_Events extends BP_Group_Extension {
    function __construct() {

	$setting = groups_get_groupmeta( $this->get_group_id(), 'events-assignable'  );

	if ( $setting == '1' ) {
		$show_tab = 'anyone';
	} else {
		$show_tab = 'noone';
	}  // etc 

With the Rewrites plugin active, $this->get_group_id() is always zero and so the tab is never added.
Also tried using bp_get_group_id() and $this->group_id

Fatal error with custom members nav item

I have a custom navigation item for members component. It occours a fatal error when BP-Rewrites is active. The reason of this error nav property creating just for admin requests. Is there any reason to do it?

// Initialize the Members Nav for WP Admin context.
if ( is_admin() && ! wp_doing_ajax() ) {
$this->nav = new \BP_Core_Nav();
}

Here is my mu-plugin to see the fatal error:

<?php
namespace NefisYemekTarifleri\Custom_Nav;

add_action( 'bp_init', __NAMESPACE__ . '\\init', 999999 );
function init() {
	if ( function_exists( 'bp_core_new_nav_item' ) ) {
		bp_core_new_nav_item(
			array(
				'name'            => 'Custom Nav',
				'slug'            => 'custom-nav',
				'parent_slug'     => buddypress()->members->slug,
				'position'        => 10,
				'screen_function' => __NAMESPACE__ . '\\custom_nav_screen',
			)
		);
	}
}

function custom_nav_screen() {
	do_action( 'bp_members_screen_display_profile' );
	bp_core_load_template( apply_filters( 'bp_members_screen_display_profile', 'members/single/home' ) );
}

Error:

Fatal error: Uncaught Error: Call to a member function add_nav() on null
in /var/www/html/wp-content/plugins/buddypress/src/bp-core/bp-core-buddybar.php on line 172

Improve the BP Admin URLs setting screen

There are a lot of customizable slugs into this screen. Using the Site-Health screen accordion UI might improve the user experience.

Moreover, it should be possible to edit the Title of the components directories.

Load order difference makes current group unavailable at `bp_setup_globals`

Describe the bug
My buddypress-docs plugin uses a BP_Group_Extension to add an item to group navigation. The nav item is properly loaded, and the BP_Group_Extension display() method properly called, with bp-rewrites activated.

However, the logic inside of my display() method depends on some other setup that buddypress-docs does at runtime, including determining the current "view" based in part on bp_current_component(). The particular line in question is https://github.com/boonebgorges/buddypress-docs/blob/130328dc3000d22c35e642950b10b8a17454cfd7/includes/integration-groups.php#L113: without bp-rewrites, bp_is_current_component( 'groups' ) (and bp_get_current_group(), bp_is_group(), etc) works properly, but with bp-rewrites, it incorrectly returns false.

It appears that this is because current_component etc are made available much later in the load process with bp-rewrites:

  • Without bp-rewrites: bp_core_set_uri_globals() happens at bp_init:2, which is hooked to WP's 'init'
  • With bp-rewrites: Component parse_query() methods are hooked to WP's 'parse_query'

The specific way that buddypress-docs operates here is based on very old legacy code. If I switched it so that my BP_Group_Extension directly checked the global at display time, instead of depending on a global that's set very early in the page load, it would work properly. However, this compatibility break might point to a broader problem with plugins that expect current_component etc to be available before parse_query.

I'm unsure if this will simply have to be a documented break, or if there's a way to shim the globals so that they're available earlier for backward compatibility reasons.

To Reproduce
Steps to reproduce the behavior:

  1. Install and activate buddypress-docs
  2. Visit a group
  3. Click on 'Docs' nav item
  4. You'll see that the plugin templates aren't loaded into the content area

Expected behavior
buddypress-docs content appears in group content area

issues on multisite / BP network activated

Hi, i just tested Version 1.0.0-beta2 on my wp multisite install with BP network aktivated and it does not work, the plugin seems to expect BP to be activted on the main site instead of network activated, posts error "BP Rewrites requires the BuddyPress plugin to be active. Please deactivate BP Rewrites, activate BuddyPress and only then, reactivate BP Rewrites."

tested also to have BP network activated and the rewrite plugin activated on the main site, without success.

br, Eric

Error on plugin activation

Describe the bug

  1. I could not activate the bp rewrites plugin I keep getting the error that (the following link has expired)
  2. After trying to activate without any success I also noticed that all my current buddypress pages were totally deleted.

WP/BP Configuration (please complete the following information):

  • WordPress: [version 5.9]
  • BuddyPress [version 10.0]

Undefined variable: structs

On every page: Notice > Undefined variable: structs in
wp-content/plugins/bp-rewrites-trunk/src/bp-blogs/classes/class-blogs-component.php:262

Perhaps this: return parent::add_permastructs( $structs );
Should be return parent::add_permastructs( $permastructs );

Activating bp-rewrites breaks page_on_front

Describe the bug
Activating bp-rewrites breaks page_on_front

To Reproduce
Steps to reproduce the behavior:

  1. Without bp-rewrites, set a BP directory page (such as Groups or Members) to page_on_front (Dashboard > Settings > Reading)
  2. Visit home page. You should see the selected directory.
  3. Activate bp-rewrites.
  4. Visit home page. You now get the 404 message. Furthermore, when you visit wp-admin/options-reading.php, the directory page is no longer selected in the dropdown.

I haven't debugged this at all - I wanted to report the bug before I forgot :-D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.