Merge branch 'hub-multiuser' of https://github.com/frappe/erpnext into hub-multiuser
diff --git a/erpnext/public/js/hub/components/DetailView.vue b/erpnext/public/js/hub/components/DetailView.vue
index 70ec94c..2f1a941 100644
--- a/erpnext/public/js/hub/components/DetailView.vue
+++ b/erpnext/public/js/hub/components/DetailView.vue
@@ -38,7 +38,7 @@
 					</div>
 				</div>
 
-				<div v-if="menu_items" class="col-md-1">
+				<div v-if="menu_items && menu_items.length" class="col-md-1">
 					<div class="dropdown pull-right hub-item-dropdown">
 						<a class="dropdown-toggle btn btn-xs btn-default" data-toggle="dropdown">
 							<span class="caret"></span>
diff --git a/erpnext/public/js/hub/marketplace.js b/erpnext/public/js/hub/marketplace.js
index bd9f64b..808afca 100644
--- a/erpnext/public/js/hub/marketplace.js
+++ b/erpnext/public/js/hub/marketplace.js
@@ -29,13 +29,10 @@
 			this.setup_events();
 			this.refresh();
 
-			if (is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
-				// show buttons only to System Manager
-				if (!hub.is_seller_registered()) {
-					this.page.set_primary_action('Become a Seller', this.show_register_dialog.bind(this))
-				} else {
-					this.page.set_secondary_action('Add Users', this.show_add_user_dialog.bind(this));
-				}
+			if (!hub.is_seller_registered()) {
+				this.page.set_primary_action('Become a Seller', this.show_register_dialog.bind(this))
+			} else {
+				this.page.set_secondary_action('Add Users', this.show_add_user_dialog.bind(this));
 			}
 		});
 	}
@@ -98,6 +95,11 @@
 			return;
 		}
 
+		if (!is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
+			frappe.msgprint(__('You need to be a user with System Manager and Item Manager roles to register on Marketplace.'));
+			return;
+		}
+
 		this.register_dialog = ProfileDialog(
 			__('Become a Seller'),
 			{
@@ -126,6 +128,11 @@
 	}
 
 	show_add_user_dialog() {
+		if (!is_subset(['System Manager', 'Item Manager'], frappe.user_roles)) {
+			frappe.msgprint(__('You need to be a user with System Manager and Item Manager roles to add users to Marketplace.'));
+			return;
+		}
+
 		this.get_unregistered_users()
 			.then(r => {
 				const user_list = r.message;
diff --git a/erpnext/public/js/hub/pages/Item.vue b/erpnext/public/js/hub/pages/Item.vue
index 272be58..446327a 100644
--- a/erpnext/public/js/hub/pages/Item.vue
+++ b/erpnext/public/js/hub/pages/Item.vue
@@ -19,7 +19,7 @@
 				:value="item_views_and_ratings"
 			></detail-header-item>
 
-			<button slot="detail-header-item"
+			<button v-if="primary_action" slot="detail-header-item"
 				class="btn btn-primary btn-sm margin-top"
 				@click="primary_action.action"
 			>
@@ -56,7 +56,7 @@
 			menu_items: [
 				{
 					label: __('Save Item'),
-					condition: !this.is_own_item,
+					condition: hub.is_user_registered() && !this.is_own_item,
 					action: this.add_to_saved_items
 				},
 				{
@@ -66,12 +66,12 @@
 				},
 				{
 					label: __('Edit Details'),
-					condition: this.is_own_item,
+					condition: hub.is_user_registered() && this.is_own_item,
 					action: this.edit_details
 				},
 				{
 					label: __('Unpublish Item'),
-					condition: this.is_own_item,
+					condition: hub.is_user_registered() && this.is_own_item,
 					action: this.unpublish_item
 				}
 			]
@@ -125,9 +125,13 @@
 		},
 
 		primary_action() {
-			return {
-				label: __('Contact Seller'),
-				action: this.contact_seller.bind(this)
+			if (hub.is_user_registered()) {
+				return {
+					label: __('Contact Seller'),
+					action: this.contact_seller.bind(this)
+				}
+			} else {
+				return undefined;
 			}
 		}
 	},