586624d5 by Jeff Balicki

my account

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 271536b0
# Ultimate Member - Account tabs
Adds custom tabs to users' accounts.
This plugin has to be used with the [Ultimate Member](https://wordpress.org/plugins/ultimate-member/) plugin.
__Note:__ This is a free extension created for the community. The Ultimate Member team does not support this extension.
## Key features
- Ability to create custom account tabs with custom title, content and icon.
- Ability to restrict custom account tabs for specific user roles.
- Ability to embed a profile form into the custom account tab.
## Installation
### Clone from GitHub
Open git bash, navigate to the **plugins** folder and execute this command:
`git clone --branch=main git@github.com:umdevelopera/um-account-tabs.git um-account-tabs`
Once the plugin is cloned, enter your site admin dashboard and go to _wp-admin > Plugins > Installed Plugins_. Find the "Ultimate Member - Account tabs" plugin and click the "Activate" link.
### Install from ZIP archive
You can install this plugin from the [ZIP archive](https://drive.google.com/file/d/1mXrY5qQT-dJDlBek30kgSjlwN_eeLf0l/view) as any other plugin. Follow [this instruction](https://wordpress.org/support/article/managing-plugins/#upload-via-wordpress-admin).
## How to use
Once the plugin is activated go to *wp-admin > Ultimate Member > Account Tabs*.
Click the __Add New__ button, then configure a new account tab as shown on the image below.
Select the profile form you want to embed to account in the setting __Embed a profile form__.
### Screenshots:
Image - How to create a new account tab.
![WP, Ultimate Member, Account Tabs](https://user-images.githubusercontent.com/113178913/200563260-7c127190-2933-4b93-94b7-ddf190706bb9.png)
Image - Custom account tab settings.
![WP, Ultimate Member, Account Tabs, Add (Edit) Tab](https://user-images.githubusercontent.com/113178913/200563285-df4bd1bc-536c-4be4-8354-bf19365b75a9.png)
Image - An example of the embed profile form in Account
![example - custom tab with profile form in account](https://user-images.githubusercontent.com/113178913/200563307-c69e7d23-e568-41c6-acb6-712ea32e87a2.png)
## Related links:
Download the core __Ultimate Member__ plugin: https://wordpress.org/plugins/ultimate-member/
The __Profile tabs__ extension: https://ultimatemember.com/extensions/profile-tabs/
Ultimate Member home page: https://ultimatemember.com/
Ultimate Member documentation: https://docs.ultimatemember.com/
Articles:
- [Account Tab](https://docs.ultimatemember.com/article/40-account-tab)
- [Extend Ultimate Member Account page with custom tabs/content](https://docs.ultimatemember.com/article/65-extend-ultimate-member-account-page-with-custom-tabs-content)
- [Extend the Account page with Ultimate Member pre-defined fields](https://docs.ultimatemember.com/article/1770-extend-the-account-page-with-ultimate-member-pre-defined-fields)
jQuery( document.body ).on( 'click', '#UM_fonticons a.um-admin-modal-back:not(.um-admin-modal-cancel)', function ( e ) {
var $input = jQuery( '#um_account_tab__icon' );
var icon = jQuery( e.currentTarget ).data('code') || $input.siblings( '.um-admin-icon-value' ).find( 'i' ).attr( 'class' );
$input.val( icon );
} );
\ No newline at end of file
<?php
/**
* Adds the Account Tabs sumbenu to the Ultimate Member admin menu.
*
* @package um_ext\um_account_tabs\admin
*/
namespace um_ext\um_account_tabs\admin;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um_ext\um_account_tabs\admin\Admin' ) ) {
/**
* Class Admin.
*
* @package um_ext\um_account_tabs\admin
*/
class Admin {
/**
* Admin constructor.
*/
public function __construct() {
add_action( 'admin_menu', array( &$this, 'create_admin_submenu' ), 1001 );
add_action( 'load-post.php', array( &$this, 'init_metaboxes' ), 9 );
add_action( 'load-post-new.php', array( &$this, 'init_metaboxes' ), 9 );
add_filter( 'um_is_ultimatememeber_admin_screen', array( &$this, 'is_um_screen' ), 10, 1 );
add_filter( 'wp_insert_post_data', array( &$this, 'filter_post_data' ), 10, 4 );
}
/**
* Add submenu for Account Tabs.
*/
public function create_admin_submenu() {
add_submenu_page(
'ultimatemember',
__( 'Account Tabs', 'um-account-tabs' ),
__( 'Account Tabs', 'um-account-tabs' ),
'manage_options',
'edit.php?post_type=um_account_tabs'
);
}
/**
* Enqueue admin scripts.
*
* @global object $current_screen
*/
public function enqueue() {
global $current_screen;
if ( isset( $current_screen ) && 'um_account_tabs' === $current_screen->id ) {
wp_enqueue_script(
'um-account-tabs-admin',
um_account_tabs_url . '/assets/js/um-account-tabs-admin.js',
array( 'jquery' ),
um_account_tabs_version,
true
);
}
}
/**
* Validates the account tab name and slug to be not empty.
*
* @param array $data An array of slashed, sanitized, and processed post data.
* @param array $postarr An array of sanitized (and slashed) but otherwise unmodified post data.
* @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed post data.
* @param bool $update Whether this is an existing post being updated.
* @return array
*/
public function filter_post_data( $data, $postarr, $unsanitized_postarr, $update ) {
if ( isset( $data['post_type'] ) && 'um_account_tabs' === $data['post_type'] && isset( $unsanitized_postarr['post_status'] ) && 'auto-draft' !== $unsanitized_postarr['post_status'] ) {
if ( empty( $data['post_title'] ) ) {
$data['post_title'] = 'Account Tab';
}
if ( empty( $data['post_name'] ) ) {
$tab_id = empty( $unsanitized_postarr['ID'] ) ? time() : $unsanitized_postarr['ID'];
$data['post_name'] = 'account-tab-' . $tab_id;
}
}
return $data;
}
/**
* Extends UM admin pages for enqueue scripts.
*
* @param bool $is_um Whether this screen is a part of the Ultimate Member.
*
* @return bool
*/
public function is_um_screen( $is_um ) {
global $current_screen;
if ( ! empty( $current_screen ) && strstr( $current_screen->id, 'um_account_tabs' ) ) {
$is_um = true;
}
return $is_um;
}
/**
* Add metaboxes to Add/Edit Account Tab screen.
*/
public function init_metaboxes() {
global $current_screen;
if ( isset( $current_screen ) && 'um_account_tabs' === $current_screen->id ) {
add_action( 'admin_enqueue_scripts', array( &$this, 'enqueue' ) );
add_action( 'add_meta_boxes', array( &$this, 'add_metaboxes' ), 1 );
add_action( 'save_post_um_account_tabs', array( &$this, 'save_metaboxes_data' ), 10, 3 );
}
}
/**
* Add metaboxes.
*/
public function add_metaboxes() {
// don't show metaboxes for translations.
if ( UM()->external_integrations()->is_wpml_active() ) {
global $post, $sitepress;
$tab_id = $sitepress->get_object_id( $post->ID, 'um_account_tabs', true, $sitepress->get_default_language() );
if ( $tab_id && $tab_id !== $post->ID ) {
return;
}
}
add_meta_box(
'um-admin-custom-account-tab/um-form{' . um_account_tabs_path . '}',
__( 'Pre-defined content', 'um-account-tabs' ),
array( UM()->metabox(), 'load_metabox_custom' ),
'um_account_tabs',
'normal',
'default'
);
add_meta_box(
'um-admin-custom-account-tab/access{' . um_account_tabs_path . '}',
__( 'Display Settings', 'um-account-tabs' ),
array( UM()->metabox(), 'load_metabox_custom' ),
'um_account_tabs',
'side',
'default'
);
add_meta_box(
'um-admin-custom-account-tab/icon{' . um_account_tabs_path . '}',
__( 'Customize this tab', 'um-account-tabs' ),
array( UM()->metabox(), 'load_metabox_custom' ),
'um_account_tabs',
'side',
'default'
);
}
/**
* Save settings in metaboxes.
*
* @param int $post_id Post ID.
* @param \WP_Post $post Post object.
* @param bool $update Whether this is an existing post being updated.
*/
public function save_metaboxes_data( $post_id, $post, $update ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
if ( empty( $_POST ) ) {
return;
}
check_admin_referer( 'update-post_' . $post_id );
if ( UM()->external_integrations()->is_wpml_active() ) {
global $sitepress;
$tab_id = $sitepress->get_object_id( $post_id, 'um_account_tabs', true, $sitepress->get_default_language() );
if ( $tab_id && $tab_id !== $post_id ) {
return;
}
}
if ( empty( $_POST['um_account_tab'] ) ) {
return;
}
$input = map_deep( wp_unslash( $_POST['um_account_tab'] ), 'sanitize_text_field' );
$form = '';
if ( isset( $input['_um_form'] ) ) {
$form = absint( $input['_um_form'] );
}
update_post_meta( $post_id, '_um_form', $form );
$roles = array();
if ( isset( $input['_can_have_this_tab_roles'] ) && is_array( $input['_can_have_this_tab_roles'] ) ) {
$roles = $input['_can_have_this_tab_roles'];
}
update_post_meta( $post_id, '_can_have_this_tab_roles', $roles );
$icon = '';
if ( isset( $input['_icon'] ) ) {
$icon = sanitize_key( $input['_icon'] );
}
update_post_meta( $post_id, '_icon', $icon );
$icon = '';
if ( isset( $input['_position'] ) ) {
$icon = sanitize_key( $input['_position'] );
}
update_post_meta( $post_id, '_position', $icon );
}
}
}
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $post;
$tab_id = $post->ID;
if ( UM()->external_integrations()->is_wpml_active() ) {
global $sitepress;
$default_lang_tab_id = $sitepress->get_object_id( $tab_id, 'um_account_tabs', true, $sitepress->get_default_language() );
if ( $default_lang_tab_id && $default_lang_tab_id !== $tab_id ) {
$tab_id = $default_lang_tab_id;
echo '<p>' . esc_html__( 'These settings are obtained from a Account tab in the default language', 'um-account-tabs' ) . '</p>';
}
}
$all_roles = UM()->roles()->get_roles();
$fields = array(
array(
'id' => '_can_have_this_tab_roles',
'type' => 'select',
'options' => $all_roles,
'label' => __( 'Show on these roles accounts', 'um-account-tabs' ),
'tooltip' => __( 'You could select the roles which have the current account tab at their form. If empty, account tab is visible for all roles at their forms.', 'um-account-tabs' ),
'multi' => true,
'value' => get_post_meta( $tab_id, '_can_have_this_tab_roles', true ),
),
);
UM()->admin_forms(
array(
'class' => 'um-account-tab-access um-top-label',
'prefix_id' => 'um_account_tab',
'fields' => $fields,
)
)->render_form();
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $post;
$tab_id = $post->ID;
if ( UM()->external_integrations()->is_wpml_active() ) {
global $sitepress;
$default_lang_tab_id = $sitepress->get_object_id( $tab_id, 'um_account_tabs', true, $sitepress->get_default_language() );
if ( $default_lang_tab_id && $default_lang_tab_id !== $tab_id ) {
$tab_id = $default_lang_tab_id;
echo '<p>' . esc_html__( 'These settings are obtained from a Account tab in the default language', 'um-account-tabs' ) . '</p>';
}
}
$position = get_post_meta( $tab_id, '_position', true );
if ( empty( $position ) ) {
$position = 800;
}
$fields = array(
array(
'id' => '_icon',
'type' => 'icon',
'label' => __( 'Icon', 'um-account-tabs' ),
'value' => (string) get_post_meta( $tab_id, '_icon', true ),
),
array(
'id' => '_position',
'type' => 'number',
'label' => __( 'Position', 'um-account-tabs' ),
'value' => (int) $position,
),
);
UM()->admin_forms(
array(
'class' => 'um-account-tab-icon um-top-label',
'prefix_id' => 'um_account_tab',
'fields' => $fields,
)
)->render_form();
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
global $post;
$tab_id = $post->ID;
if ( UM()->external_integrations()->is_wpml_active() ) {
global $sitepress;
$default_lang_tab_id = $sitepress->get_object_id( $tab_id, 'um_account_tabs', true, $sitepress->get_default_language() );
if ( $default_lang_tab_id && $default_lang_tab_id !== $tab_id ) {
$tab_id = $default_lang_tab_id;
echo '<p>' . esc_html__( 'These settings are obtained from a Account tab in the default language', 'um-account-tabs' ) . '</p>';
}
}
$forms_options = array(
'' => __( 'No form', 'um-account-tabs' ),
);
// phpcs:disable WordPress.DB.SlowDBQuery.slow_db_query_meta_query
$forms = get_posts(
array(
'post_type' => 'um_form',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => '_um_mode',
'compare' => '=',
'value' => 'profile',
),
),
)
);
// phpcs:enable
if ( is_array( $forms ) ) {
foreach ( $forms as $form ) {
$forms_options[ $form->ID ] = $form->post_title;
}
}
$selected_form = get_post_meta( $tab_id, '_um_form', true );
if ( $selected_form ) {
echo '<p>[ultimatemember form_id="' . absint( $selected_form ) . '" /]</p>';
}
$fields = array(
array(
'id' => '_um_form',
'type' => 'select',
'label' => __( 'Embed a profile form', 'um-account-tabs' ),
'options' => $forms_options,
'value' => $selected_form,
),
);
UM()->admin_forms(
array(
'class' => 'um-account-tab-um-form um-top-label',
'prefix_id' => 'um_account_tab',
'fields' => $fields,
)
)->render_form();
<?php
/**
* Modifies the Account page.
*
* @package um_ext\um_account_tabs\core
*/
namespace um_ext\um_account_tabs\core;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Account.
*
* @package um_ext\um_account_tabs\core
*/
class Account {
/**
* Custom tabs.
*
* @var array
*/
protected $tabs = null;
/**
* Account constructor.
*/
public function __construct() {
add_filter( 'um_account_page_default_tabs_hook', array( &$this, 'add_tabs' ), 100, 1 );
}
/**
* Get all custom account tabs like posts array.
*
* @return array Posts.
*/
public function get_tabs() {
if ( ! is_array( $this->tabs ) ) {
$this->tabs = get_posts(
array(
'post_type' => 'um_account_tabs',
'posts_per_page' => -1,
)
);
}
return $this->tabs;
}
/**
* Add custom account tabs.
*
* @param array $tabs All account tabs.
*
* @return array
*/
public function add_tabs( $tabs ) {
foreach ( $this->get_tabs() as $tab ) {
if ( ! $this->can_have_tab( $tab->ID ) ) {
continue;
}
$icon = empty( $tab->_icon ) ? 'um-icon-plus' : $tab->_icon;
$position = absint( $tab->_position );
// Add tab to menu.
$tabs[ $position ][ $tab->post_name ] = array(
'icon' => $icon,
'title' => $tab->post_title,
'custom' => true,
'show_button' => ! empty( $tab->_um_form ),
'submit_title' => __( 'Update', 'um-account-tabs' ),
);
// Show tab content.
add_action(
'um_account_content_hook_' . $tab->post_name,
function( $args ) use ( $tab ) {
$output = '';
$userdata = get_userdata( get_current_user_id() );
$placeholders = array(
'{user_id}' => get_current_user_id(),
'{first_name}' => $userdata->first_name,
'{last_name}' => $userdata->last_name,
'{user_email}' => $userdata->user_email,
'{display_name}' => $userdata->display_name,
'[ultimatemember form_id=' => '[',
);
$tab_content = str_replace( array_keys( $placeholders ), array_values( $placeholders ), $tab->post_content );
// Fix conflict that may appear if the tab contains Elementor template.
if ( class_exists( '\Elementor\Plugin' ) ) {
\Elementor\Plugin::instance()->frontend->remove_content_filter();
$output .= apply_filters( 'the_content', $tab_content );
\Elementor\Plugin::instance()->frontend->add_content_filter();
} else {
$output .= apply_filters( 'the_content', $tab_content );
}
$output .= $this->um_custom_tab_form( $tab->ID, $tab->_um_form );
return $output;
}
);
}
return $tabs;
}
/**
* Check if user has the current tab by role.
*
* @param string $tab_id Tab key.
*
* @return bool
*/
public function can_have_tab( $tab_id ) {
$can_have = get_post_meta( $tab_id, '_can_have_this_tab_roles', true );
if ( empty( $can_have ) ) {
return true;
}
$current_user_roles = UM()->roles()->get_all_user_roles( get_current_user_id() );
if ( ! is_array( $current_user_roles ) ) {
$current_user_roles = array();
}
if ( array_intersect( $current_user_roles, $can_have ) ) {
return true;
}
return false;
}
/**
* Generate content for custom tabs.
*
* @param string $tab_id Tab ID.
* @param int $form_id Form ID.
*
* @return string
*/
public function um_custom_tab_form( $tab_id, $form_id = 0 ) {
if ( empty( $form_id ) ) {
return '';
}
$user_id = get_current_user_id();
// save profile settings.
$set_id = UM()->fields()->set_id;
$set_mode = UM()->fields()->set_mode;
$editing = UM()->fields()->editing;
$viewing = UM()->fields()->viewing;
// set profile settings.
UM()->fields()->set_id = $form_id;
UM()->fields()->set_mode = get_post_meta( $form_id, '_um_mode', true );
UM()->fields()->editing = true;
UM()->fields()->viewing = false;
$args = array(
'form_id' => $form_id,
);
ob_start();
do_action( 'um_before_profile_fields', $args );
do_action( 'um_main_profile_fields', $args );
do_action( 'um_after_form_fields', $args );
?>
<input type="hidden" name="is_signup" value="1">
<input type="hidden" name="profile_nonce" value="<?php echo esc_attr( wp_create_nonce( 'um-profile-nonce' . $user_id ) ); ?>">
<input type="hidden" name="user_id" value="<?php echo esc_attr( $user_id ); ?>">
<?php
$contents = ob_get_clean();
// restore default account settings.
UM()->fields()->set_id = $set_id;
UM()->fields()->set_mode = $set_mode;
UM()->fields()->editing = $editing;
UM()->fields()->viewing = $viewing;
return $contents;
}
}
<?php
/**
* Adds a custom post type.
*
* @package um_ext\um_account_tabs\core
*/
namespace um_ext\um_account_tabs\core;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Common.
*
* @package um_ext\um_account_tabs\core
*/
class Common {
/**
* Common constructor.
*/
public function __construct() {
add_action( 'init', array( $this, 'register_post_type' ), 2 );
}
/**
* Register custom post type.
*/
public function register_post_type() {
$labels = array(
'name' => _x( 'Account tabs', 'Post Type General Name', 'um-account-tabs' ),
'singular_name' => _x( 'Account tab', 'Post Type Singular Name', 'um-account-tabs' ),
'menu_name' => __( 'Account Tabs', 'um-account-tabs' ),
'all_items' => __( 'All Tabs', 'um-account-tabs' ),
'add_new_item' => __( 'Add New Tab', 'um-account-tabs' ),
'add_new' => __( 'Add New', 'um-account-tabs' ),
'new_item' => __( 'New Tab', 'um-account-tabs' ),
'edit_item' => __( 'Edit Tab', 'um-account-tabs' ),
'update_item' => __( 'Update Tab', 'um-account-tabs' ),
'view_item' => __( 'View Tab', 'um-account-tabs' ),
'view_items' => __( 'View Tabs', 'um-account-tabs' ),
);
$args = array(
'label' => __( 'Account Tabs', 'um-account-tabs' ),
'labels' => $labels,
'hierarchical' => false,
'public' => false,
'show_ui' => true,
'show_in_menu' => false,
'show_in_admin_bar' => false,
'show_in_nav_menus' => false,
'can_export' => false,
'has_archive' => false,
'exclude_from_search' => true,
'capability_type' => 'page',
'supports' => array( 'title', 'editor' ),
);
register_post_type( 'um_account_tabs', $args );
}
}
<?php
/**
* Sets default settings on installation.
*
* @package um_ext\um_account_tabs\core
*/
namespace um_ext\um_account_tabs\core;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Setup
*
* @package um_ext\um_account_tabs\core
*/
class Setup {
/**
* Settings
*
* @var array
*/
public $settings_defaults;
/**
* Setup constructor.
*/
public function __construct() {
$this->settings_defaults = array();
}
/**
* Set Settings.
*/
public function set_default_settings() {
$options = get_option( 'um_options', array() );
foreach ( $this->settings_defaults as $key => $value ) {
if ( ! isset( $options[ $key ] ) ) {
$options[ $key ] = $value;
}
}
update_option( 'um_options', $options );
}
/**
* Run on plugin activation.
*/
public function run_setup() {
$this->set_default_settings();
}
}
<?php
/**
* Inits the extension.
*
* @package um_ext\um_account_tabs\core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class UM_Account_Tabs
*/
class UM_Account_Tabs {
/**
* An instance of the class.
*
* @var UM_Account_Tabs
*/
private static $instance;
/**
* Creates an instance of the class.
*
* @return UM_Account_Tabs
*/
public static function instance() {
if ( is_null( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* UM_Account_Tabs constructor.
*/
public function __construct() {
add_filter( 'um_call_object_Account_Tabs', array( &$this, 'get_this' ) );
$this->common();
if ( UM()->is_request( 'admin' ) ) {
$this->admin();
}
if ( UM()->is_request( 'frontend' ) ) {
$this->account();
}
}
/**
* @return $this UM_Account_Tabs
*/
public function get_this() {
return $this;
}
/**
* @return um_ext\um_account_tabs\core\Account()
*/
public function account() {
if ( empty( UM()->classes['um_account_tabs_account'] ) ) {
UM()->classes['um_account_tabs_account'] = new um_ext\um_account_tabs\core\Account();
}
return UM()->classes['um_account_tabs_account'];
}
/**
* @return um_ext\um_account_tabs\admin\Admin()
*/
public function admin() {
if ( empty( UM()->classes['um_account_tabs_admin'] ) ) {
UM()->classes['um_account_tabs_admin'] = new um_ext\um_account_tabs\admin\Admin();
}
return UM()->classes['um_account_tabs_admin'];
}
/**
* @return um_ext\um_account_tabs\core\Common()
*/
public function common() {
if ( empty( UM()->classes['um_account_tabs_common'] ) ) {
UM()->classes['um_account_tabs_common'] = new um_ext\um_account_tabs\core\Common();
}
return UM()->classes['um_account_tabs_common'];
}
}
/**
* Adds the class to the UM core.
*/
function um_init_um_account_tabs() {
if ( function_exists( 'UM' ) ) {
UM()->set_class( 'Account_Tabs', true );
}
}
add_action( 'plugins_loaded', 'um_init_um_account_tabs', -10, 1 );
msgid ""
msgstr ""
"Project-Id-Version: Ultimate Member - Account tabs\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-11 20:06+0000\n"
"PO-Revision-Date: 2022-12-11 20:07+0000\n"
"Last-Translator: Denis Baran\n"
"Language-Team: English (United States)\n"
"Language: en_US\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/\n"
"X-Loco-Version: 2.6.3; wp-6.1\n"
"X-Domain: um-account-tabs"
#: includes/admin/class-admin.php:37 includes/admin/class-admin.php:38
#: includes/core/class-common.php:29 includes/core/class-common.php:41
msgid "Account Tabs"
msgstr ""
#: includes/core/class-common.php:32
msgid "Add New"
msgstr ""
#: includes/core/class-common.php:31
msgid "Add New Tab"
msgstr ""
#. Description of the plugin
msgid "Adds custom tabs to user account."
msgstr ""
#: includes/core/class-common.php:30
msgid "All Tabs"
msgstr ""
#: includes/admin/class-admin.php:140
msgid "Customize this tab"
msgstr ""
#: includes/admin/class-admin.php:131
msgid "Display Settings"
msgstr ""
#: includes/core/class-common.php:34
msgid "Edit Tab"
msgstr ""
#: includes/admin/templates/account-tab/um-form.php:51
msgid "Embed a profile form"
msgstr ""
#. Author URI of the plugin
msgid "https://ultimatemember.com/support/"
msgstr ""
#: includes/admin/templates/account-tab/icon.php:27
msgid "Icon"
msgstr ""
#: includes/core/class-common.php:33
msgid "New Tab"
msgstr ""
#: includes/admin/templates/account-tab/um-form.php:19
msgid "No form"
msgstr ""
#: includes/admin/templates/account-tab/icon.php:33
msgid "Position"
msgstr ""
#: includes/core/class-common.php:27
msgctxt "Post Type General Name"
msgid "Account tabs"
msgstr ""
#: includes/core/class-common.php:28
msgctxt "Post Type Singular Name"
msgid "Account tab"
msgstr ""
#: includes/admin/class-admin.php:122
msgid "Pre-defined content"
msgstr ""
#: includes/admin/templates/account-tab/access.php:25
msgid "Show on these roles accounts"
msgstr ""
#: includes/admin/templates/account-tab/access.php:14
#: includes/admin/templates/account-tab/icon.php:14
#: includes/admin/templates/account-tab/um-form.php:14
msgid "These settings are obtained from a Account tab in the default language"
msgstr ""
#. Name of the plugin
msgid "Ultimate Member - Account tabs"
msgstr ""
#. Author of the plugin
msgid "Ultimate Member support"
msgstr ""
#: includes/core/class-account.php:72
msgid "Update"
msgstr ""
#: includes/core/class-common.php:35
msgid "Update Tab"
msgstr ""
#: includes/core/class-common.php:36
msgid "View Tab"
msgstr ""
#: includes/core/class-common.php:37
msgid "View Tabs"
msgstr ""
#: includes/admin/templates/account-tab/access.php:26
msgid ""
"You could select the roles which have the current account tab at their form. "
"If empty, account tab is visible for all roles at their forms."
msgstr ""
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Ultimate Member - Account tabs\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-12-11 20:06+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: \n"
"Language: \n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/\n"
"X-Loco-Version: 2.6.3; wp-6.1\n"
"X-Domain: um-account-tabs"
#: includes/admin/class-admin.php:37 includes/admin/class-admin.php:38
#: includes/core/class-common.php:29 includes/core/class-common.php:41
msgid "Account Tabs"
msgstr ""
#: includes/core/class-common.php:32
msgid "Add New"
msgstr ""
#: includes/core/class-common.php:31
msgid "Add New Tab"
msgstr ""
#. Description of the plugin
msgid "Adds custom tabs to user account."
msgstr ""
#: includes/core/class-common.php:30
msgid "All Tabs"
msgstr ""
#: includes/admin/class-admin.php:140
msgid "Customize this tab"
msgstr ""
#: includes/admin/class-admin.php:131
msgid "Display Settings"
msgstr ""
#: includes/core/class-common.php:34
msgid "Edit Tab"
msgstr ""
#: includes/admin/templates/account-tab/um-form.php:51
msgid "Embed a profile form"
msgstr ""
#. Author URI of the plugin
msgid "https://ultimatemember.com/support/"
msgstr ""
#: includes/admin/templates/account-tab/icon.php:27
msgid "Icon"
msgstr ""
#: includes/core/class-common.php:33
msgid "New Tab"
msgstr ""
#: includes/admin/templates/account-tab/um-form.php:19
msgid "No form"
msgstr ""
#: includes/admin/templates/account-tab/icon.php:33
msgid "Position"
msgstr ""
#: includes/core/class-common.php:27
msgctxt "Post Type General Name"
msgid "Account tabs"
msgstr ""
#: includes/core/class-common.php:28
msgctxt "Post Type Singular Name"
msgid "Account tab"
msgstr ""
#: includes/admin/class-admin.php:122
msgid "Pre-defined content"
msgstr ""
#: includes/admin/templates/account-tab/access.php:25
msgid "Show on these roles accounts"
msgstr ""
#: includes/admin/templates/account-tab/access.php:14
#: includes/admin/templates/account-tab/icon.php:14
#: includes/admin/templates/account-tab/um-form.php:14
msgid "These settings are obtained from a Account tab in the default language"
msgstr ""
#. Name of the plugin
msgid "Ultimate Member - Account tabs"
msgstr ""
#. Author of the plugin
msgid "Ultimate Member support"
msgstr ""
#: includes/core/class-account.php:72
msgid "Update"
msgstr ""
#: includes/core/class-common.php:35
msgid "Update Tab"
msgstr ""
#: includes/core/class-common.php:36
msgid "View Tab"
msgstr ""
#: includes/core/class-common.php:37
msgid "View Tabs"
msgstr ""
#: includes/admin/templates/account-tab/access.php:26
msgid ""
"You could select the roles which have the current account tab at their form. "
"If empty, account tab is visible for all roles at their forms."
msgstr ""
=== Ultimate Member - Account tabs ===
Author: Ultimate Member support
Plugin URI: https://github.com/umdevelopera/um-account-tabs
Tags: ultimate member, account, profile, tabs
Requires at least: 6.0
Tested up to: 6.1.1
Stable tag: 1.0.1
License: GNU Version 2 or Any Later Version
License URI: http://www.gnu.org/licenses/gpl-3.0.txt
Requires UM core at least: 2.5.0
== Description ==
Adds custom tabs to users' accounts.
= Key Features =
* Ability to create custom account tabs with custom title, content and icon.
* Ability to restrict custom account tabs for specific user roles.
* Ability to embed a profile form into the custom account tab.
== Installation ==
1. Click the "Code" item then "Download Zip" to download the archive.
2. Unpack the downloaded archive and change the folder name to "um-account-tabs".
3. Connect your site via FTP and copy the "um-account-tabs" folder to the /wp-content/plugins/ directory.
4. Enter your site admin dashboard and go to Plugins > Installed Plugins.
5. Find the "Ultimate Member - Account tabs" plugin and click the "Activate" link.
== Changelog ==
= 1.0.1: December 11, 2022 =
* Added: Readme file.
* Added: Translation pattern.
* Improved: WordPress Coding Standards.
= 1.0.0: November 08, 2022 =
* Initial release.
\ No newline at end of file
<?php
/**
Plugin Name: Ultimate Member - Account tabs
Plugin URI: https://github.com/umdevelopera/um-account-tabs
Description: Adds custom tabs to user account.
Version: 1.0.1
Author: Ultimate Member support
Author URI: https://ultimatemember.com/support/
Text Domain: um-account-tabs
Domain Path: /languages
UM version: 2.5.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once ABSPATH . 'wp-admin/includes/plugin.php';
$plugin_data = get_plugin_data( __FILE__ );
define( 'um_account_tabs_url', plugin_dir_url( __FILE__ ) );
define( 'um_account_tabs_path', plugin_dir_path( __FILE__ ) );
define( 'um_account_tabs_plugin', plugin_basename( __FILE__ ) );
define( 'um_account_tabs_extension', $plugin_data['Name'] );
define( 'um_account_tabs_version', $plugin_data['Version'] );
define( 'um_account_tabs_textdomain', 'um-account-tabs' );
define( 'um_account_tabs_requires', '2.5.0' );
if ( ! function_exists( 'um_account_tabs_plugins_loaded' ) ) {
/** Loads translation files */
function um_account_tabs_plugins_loaded() {
$locale = ( get_locale() !== '' ) ? get_locale() : 'en_US';
load_textdomain( um_account_tabs_textdomain, WP_LANG_DIR . '/plugins/' . um_account_tabs_textdomain . '-' . $locale . '.mo' );
load_plugin_textdomain( um_account_tabs_textdomain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
}
add_action( 'plugins_loaded', 'um_account_tabs_plugins_loaded', 0 );
add_action( 'plugins_loaded', 'um_account_tabs_check_dependencies', -20 );
if ( ! function_exists( 'um_account_tabs_check_dependencies' ) ) {
/** Checks dependencies and calls the plugin main file */
function um_account_tabs_check_dependencies() {
if ( ! defined( 'um_path' ) || ! file_exists( um_path . 'includes/class-dependencies.php' ) ) {
/** UM is not installed. */
function um_account_tabs_dependencies() {
// translators: %s - plugin name.
echo '<div class="error"><p>' . wp_kses_post( sprintf( __( 'The <strong>%s</strong> extension requires the Ultimate Member plugin to be activated to work properly. You can download it <a href="https://wordpress.org/plugins/ultimate-member">here</a>', 'um-user-photos' ), um_account_tabs_extension ) ) . '</p></div>';
}
add_action( 'admin_notices', 'um_account_tabs_dependencies' );
} else {
if ( ! function_exists( 'UM' ) ) {
require_once um_path . 'includes/class-dependencies.php';
$is_um_active = um\is_um_active();
} else {
$is_um_active = UM()->dependencies()->ultimatemember_active_check();
}
if ( ! $is_um_active ) {
/** UM is not active. */
function um_account_tabs_dependencies() {
// translators: %s - plugin name.
echo '<div class="error"><p>' . wp_kses_post( sprintf( __( 'The <strong>%s</strong> extension requires the Ultimate Member plugin to be activated to work properly. You can download it <a href="https://wordpress.org/plugins/ultimate-member">here</a>', 'um-user-photos' ), um_account_tabs_extension ) ) . '</p></div>';
}
add_action( 'admin_notices', 'um_account_tabs_dependencies' );
} else {
require_once um_account_tabs_path . 'includes/core/class-um-account-tabs.php';
}
}
}
}
register_activation_hook( um_account_tabs_plugin, 'um_account_tabs_activation_hook' );
if ( ! function_exists( 'um_account_tabs_activation_hook' ) ) {
/** Activation script */
function um_account_tabs_activation_hook() {
// first install.
$version = get_option( 'um_account_tabs_version' );
if ( ! $version ) {
update_option( 'um_account_tabs_last_version_upgrade', um_account_tabs_version );
}
if ( um_account_tabs_version !== $version ) {
update_option( 'um_account_tabs_version', um_account_tabs_version );
}
// run setup.
if ( ! class_exists( 'um_ext\um_account_tabs\core\Setup' ) ) {
require_once um_account_tabs_path . 'includes/core/class-setup.php';
}
$setup = new um_ext\um_account_tabs\core\Setup();
$setup->run_setup();
}
}