Giter VIP home page Giter VIP logo

wp-cli-buddypress'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).

wp-cli-buddypress's People

Contributors

boonebgorges avatar danielbachhuber avatar dcavins avatar iandunn avatar jonathanreeve avatar mamaduka avatar matthewf-ucsd avatar ntwb avatar paulgibbs avatar r-a-y avatar renatonascalves avatar scribu avatar tw2113 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wp-cli-buddypress's Issues

Metadata commands

Would be great to have metadata commands: wp bp group meta update etc.

Activity Meta

Was just needing to look at some activity meta and realized we don't have a subcommand like wp bp activity meta.

I'll look into adding a PR for this, but if anyone can get to it sooner, that'd be awesome!

Friend commands

I'd suggest:

  • wp bp friend list <user-id>, possibly with flags like --pending
  • wp bp friend add <user-id-1> <user-id-2>, which would take some sort of arguments for skipping the invitation process
  • wp bp friend check <user-id-1> <user-id-2> - I would call this "get" but "get" usually implies that the first argument will be an item ID, but the friendship ID is not really a useful ID in this context.
  • wp bp friend delete, probably taking and but maybe with the option of passing a friendship ID
  • wp bp friend accept-invitation <invitee-id> <inviter-id> - or something like that

CI Test against the PHP 8.0

as titled.

It can fail in the CI and it should not block the merge of pull requests unless there is no issue. =P

Generate command for default data, for testing

I feel a generate command should be added for testing. I think it is very useful for me, and others, to populate the site with default information.

We could create a generate command for each component or a single generate command to install and populate default data.

I'd love some feedback on the necessity of this and how we could approach it. :)

Update CI Matrix

as titled.

Ideally, the CI matrix would test the same as BuddyPress, since the BP-REST and the WP GraphQL BuddyPress projects are trying to follow that.

Component activation error because of wrong file name checking

I'm preparing a PR for this, but here follows the error:

wp bp core activate groups

Warning: require_once(/vagrant/www/bp-rest/htdocs/wp-content/plugins/buddypress//bp-core/admin/bp-core-schema.php): failed to open stream: No such file or directory in /home/vagrant/.wp-cli/packages/vendor/boonebgorges/wp-cli-buddypress/components/core.php on line 41

This file, https://github.com/boonebgorges/wp-cli-buddypress/blob/master/components/core.php#L41

bp-core-schema is called bp-core-admin-schema now.

Fatal error: Class 'WP_CLI\CommandWithDBObject' not found

I'm getting this error message:

Fatal error: Class 'WP_CLI\CommandWithDBObject' not found in /Users/adriantoll/.wp-cli/packages/vendor/boonebgorges/wp-cli-buddypress/component.php on line 8

It seems to be with any wp command, so not strictly related to any wp bp commands.

I think it may be related to a brew upgrade that I ran recently, as wp-cli was upgraded, and the problem started occurring after that.

Feature request: scaffold buddypress-specific test code

As a plugin developer I rely on wp scaffold plugin-tests a lot. I often end up customizing the scaffolded code to load BP along with WP for BP_UnitTestCase extensions. It would be great if I could scaffold a BP-specific test framework with a single command.

If you're willing to include this feature I'd like to help build it, but I wanted to ask in case it already exists or isn't something you think should be included for some reason.

Missing subcommands

I'm using:

PHP 7.2.4
WP-CLI 1.5.0
BuddyPress 2.9.3
WordPress 4.9.2

I installed this package like this:

wp package install buddypress/wp-cli-buddypress

When I try to use a command that consists of more than two words e.g. bp group member I get an error:

Error: 'member' is not a registered subcommand of 'bp group'. See 'wp help bp group' for available subcommands.

I noticed that all three-word commands are affected. Just running wp bp only shows me two-word commands:

$ wp bp
usage: wp bp activity <command>
   or: wp bp component <command>
   or: wp bp email <command>
   or: wp bp friend <command>
   or: wp bp group <command>
   or: wp bp member <command>
   or: wp bp message <command>
   or: wp bp signup <command>
   or: wp bp tool <command>
   or: wp bp xprofile <command>

See 'wp help bp <command>' for more information on a specific command.

And the three-word commands are apparently not registered as subcommands since they're missing from this list as well:

$ wp bp group
usage: wp bp group create --name=<name> [--slug=<slug>] [--description=<description>] [--creator-id=<creator-id>] [--slug=<slug>] [--status=<status>] [--enable-forum=<enable-forum>] [--date-created=<date-created>] [--silent] [--porcelain]
   or: wp bp group delete <group-id>... [--yes]
   or: wp bp group generate [--count=<number>] [--status=<status>] [--creator-id=<creator-id>] [--enable-forum=<enable-forum>]
   or: wp bp group get <group-id> [--fields=<fields>] [--format=<format>]
   or: wp bp group list [--<field>=<value>] [--fields=<fields>] [--user-id=<user>] [--orderby=<orderby>] [--order=<order>] [--format=<format>] [--count=<number>]
   or: wp bp group update <group-id>... [--<field>=<value>]

See 'wp help bp group <command>' for more information on a specific command.

If I change the second word from group to something unique like groupp in wp-cli-bp.php then I can see & run the command as expected:

$ wp bp groupp
usage: wp bp groupp member <command>

See 'wp help bp groupp <command>' for more information on a specific command.

I also tried replacing the installed buddypress/wp-cli-buddypress package with a clone of the latest master branch and had the same problem.

Use proper PSR-4 naming for CLI classes

While reviewing the recent code from wp-cli-buddypress, @boonebgorges suggested this would be a very good opportunity to use proper PSR-4 naming for CLI classes.

As wp-cli-buddypress probably will be merged into BP core in the near future, it would be used as a start, setting the example for the whole BP project to use PSR-4 as well.

Personally, I'm all for it! But we would like to open this discussion to gather more feedback or possible drawbacks.

So, fire away! :)

