IDEA! Facebook styles account switching
-
Got a practical idea to enhance this plugin to allow users to switch between buddypress accounts (like you can do in facebook) –
The allow multiple user accounts plugin https://wordpress.org/plugins/allow-multiple-accounts/ allows a user to register multiple user accounts with one email address…
If we could filter the accounts listed in the switch user user list to only show the accounts the for email address of the logged in user, this could work pretty much like facebook allowing users to switch between their accounts…
In the Allow Multiple Accounts plugin there already exists the functions needed to easily achieve this
/* * ******************* * TEMPLATE FUNCTIONS * * Functions suitable for use in other themes and plugins * ******************* */ /** * Returns a count of the number of users associated with a given email address. * * @since 2.0 * * @param string $email The email address. * @return int The number of users associated with the given email. */ if ( ! function_exists( 'c2c_count_multiple_accounts' ) ) { function c2c_count_multiple_accounts( $email ) { return c2c_AllowMultipleAccounts::get_instance()->count_multiple_accounts( $email ); } add_action( 'c2c_count_multiple_accounts', 'c2c_count_multiple_accounts' ); } /** * Returns the users associated with the given email address. * * @since 2.0 * * @param string $email The email address. * @return array All of the users associated with the given email address. */ if ( ! function_exists( 'c2c_get_users_by_email' ) ) { function c2c_get_users_by_email( $email ) { return c2c_AllowMultipleAccounts::get_instance()->get_users_by_email( $email ); } add_action( 'c2c_get_users_by_email', 'c2c_get_users_by_email' ); } /** * Returns a boolean indicating if the given email address is associated with more * than one user account. * * @since 2.0 * * @param string $email The email address. * @return bool True if the email address is associated with more than one user account. */ if ( ! function_exists( 'c2c_has_multiple_accounts' ) ) { function c2c_has_multiple_accounts( $email ) { return c2c_AllowMultipleAccounts::get_instance()->has_multiple_accounts( $email ); } add_action( 'c2c_has_multiple_accounts', 'c2c_has_multiple_accounts' ); }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘IDEA! Facebook styles account switching’ is closed to new replies.