Tasks before BuddyPress core merge

From my perspective, this is almost ready to go into BP core, but:

  1. I'm unhappy about the random functions: get_random_user_id() get_random_group_id() get_random_login() generate_random_text(). I think WPCLI's "generate" dummy content functions are pretty weird.
    • Instead of get_random_user_id(), can we require the user to be specified via a required parameter, please?
    • For get_random_group_id(), can we make sure the random group is a public group? Can we use BP_Groups_Group::get_random( 1, 1 )?
    • For get_random_login(), why are we creating users? That's a WordPress thing? Can we avoid doing this entirely?
  2. The Todo comments on get_random_login() and get_components_and_actions() need resolving.
  3. When committed to BuddyPress, the class file names will have to match our conventions.
  4. get_components_and_actions()
    • This should not be hardcoded. Is there not a function in BP core that returns this, or can we do something to parse it out of $bp if not?
  5. Signups - create()
    • How about using the site domain instead of example.com for the email addresses?
  6. How about we use namespaces for this?

Internationalize package

This is more of a question rather than a suggestion. If the goal is to add this package on BuddyPress core, do we need to internationalize the strings?

I'd say yes. What are your thoughts @boonebgorges?

`activity list` should allow for filtering

The natural syntax (to me at least) seems like this:

wp bp activity list --user-id=5 - items with 5 as user_id
wp bp activity list --user-id=5 --component=groups - items with ( user_id = 5 && component = group )

There wouldn't be an OR syntax (though perhaps you could have comma syntax like --component=groups,activity for single params), but as an administrator, OR queries are less useful than AND drilldowns.

@renatonascalves What do you think of this idea and syntax?

Class not found while generating users

Hi All,

I'm not sure if this is the right place to report this issue. If not, my humble apologies ๐Ÿ˜… I'd happily repost it elsewhere ๐Ÿ˜ƒ

When running the command wp bp member generate --count=1 I receive the following error with stacktrace:

$ wp bp member generate --count=1
PHP Fatal error:  Uncaught Error: Class 'Buddypress\CLI\Command\User_Command' not found in /srv/users/serverpilot/apps/bptester/public/wp-content/plugins/buddypress/cli/components/member.php:34
Stack trace:
#0 [internal function]: Buddypress\CLI\Command\Member->generate(Array, Array)
#1 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Dispatcher/CommandFactory.php(89): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Dispatcher/Subcommand.php(425): call_user_func(Object(Closure), Array, Array)
#4 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php(353): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php(376): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php(1102): WP_CLI\Runner->_run_command_and_exit()
#7 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runn in /srv/users/serverpilot/apps/bptester/public/wp-content/plugins/buddypress/cli/components/member.php on line 34
Fatal error: Uncaught Error: Class 'Buddypress\CLI\Command\User_Command' not found in /srv/users/serverpilot/apps/bptester/public/wp-content/plugins/buddypress/cli/components/member.php:34
Stack trace:
#0 [internal function]: Buddypress\CLI\Command\Member->generate(Array, Array)
#1 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Dispatcher/CommandFactory.php(89): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Dispatcher/Subcommand.php(425): call_user_func(Object(Closure), Array, Array)
#4 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php(353): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php(376): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Runner.php(1102): WP_CLI\Runner->_run_command_and_exit()
#7 phar:///opt/sp/bin/wp-cli.phar/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runn in /srv/users/serverpilot/apps/bptester/public/wp-content/plugins/buddypress/cli/components/member.php on line 34

Other commands like wp bp group generate --count=1 seem to be working just fine.

The stacktrace from above is from a server installed with Serverpilot. But the same error occurs in a server installed with Local by Flywheel.

Any ideas how to fix this? I'm kinda lost here. Thanks!

Messages commands

What about the messages commands? Any value in having commands such as:

wp bp message list --user_id=10

My suggestions:

  • wp bp message add/create
  • wp bp message delete
  • wp bp message list
  • wp bp message get
  • wp bp message star
  • wp bp message generate (for testing)

`list` commands should have sensible defaults for count

wp bp signup list shows only a single signup. This is because the default value for number in BP_Signup::get() is 1. This is confusing.

We should come up with some consistent conventions for default list counts, as well as the name of the parameter - BP goes between count, max, per_page, number, etc. How does WP-CLI do this?

Call to undefined function dbDelta() when activating components

For example, trying the command wp bp core activate settings results in this error message:

Fatal error: Uncaught Error: Call to undefined function dbDelta() in /Users/username-redacted/Sites/sitename-redacted/public/wp-content/plugins/buddypress/bp-core/admin/bp-core-admin-schema.php:159
Stack trace:
#0 /Users/username-redacted/Sites/sitename-redacted/public/wp-content/plugins/buddypress/bp-core/admin/bp-core-admin-schema.php(35): bp_core_install_activity_streams()
#1 /Users/username-redacted/.wp-cli/packages/vendor/boonebgorges/wp-cli-buddypress/components/core.php(46): bp_core_install(Array)
#2 [internal function]: BPCLI_Core->activate(Array, Array)
#3 /usr/local/Cellar/wp-cli/1.1.0/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#4 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#5 /usr/local/Cellar/wp-cli/1.1.0/php/WP_CLI/Dispatcher/Subcommand.php(390): call_user_func(Object(Closure), Array, Array)
#6 /usr/local/Cellar/wp-cli/1.1.0/php/WP_CLI/Runner.php(316): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#7 /usr/local/Cellar/wp-cli/1.1.0/php/ in /Users/username-redacted/Sites/sitename-redacted/public/wp-content/plugins/buddypress/bp-core/admin/bp-core-admin-schema.php on line 159

Despite this, the component is successfully activated.

I'm on pretty much the latest version of all relevant packages, and have an up-to-date Homebrew environment:

WordPress 4.7.3
WP-CLI 1.1
wp-cli-buddypress 1.1.1
Apache 2.4.25
PHP 7.0.17
MySQL 5.7.17.

Active/Inactive Components

I noticed there is a bug in the wp bp component list command. The components are not returning correctly.

I'm adding this ticket so that I don't forget to fix it soon.

Add Travis Support

I don't have the necessary rights to add this support. So if anyone with the rights could do that, that would be much appreciated. :)

Consider adding functional tests to this project

Functional tests are an integral ingredient of highly-quality, maintainable commands. WP-CLI tries to make it as easy as possible to add functional tests to your package with its wp scaffold package-tests command:

https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-tests

I'd encourage you to consider adding functional tests to your package :) By starting your functional tests early on, it also makes it much easier to maintain your project over time.

Require confirmation for irreversible delete operations

Most BP delete operations are irreversible, and some of them have cascading effects. For example, deleting a group also deletes group memberships, and may delete some group content depending on plugins. In these cases, I think it makes sense to require confirmation, which could then be bypassed with the --yes flag.

`signup activate` should not require activation key

Speaking as someone who has had to manage large BP installations, I've had to manually activate many signups. I even wrote a plugin for it https://wordpress.org/plugins/unconfirmed/ :) Yet rarely has the activation process started with a key. Usually the user reports her login or email address. It's only when doing development that I've had a need for a CLI command that activates by key.

Let's make this a bit more useful. I see two options. The easy one is to offer three assoc_args flags - activation-key, user-email, user-login - and require at least one of them. The harder one, which might be a bit more useful in the real world, is to have some sort of "fuzzy" logic like I built for signup get, so that you can say wp bp signup activate foo and it'll guess what you mean by 'foo'; an optional --field parameter would let you be more specific. This latter technique would probably benefit from a confirm step: "You are about to activate the following signup...".

@renatonascalves or others, do you have thoughts about what would be best here?

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.